Posted By

ikfjwe on 10/14/08


Tagged

identifier


Versions (?)

cons


 / Published in: Scheme
 

cons is not destructive.

  1. (setq alist '(a b c))
  2. ;(a b c)
  3. (cons '1 alist)
  4. ;(1 a b c)
  5. (prin1 alist)
  6. ;(a b c)
  7.  
  8. (setq alist (cons '1 alist))
  9. (prin1 alist)
  10. ;(1 a b c)

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: jcubic on August 25, 2010

This is common lisp code not scheme. Scheme has display function instead prin1 and define instead setq.

You need to login to post a comment.