make a function like lambda

Started by ssqq, June 16, 2014, 10:50:19 AM

Previous topic - Next topic

ssqq

I want design a function:


(context 'extend-env)
(extend-env:filter 1 2 3) --> (extend-env:filter 1 2 3)


In this context, some primitive function call would not evalute anything.



How to design this function?

rrq

#1
What about:
(define (extend-env:filter) (cons 'extend-env:filter (args))
or, if you don't want its arguments to be evaluated:
(define-macro (extend-env:filter) (cons 'extend-env:filter (args))

ssqq

#2
Thanks ralph.ronnquist!



I want make a extend enviroment (context) to prevent all primitive function to evualte.


(new Class 'extend-env)

(define (create-funcs f)
  (set (eval f) (append (lambda ()) (list (list 'cons f '(args))))))

(setq built-in (difference
                 (filter eval (symbols))
                 '(define context MAIN Class Tree create-funcs)))

(map create-funcs (map quote (map (fn (x) (sym x 'extend-env)) built-in)))

(save "extend-env.lsp" 'extend-env)