Toy for rubyists

Started by Jeff, April 16, 2007, 06:18:13 PM

Previous topic - Next topic

Jeff

(define-macro (each object iter)
  (set 'iter (trim (string iter) "|"))
  (dolist (obj (eval object))
          (eval (set (sym (eval iter)) obj))
          (catch (doargs (a)
                 (if (= a 'end) (throw nil) (eval a))))))

(each '(ruby is not a lisp) |item|
  (println item)
end)
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code

rickyboy

#1
Quote from: "Jeff"(define-macro (each object iter)
  (set 'iter (trim (string iter) "|"))
  (dolist (obj (eval object))
          (eval (set (sym (eval iter)) obj))
          (catch (doargs (a)
                 (if (= a 'end) (throw nil) (eval a))))))

(each '(ruby is not a lisp) |item|
  (println item)
end)


What do you need end for?


(define-macro (each object iter)
  (set 'iter (trim (string iter) "|"))
  (dolist (obj (eval object))
    (eval (set (sym (eval iter)) obj))
    (doargs (a) (eval a))))

(each '(ruby is not a lisp) |item|
  (println item))
(λx. x x) (λx. x x)

Jeff

#2
I don't know. What does ruby need end for?
Jeff

=====

Old programmers don\'t die. They just parse on...



http://artfulcode.net\">Artful code