Posted by: leppie | September 1, 2007

DLR changes demystified & macro’s update

The output of IronLisp is now looking similar to IronPython’s. That said, IronLisp runs the benchmark at roughly the same time as IronPython now. :(

On the bright side, I seem to have gotten macro’s waxed. On the other hand, the code is in a total state of chaos! Anyways, macro’s are now all handled at compile time (probably very inefficiently), but they seem to do what I intend for them to do. :) Here is a sample of what it can handle:

(= defmacro (macro (name args &rest body) 
  `(= ,name (macro ,args ,@body))))  

(defmacro defun (name args &rest body) 
  `(= ,name (fn ,args ,@body)))
  
(defun hello (x)
  (prl x)
  (prl "hello")
  (prl x))  

(hello "leppie")

(defmacro define (name value)
  `(= ,name ,value))
  
(defmacro listp (l) 
  `(or (eq null ,l) (is cons ,l)))

(defun islist (x)
   (listp x))
   
(prl (islist 1))

(define ml '(1 2 3 4))
(prl (listp ml))
About these ads

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: