keyword parameters
Posted: Fri Nov 18, 2005 10:12 pm
I experiment with keyword arguments. Like :key in common lisp.
so:
This makes possible constructs like:
(I reproduce some lisp example)
But can the syntax be more clear?
Something like:
Code: Select all
(define-macro (keyfun _fn)
(eval (append '(let) (list _args) _fn)))
(define (add-two)
(let (_args (args))
(keyfun
(println (+ first-val second-val)))))
Code: Select all
newLISP v.8.7.0 on linux, execute 'newlisp -h' for more info.
> (add-two 'first-val 1 'second-val 2)
3
Code: Select all
(send-email
'from "me@here"
'to "you@there"
'body (format-message....))
But can the syntax be more clear?
Something like:
Code: Select all
(define (add-two)
(keyfun body))
or even:
(define-keyfun (fun-name) (fun-body))