Thorsten Jolitz <tjol...@gmail.com>
writes:

Hi Alex,

> When I quote the reference:
>
> ,----
> | A single backquote character "`" will cause the reader to evaluate
> | the following expression, and return the result.
> | 
> | : '(a `(+ 1 2 3) z)
> | -> (a 6 z)
> `----
>
> it looks to me as if the difference between PicoLisp and others (like
> Emacs Lisp) must be rather in the 'let than in the read macros, since
> the combination "quote/backquote" in PicoLisp is equivalent to the
> combination "backquote/comma" in other Lisps, and works the same, except
> inside let bindings:
>
> PicoLisp:
>
> ,----
> | $ pil +
> | : (let X (+ 2 3) '(3 4 `X))
> | -> (3 4 NIL)
> | : '(3 4 `(+ 2 3))
> | -> (3 4 5)
> `----
>
> vs Emacs Lisp:
>
> ,----
> | (let ((X (+ 2 3))) `(3 4 ,X))
> | -> (3 4 5)
> | 
> | `(3 4 ,(+ 2 3))
> | -> (3 4 5)
> `----
>
> How would the above behavior inside let bindings be achieved in
> PicoLisp? 

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.

Not only that I have a concrete use case for that behavior right now
(wrt to let and job), I find that very useful in general. 

The only advantage of the current PicoLisp behavior I can see is speed
of reading (because of less assignments in the process), but there
might be others of course. 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 ...
`----

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) )
`----
      
i.e. by using PicoLisp as a kind of smart/dynamic markup language
instead of defining and calling functions like a programmer. Of course
this could easily be done by 'normal' programming, but I'm looking for
something like the above ...       

-- 
cheers,
Thorsten

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

Reply via email to