User Tools

Site Tools


ch2_3_manage

This is an old revision of the document!


Higher order management functions

Here we will list functions that serve for higher order of the language management, in other words functions that expand LISP by acting on the language itself, in some sense.

FUNCALL and APPLY

(funcall #'foo a b c)
(apply #'foo '(a b c))

MACROEXPAND and MACROEXPAND-1

At the moment both functions just expand first level of macro expression, so both behave as MACROEXPAND-1 They expect one argument, which can be anything, but it only makes sense to use then on quoted expression which has a macro call in the functor position.

>(defmacro add (a b) `(+ ,a ,b))       ; defined simple macro
ADD
 
>(macroexpand '(add 1 2))              ; quoted expression with the macro
(+ 1 2)                                ; this is the expansion
 
>(defmacro adder (c d) `(add ,c ,d))   ; define new macro which uses the previous
ADDER
 
>(macroexpand-1 '(adder 3 4))          ; expands only the first level
(ADD 3 4)
 
>(macroexpand '(adder 3 4))            ; this should also expand the ADD macro
(ADD 3 4)                              ; but in the present version it is not done

NAME-PROCESS KILL

these are unique LabLISP multi-process functions

ch2_3_manage.1618992002.txt.gz · Last modified: 2021/04/21 02:00 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki