On Thu, Nov 24, 2016 at 1:24 PM, Alexander Burger <a...@software-lab.de> wrote:
> Hi Dean,
>
>> : (T (== 1 1) T)
>> !? (T (== 1 1) T)
>> T -- Undefined
>> ..
>> i.e. I'm assuming this is a...
>> "A list is evaluated as a function call, with the CAR as the function
>> and the CDR the arguments to that function. These arguments are in turn
>> evaluated according to these three rules."
>> ..situation
>
> Correct.

Hi Alex, I'm not sure that you understood Dean's question.
Or maybe I didn't understand your answer.

What Dean did:
To understand your definition of mmbr, Dean extracted this line:
(T (== 1 1) T)
from the «for». Bad luck, the «for» function is what is called in some lisps
a «special form»: its arguments are not evaluated.
I think that in picoLisp it's called an f-expression.

Another example of a special form is the «if» function.
It doesn't evaluate every argument since it must first know
if the condition is true or false.
The evaluation of the true branch (or the false branch) is delayed
and done «manually».

Some examples in picoLisp:

: (de f (x) x)  # could have been defined with setq or set
-> f
: f
-> ((x) x)
: (f (+ 2 2))
-> 4

: (de f x x)  # could have been defined with setq or set
-> f
: f
-> (x x)
: (f (+ 2 2))
-> ((+ 2 2))  # the list of the args passed to f

: (de f x (caar x))
-> f
: f
-> (x (caar x))
: (f (+ 2 2))
-> +

The «for» function kind of inspects its args to find «clauses»
and treat them specially, not as usual function calls.
That's why brutally extracting them from
the «for» construct doesn't work.

An example of this kind is the «let» construct:

: (let (X "Hello" Y "world") (prinl X " " Y))
Hello world

Here X is not a function but a symbol to which "Hello" is bound.

We could also say that «for» and «let» are f-expr that use
some s-expr as data instead of function calls.

https://en.wikipedia.org/wiki/Fexpr
https://en.wikipedia.org/wiki/Sexpr

Hope this helps.


chri
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to