| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
|
|
|
| |
Show all builtins now that we have more space.
|
|
|
|
| |
Get rid of my experiment adding Game of Life to the shell.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It took me _way_ too long to realize that I'm not checking for errors within
the loop, and that will cause it to manifest as an infinite loop as inner
evaluations fail to run.
Debugging notes, for posterity:
printing one row of a chessboard pattern over fake screen (chessboard screen 4 0 0 15) gets stuck in an infinite loop halfway through
debug pattern during infinite loop: VWEX. It's still in the loop but it's not executing the body
raw (fill_rect screen 16 0 20 4 15) works fine
same number of calls to fill_rect work fine
replacing calls to fill_rect with pixel inside chessboard2 works fine
at the point of the infinite loop it's repeatedly going through the hline loop
-- BUT it never executes the check of the loop (< lo hi) with lo=20, hi=20. Something is returning 1, but it's not inside <
stream optimization is not implicated
simple test case with a single loop
(
(globals . (
(foo . (fn () (screen i n)
(while (< i n)
(pixel screen 4 4 i)
(pixel screen 5 4 i)
(pixel screen 6 4 i)
(pixel screen 7 4 i)
(set i (+ i 1)))))
))
(sandbox . (foo screen 0 100))
)
simpler (if you reset cursor position before every print):
(
(globals . (
(foo . (fn () (screen i n)
(while (< i n)
(print screen i)
(set i (+ i 1)))))
))
(sandbox . (foo screen 0 210))
)
I now believe it has nothing to do with the check. The check always works.
Sometimes no body is evaluated. And so the set has no effect.
|
| |
|
|
|
|
|
| |
'def' creates new bindings (only in globals)
'set' only modifies existing bindings (either in env or globals)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Mu computer now has more code in it:
(
(globals . (
(hline1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (hline1 screen y (+ lo 1) hi))))))
(vline1 . (fn () (screen x lo hi) (if (>= lo hi) () ((fn () (pixel screen x lo 12) (vline1 screen x (+ lo 1) hi))))))
(hline . (fn () (screen y) (hline1 screen y 0 (width screen))))
(vline . (fn () (screen y) (vline1 screen y 0 (height screen))))
(andf . (fn (a b)
(if a
(if b
1
())
())))
(brline . (fn (screen x0 y0 x1 y1)
((fn (dx dy sx sy)
((fn (err)
(brline1 screen x0 y0 x1 y1 dx dy sx sy err))
(+ dx dy)))
(abs (- x1 x0))
(- 0 (abs (- y1 y0)))
(sgn (- x1 x0))
(sgn (- y1 y0)))))
(brline1 . (fn (screen x y xmax ymax dx dy sx sy err)
(pixel screen x y 12)
(if (andf (= x xmax) (= y ymax))
()
((fn (e2)
(brline1 screen
(if (>= e2 dy)
(+ x sx)
x)
(if (<= e2 dx)
(+ y sy)
y)
xmax
ymax
dx
dy
sx
sy
(+ err
(+
(if (>= e2 dy)
dy
0)
(if (<= e2 dx)
dx
0)))))
(* err 2)))))
))
(sandbox . (brline screen 1 1 5 5))
)
|
| |
|
|
|
|
| |
Right now we just render the state of the screen at the end of an evaluation.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
But we don't actually support fake keyboards anywhere yet.
|
| |
|
|
|
|
|
| |
- make them more discoverable
- clear them between commands
|
|
|
|
| |
'print' turns out to not be working yet.
|
| |
|
|
|
|
| |
Mu can now compute (factorial 5)
|
| |
|
| |
|
| |
|
|
|
|
| |
Currently stateful, but still good for things.
|
| |
|
| |
|
|
I'm not bothering with full dynamic scope for now.
|