Now, we are reaching something more concrete, in this series of simple Lali[0] snippets.
Here are two distinct functions, 'geq' and 'leq'. The 'geq' name stands for "greater-or-equal", and the 'leq' name stands for "lesser-or-equal".
Here are the functions. They are very much-alike.
(defun geq (digit digit-to lst)
(fill
((and (has digit lst) (has digit-to lst)) 'n)
((has digit (on digit-to lst)) 'f)
('f 't)))
(defun leq (digit digit-to lst)
(fill
((and (has digit lst) (has digit-to lst)) 'n)
((has digit (in digit-to lst)) 'f)
('f 't)))
These functions compares DIGIT element of list LST, to the DIGIT-TO element of list LST.
With 'geq' if DIGIT is placed after DIGIT-TO, within the order of the elements of list LST; or DIGIT is the same as DIGIT-TO, it returns 't'. If DIGIT is placed before DIGIT-TO, 'geq' returns 'f'. Otherwise, 'geq' function returns 'n'.
'leq' follows the same logic as 'geq', with the result being the lesser-or-equal logic.
Here are some examples, at Lali REPL:
lali> (set 'numerals '(+0 +1 +2 +3 +4 +5 +6 +7 +8 +9))
(+0 +1 +2 +3 +4 +5 +6 +7 +8 +9)
lali> (geq () +3 numerals)
n
lali> (geq 'a +3 numerals)
n
lali> (geq +2 +3 numerals)
f
lali> (geq +3 +3 numerals)
t
lali> (geq +4 +3 numerals)
t
lali> (geq 'a +3 numerals)
n
lali> (leq () +3 numerals)
n
lali> (leq 'a +3 numerals)
n
lali> (leq +2 +3 numerals)
t
lali> (leq +3 +3 numerals)
t
lali> (leq +4 +3 numerals)
f
lali> (leq +4 'a numerals)
n
From scratch, without computers needing to have the notion of what a number is, and without the computer knowing about arithmetic, in this Lali Lambda series so far, I have achieved a way to know if a single digit is, or greater, or lower, or equal, than other single digit.
[0] git clone http://tilde.club/~keyboardan/git/lali.git
tags: #lali #lalilambda #lambda #geq #leq
keyboardan
gopher://tilde.club/1/~keyboardan/
http://tilde.club/~keyboardan/