git @ Cat's Eye Technologies Decoy / f82fcb6
Refactor the example sources so we can begin unit tests on them. Chris Pressey 1 year, 8 months ago
3 changed file(s) with 26 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
138138 * `map`
139139 * `fold`
140140 * `error`
141 * `assert`
141142 * Figure out a way to have "implicit prelude" vs "no implicit prelude"
142143 * Debug per component of implementation (scanner, parser, evaluator, modules)
143144 * Interned strings and modules? Hash-consing, even?
144145 * Test that circular imports don't loop
145 * Module
146 * Test that import diamonds are OK
147 * Module path should be like LUA_PATH with the patterns
148 * Abstract maps.
149 * Abstract modules? (Interfaces.)
150 * Implementation modules: they carry with them the implementation of the module
151 in some other language.
152 * Tracebacks, or at least line/column, or at least "in function..."
00 ; Cosmos Boulders -- semantics of a video game given by pure functions ("reducers").
11
2 (define module "cosmos-boulders")
3
24 (import-from "maps" (new-map set get update))
5
6
7 (define make-action (lambda (type)
8 (set "type" type (new-map))))
39
410
511 ; --[ Player objects ]--------------------------------------------------------
0 ;(import-from "maps" (new-map set get update))
1
2 (import-from "cosmos-boulders" (
3 make-action
4 make-player update-player
5 make-missile update-missile
6 ))
7
8 (make-player)
9 (make-missile 200 100 3 5)
10 ;(update-missile (make-missile 200 100 3 5) (make-action "EXPLODE"))
11 ;(update-missile (make-missile 200 100 3 5) (set "action" "STEP" (new-map)))