summary refs log tree commit diff stats
path: root/icons/koch.rc
Commit message (Expand)AuthorAgeFilesLines
* Removes executable bit for text files.Grzegorz Adam Hankiewicz2013-03-161-0/+0
* non-nil AST; continue after errors for IDE supportAraq2011-02-121-0/+0
* version 0.8.10Araq2010-10-211-0/+3
an> ^
64cc026ce ^
1
2
3
4
5
6
 

                         

        
; A simple game engine, based on https://wiki.xxiivv.com/site/parade.html
; Primitives: CREATE, PROGRAM, USE, LOOK
; DATA: the world is a stack.

(= push
    (mac (val lst)
        (list '= lst (list 'cons val lst))))

(= for
    (mac (item lst . body)
        (list 'do
            (list 'let 'for-iter lst)
            (list 'while 'for-iter
                (list 'let item '(car for-iter))
            '(= for-iter (cdr for-iter))
            (cons 'do body)))))

(= create
    (fn (new-obj)
        (push (cons new-obj nil) world)
        world))

(= put
    (fn (to-put pair)
    	(do
            (setcdr pair to-put)
        pair)))

(= program
    (fn (target utility)
        (for x world
            (if (is  (car x) target) (put utility x)
                (not (car x) target) nil))))

(= all-of-creation
    (fn (lst)
        (print ">  Behold, all of creation!")
        (for x lst
           (print "> " x))))

(= look
    (fn (target)
        (for x world
            (if (is  (car x) target) (print ">  looking at" (car x) "reveals" (cdr x)))
                (not (car x) target) nil)))



(let world ())
(create "banana")
(create "kiwi")
(create "apple")
(create "tango")
(program "apple" "bath")
(program "tango" "dance")
(program "kiwi" "shoe")
(program "banana" "peel")

(all-of-creation world)

(print "")

(look "apple")
(look "tango")
(look "kiwi")
(look "banana")