How to store a function in a variable in Lisp and use it
问题 I want to store a function like print in a variable so that I can just type something short like p , e.g: In Scheme : (define print display) (print "Hello world\n") ;; alternate way (define print 'display) ((eval print) "Hello world\n") The same approach does not seem to work in Common Lisp : (defvar p 'print) ;;(print (type-of p)) (p "Hello world") ;; Attempt 1 ((eval p) "Hello world") ;; >> Attempt 2 ((eval (environment) p) "Hello world") ;; Attempt 3 I'm getting this error with Attempt 1