Advertisement
kosh

Is it a FOOP peculiarity?

Jul 1st, 2014
1,074
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!newlisp
  2.  
  3. ;; Is it a FOOP peculiarity?
  4. ;; http://www.newlispfanclub.alh.net/forum/viewtopic.php?t=4557&p=22467
  5.  
  6. (new Class 'One)
  7. (new One 'Two)
  8.  
  9. (context One)
  10.  
  11. (define (put v)
  12.   (setf (self 1) v))
  13.  
  14. (context Two)
  15.  
  16. (define (Two:Two one x)
  17.   (:put one x)
  18.   (list (context) one x))
  19.  
  20. (context MAIN)
  21.  
  22. (setf uno:uno (One "A"))
  23. (println "Before: " uno:uno)    ;-> Before: (One "A")
  24. (setf duo:duo (Two uno "B"))
  25. (println "After:  " uno:uno)    ;-> After:  (One "B")
  26.  
  27. (println duo " of " duo:duo)    ;-> duo of (Two uno "B")
  28. (println (Two (One "X") "Y"))   ;-> (Two (One "Y") "Y")
  29.  
  30. (exit)
Advertisement
RAW Paste Data Copied
Advertisement