Refactor the example sources so we can begin unit tests on them.
Chris Pressey
1 year, 8 months ago
138 | 138 |
* `map`
|
139 | 139 |
* `fold`
|
140 | 140 |
* `error`
|
|
141 |
* `assert`
|
141 | 142 |
* Figure out a way to have "implicit prelude" vs "no implicit prelude"
|
142 | 143 |
* Debug per component of implementation (scanner, parser, evaluator, modules)
|
143 | 144 |
* Interned strings and modules? Hash-consing, even?
|
144 | 145 |
* 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..."
|
0 | 0 |
; Cosmos Boulders -- semantics of a video game given by pure functions ("reducers").
|
1 | 1 |
|
|
2 |
(define module "cosmos-boulders")
|
|
3 |
|
2 | 4 |
(import-from "maps" (new-map set get update))
|
|
5 |
|
|
6 |
|
|
7 |
(define make-action (lambda (type)
|
|
8 |
(set "type" type (new-map))))
|
3 | 9 |
|
4 | 10 |
|
5 | 11 |
; --[ 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)))
|