Arc Forumnew | comments | leaders | submitlogin
1 point by zhtw 5516 days ago | link | parent

Is it possible to write definitions like (def f ('a b) <body>) and what would be the meaning?


1 point by diiq 5516 days ago | link

Yes --- that's the best part! For instance, the example aif I gave uses a mixed quoted/unquoted lambda list.

For an example of the exact form you gave:

    (def f ('a b) (print a) (print b))
    (f (list 1 2) (list 3 4))
Outputs:

    (list 1 2) 
    (3 4)
Any combination of quoted and unquoted arguments is valid. Those that are quoted act like macro arguments, and those that are unquoted act like functional arguments.

-----