Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

newLISP the true champion of homoiconicity

Name: Anonymous 2012-11-10 10:11

Can your Lisp do this, /prog/?

(define (plus-minus a b)
  (begin
    (setf (nth '(1 2 0) plus-minus) (if (= (nth '(1 2 0) plus-minus) -) + -))
    (+ a b)))

(plus-minus 10 2)
8
(plus-minus 10 2)
12


newLISP treats code literally as data unlike Common Lisp or Scheme.

Name: Anonymous 2012-11-10 20:57

http://cl-cookbook.sourceforge.net/macros.html
(defmacro setq2 (v1 v2 e)
   (let ((e1 (comtran e)))
      (list 'progn (list 'setq v1 e1) (list 'setq v2 e1))))

(defun comtran (exp) ...) ;; Right!


Wait, what the fuck?  Macro setq2 just uses procedure comtran without any issues?  But comtran isn't even defined yet!  What if someone does something evil/stupid like (let ((comtran evil-procedure)) (setq2 x y z))?  What if comtran has an instance of setq2 in it?  Is it just me, or macroexpansion-time stuff should live in its own namespace?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List