Code: Select all
(context MAIN)
(define (f)
(println "hi there I'm in context " (context)))
(global 'f)
(f)
hi there I'm in context MAIN
(context 'Fred)
(f)
hi there I'm in context MAIN
Code: Select all
(context MAIN)
(define (f)
(println "hi there I'm in context " (context)))
(global 'f)
(f)
hi there I'm in context MAIN
(context 'Fred)
(f)
hi there I'm in context MAIN
Code: Select all
> (define (f) (context))
(lambda () (context))
> (f)
MAIN
> (context 'Fred)
Fred
Fred> (MAIN:f)
MAIN
Fred> _
Code: Select all
> (module "macro.lsp")
MAIN
> (macro (F) (context))
(lambda-macro () (expand '(context)))
> (F)
MAIN
> (context 'Fred)
Fred
Fred> (MAIN:F)
Fred
Fred> (context MAIN)
MAIN
> (global 'F)
F
> (context Fred)
Fred
Fred> (F)
Fred
Fred> _
Code: Select all
(module "macro.lsp")
(macro (my-sys-info)
(let ((meaning (list {Number of Lisp cells}
{Maximum number of Lisp cells constant}
{Number of symbols}
{Evaluation/recursion level}
{Environment stack level}
{Maximum call stack constant}
{Pid of the parent process or 0}
{Pid of running newLISP process}
{Version number as an integer constant}
{Operating system constant}))
(value (sys-info)))
(transpose (list meaning value))))
(global 'my-sys-info)
(constant (global 'sys-info) my-sys-info)
(context 'Fred)
(set 's 3)
(println s)
s
(my-sys-info)
; it works:
(("Number of Lisp cells" 704)
("Maximum number of Lisp cells constant" 268435456)
("Number of symbols" 404)
("Evaluation/recursion level" 3)
("Environment stack level" 0)
("Maximum call stack constant" 2048)
("Pid of the parent process or 0" 0)
("Pid of running newLISP process" 37682)
("Version number as an integer constant" 10208)
("Operating system constant" 131))
(sys-info)
; but this doesn't:
(let ((MAIN:meaning (list "Number of Lisp cells" "Maximum number of Lisp cells constant" ....