syntax for apply

Started by ghyll, October 29, 2014, 10:26:21 PM

Previous topic - Next topic


This code (shown below) from the "Namespace context switching" section of "">Expression Evaluation in newLISP" does not seem to follow the syntax given in the manual: (apply func list [int-reduce]).

(context 'Foo)
(set 'var 123)
(define (func)
    (println "current context: " (context))
    (println "var: " var))
(context 'MAIN)


(apply 'Foo:func)


current context: Foo

var: 123

Is there an unlisted second syntax for apply? If not, can someone help me to understand how the above example fits (apply func list [int-reduce]) (e.g. is the second parameter also optional)?



Yes, apply with only a function or primitive is a valid syntax when the function or primitive can be used without arguments. Added now to the manual:"> ... html#apply">


That makes perfect sense. Thank you for the reply (and apologies for the delayed response on my part).