Code generation in Lisp (was Re: Self and Smalltalk)

Laurent Martelli
14 May 1999 21:22:13 +0000

>>>>> "Jecel" == Jecel Assumpcao <> writes:

  Jecel> I am a big LISP/Scheme fan, and the only thing I miss about
  Jecel> LISP is the ability to manipulate code (Scheme doesn't have
  Jecel> that either, if I remember correctly). You can *generate*
  Jecel> code in Self/Smalltalk if you are willing to work at the
  Jecel> source text level and I have been pleasently surprised at how
  Jecel> well this works in practice. Of course, it might be that none
  Jecel> of this will be needed for Arrows.

In managed to do this in emacs-lisp :

	(defun defun-plus (funcname)
	  (eval (list 'defun (symbol-concat (symbol-name funcname)) 
		      '(a b) '(+ a b))))

	(defun-plus 'foo)
	(foo 1 2)	
	=> 3

Is this what you call "generating code" ?

Laurent Martelli