Hi all,

Sorry to bother all who already saw this posting. However, due to a
misconfiguration on my server not all members received it, and it was
not archived on "www.mail-archive.com".

So this was the message:

################################################################
Hi all,

it is amazing how some simple and obvious ideas pop up so late.

Or not at all.

For example, the new 'script' function (lib.l:146).

As you know, you can put executable code either into a function, or
execute it directly from a source file via 'load'. In both cases a
sequence of expressions is evaluated, and the last value is returned.

The unfortunate thing is that you cannot pass arguments to 'load'. If
the expressions in that file need parameters, you have to put them into
global variables before you call 'load':

   (setq *Str "abc"  *Num 123)
   (load "file.l")


Now, with 'script', you can say

   (script "file.l" "abc" 123)

and the expressions can access these parameters just like in functions
with a variable number of arguments (i.e. with 'args', 'next', 'arg' and
'rest').


This is especially convenient for *.l files in application server URLs.
Now you can pass here the arguments directly

   http://host?file.l&abc&+123

instead of

   http://host?file.l&*Str=abc&*Num=+123

This was possible until now only for functions

   http://[EMAIL PROTECTED]&abc&+123


And it is so simple:

   (de script (File . @)
      (load File) )

Thanks to dynamic binding! :-)
(how to do that with lexical binding?)

Cheers,
- Alex
################################################################
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to