Hi Thorsten,
> Thinking about it it seems that Read Macros are equivalent, but the
> readers work differently:
>
> - PicoLisp :: read without eval, except when encountering a read
> macro
> - Emacs Lisp :: read without eval, except in special situations (local
> assignments, read macros, ???)
>
> So assignments inside 'let are treated special too, like implicit read
> macros, and evaluated during reading.
I don't know much of Emacs Lisp. Can you give examples of how
assignments are treated inside 'let'? Does this mean that the reader
handles 'let' specially?
> Would it be conveivable to have 'evaluating
> versions' of some of the binding environments in PicoLisp too?
>
> ,----
> | let, let?, bind, recur, with, for, job, use ...
> `----
Well, 'bind' is the evaluating version of 'let'. It could be used to
implement the outher functions.
What you probably mean is something different. It is a different way of
interpreting the arguments to a function. It has nothing to do with how
the symbols are bound, and nothing with the reader:
> Here a possible use case:
>
> Imagine these two functions are given:
>
> ,----
> | (de g Txt
> | (glue " " Txt) )
> |
> | (de getCurrTemp (Url) # should retrieve temperature from url
> | 33 )
> `----
>
> than even a non-programmer could specify a dynamic report in PicoLisp
> by writing:
>
> ,----
> | (job
> | CurrTemp (getCurrTemp "/path/to/current/temp/in/berlin")
> |
> | (g Current temperature in Berlin is `CurrTemp °Celsius) )
> `----
Yes, but this will not work (the read macro), because 'getCurrTemp' is
called *after* the whole expression is read and the read macro is
expanded. The point of our whole discussion so far :(
If I understand you right, you want the evaluation of arguments to a
function behave differently. You can define some syntax, but as the
backquote is already taken, the easiest might be to use parentheses:
(de g Args
(mapcar
'((X)
(if (pair X) (val (car X)) X) )
Args ) )
(setq Temp 33)
(g Current temperature in Berlin is (Temp) °Celsius)
-> (Current temperature in Berlin is 33 °Celsius)
♪♫ Alex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe