This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
(define (test3 condition)
(println "test3")
(dolist-while (x '(a b c d e f) condition) (println x)))
(define (test4 cnd)
(println "test4")
(dolist-while (x '(a b c d e f) cnd) (println x)))
(test3 nil)
(test4 nil)
(define-macro (ant)
(let ((x 3))
(println "(args 0)=" (args 0) " x=" x " (eval(args 0))=" (eval(args 0)))))
(define (foo y)
(ant y))
(define (bar x)
(ant x))
(foo 7)
(bar 7)
(define-macro (dolist-while)
(letex (var (args 0 0)
lst (args 0 1)
cnd (args 0 2)
body (cons 'begin (1 (args))))
(let (res)
(catch (dolist (var lst)
(if (set 'res cnd) body (throw res)))))))
(define (test1 a-list)
(dolist-while (x a-list (!= x 'd)) (println x)))
(define (test2 lst)
(dolist-while (x lst (!= x 'd)) (println x)))
(test1 '(a b c d e f))
(test2 '(a b c d e f))
newLISP v.10.3.3 on OSX IPv4/6 UTF-8, execute 'newlisp -h' for more info.
>
(lambda-macro ()
(letex (var (args 0 0) lst (args 0 1) cnd (args 0 2) body (cons 'begin (1 (args))))
(let (res)
(catch
(dolist (var lst)
(if (set 'res cnd)
body
(throw res)))))))
(lambda (a-list) (dolist-while (x a-list (!= x 'd)) (println x)))
(lambda (lst) (dolist-while (x lst (!= x 'd)) (println x)))
a
b
c
nil
ERR: list expected in function dolist : lst
called from user defined function dolist-while
called from user defined function test2
>
(define (set-pixel x y r g b)
(let (i (* (+ x (* y WIDTH)) 3))
(cpymem (pack "bbb" r g b) (+ (address rgb-buf) i) 3)))