Hi,

Unfortunately Rick's solution form doesn't work. May be when calling the
function the first thing is a string?
This is what I'm trying:


(de *FuncList ())

(de defun1 F
   (setq *FuncList (cons *FuncList (cons (car F) (caddr F))))
   (def (car F) (cons (cadr F) (cadddr F))) )

(de defun2 P
   (put (car P) 'doc (caddr P))
   (def (car P) (cons (cadr P) (cdddr P))) )

(defun1 hola1 (Str)
   "This is just a test (1)"
   (prinl "Hola " Str) )

(defun2 hola2 (Str)
   "This is just a test (2)"
   (prinl "Hola " Str) )

(prinl "Calling 'hola1'.")
(hola1 "Manuel")

(prinl "Calling 'hola2'.")
(hola2 "Otto")


(prinl "Esto es ... " *FuncList)

And the output (sorry for the spanish):

[manuel@arch ux]$ pil main.l -bye +
Calling 'hola1'.
Calling 'hola2'.
Hola Otto
Esto es ... hola1This is just a test (1)

Alex solution works perfectly, though.
I was failing because in (def (car P) (cons (cadr P) (cdddr P))) ) I didn't
put the first cons. When I try

(de defun3 F
   (setq *FuncList (cons *FuncList (cons (car F) (caddr F))))
   (def (car F) (cadr F) (cadddr F)) )
                         ^ Notice there isn't cons here
I get:

[main.l:29] !? (hola2 "Otto")
hola2 -- Undefined

And, unfortunately, I don't understand why it doesn't works. Why it needs
to be a cons? In the docs it says def will set the symbol to "any", being
"any" the third parameter. In my case, shouldn't be set to the parameter
list?

Thanks!


Manuel.

2015-08-02 16:11 GMT+02:00 Alexander Burger <a...@software-lab.de>:

> Hi Rick,
>
> > Why not just this?
> >
> >    (de thefunc (A B C)
> >
> >       "This is the help text"
> >
> >       (* A B C) )
>
> Yes, perfect :)
>
> ♪♫ Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>



-- 
Manuel

Reply via email to