Skip to content

Commit

Permalink
Reducer Changes for Modulo
Browse files Browse the repository at this point in the history
Adds modulo reductions.
  • Loading branch information
agureev committed Oct 9, 2023
1 parent f9b0b89 commit b1ce8e9
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/lambda/lambda.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ nil"))
(divide #'divide)
(times #'times)
(lamb-eq #'lamb-eq)
(lamb-lt #'lamb-lt)))
(lamb-lt #'lamb-lt)
(modulo #'modulo)))

(defun dispatch-arith (tterm)
"A dispatch refering the class of an arithmetic term
Expand All @@ -402,7 +403,8 @@ to its corresponding operation"
(divide #'floor)
(times #'*)
(lamb-eq #'=)
(lamb-lt #'<)))
(lamb-lt #'<)
(modulo #'mod)))

(defun index-excess (tterm)
"Checks all indeces occuring in a term which will be substituted.
Expand Down Expand Up @@ -438,7 +440,8 @@ beta-substitution of indices which point outside of the app term"
divide
lamb-eq
lamb-lt
pair)
pair
modulo)
(funcall (dispatch tterm)
(rec n (ltm tterm))
(rec n (rtm tterm)))))))
Expand Down Expand Up @@ -479,7 +482,8 @@ of term accordingly"
divide
lamb-eq
lamb-lt
pair)
pair
modulo)
(funcall (dispatch tterm)
(rec n (ltm tterm))
(rec n (rtm tterm))))))))
Expand Down Expand Up @@ -518,7 +522,8 @@ of the list."
divide
lamb-eq
lamb-lt
pair)
pair
modulo)
(funcall (dispatch tterm)
(rec (ltm tterm))
(rec (rtm tterm))))))))
Expand Down Expand Up @@ -572,7 +577,8 @@ listing them"
divide
lamb-eq
lamb-lt
pair)
pair
modulo)
(funcall (dispatch sub-in)
(sub ind term-to-replace (ltm sub-in))
(sub ind term-to-replace (rtm sub-in))))))
Expand Down Expand Up @@ -668,7 +674,8 @@ lambda and app terms are 1-argument"
((or plus
times
minus
divide)
divide
modulo)
(let ((ltm (ltm tterm))
(rtm (rtm tterm)))
(if (and (typep ltm 'bit-choice)
Expand Down

0 comments on commit b1ce8e9

Please sign in to comment.