about summary refs log tree commit diff stats
path: root/shell/evaluate.mu
Commit message (Collapse)AuthorAgeFilesLines
...
* .Kartik K. Agaram2021-05-031-1/+1
|
* move color scheme closer to Solarized darkKartik K. Agaram2021-05-011-35/+35
| | | | | | | | | | | | | sed -i 's,0x12/bg=almost-black,0xdc/bg=green-bg,g' shell/*.mu sed -i 's, 0/bg, 0xc5/bg=blue-bg,g' shell/*.mu sed -i 's, 7/fg=trace, 0x38/fg=trace,g' shell/*.mu sed -i 's, 7/bg=grey, 0x5c/bg=black,g' shell/*.mu Still a few issues. Thanks Adrian Cochrane and Zach DeCook. https://floss.social/@alcinnz/106152068473019933 https://social.librem.one/@zachdecook/106159988837603417
* shell: allow 'def' to overwriteKartik K. Agaram2021-04-291-1/+1
|
* keep the temporary progress screen off the keyboardKartik K. Agaram2021-04-291-1/+1
|
* .Kartik K. Agaram2021-04-281-1/+1
|
* .Kartik K. Agaram2021-04-281-36/+6
|
* shell: stream literalsKartik K. Agaram2021-04-271-0/+9
|
* shell: primitives 'and' and 'or'Kartik K. Agaram2021-04-251-0/+86
|
* failing tests not printing since show-stack-stateKartik K. Agaram2021-04-251-1/+10
|
* .Kartik K. Agaram2021-04-251-2/+2
|
* clean up with the final bugfixKartik K. Agaram2021-04-221-61/+9
|
* snapshotKartik K. Agaram2021-04-221-2/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* shell: non-recursive 'while'Kartik K. Agaram2021-04-211-14/+58
|
* shell: refuse to 'def' duplicate namesKartik K. Agaram2021-04-211-1/+1
|
* shell: separate 'def' from 'set'Kartik K. Agaram2021-04-211-7/+157
| | | | | 'def' creates new bindings (only in globals) 'set' only modifies existing bindings (either in env or globals)
* slightly more responsive animationKartik K. Agaram2021-04-211-1/+1
|
* shell: show screen state during evaluationKartik K. Agaram2021-04-211-15/+39
| | | | | | | | | | | | | | All highly experimental. Current constraints: * No tail recursion elimination * No heap reuse * Keep implementation simple So it's slow, and I don't want to complicate it to speed it up. So I'm investing in affordances to help deal with the slowness. However, in the process I've taken the clean abstraction of a trace ("all you need to do is add to the trace") and bolted on call counts and debug-prints as independent mechanisms.
* an interface approximating stack tracesKartik K. Agaram2021-04-201-24/+23
|
* get bresenham line drawing working with a traceKartik K. Agaram2021-04-201-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (brline . (fn () (screen x0 y0 x1 y1 color) ((fn (dx dy sx sy) ((fn (err) (brline1 screen x0 y0 x1 y1 dx dy sx sy err color)) (+ 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 color) (pixel screen x y color) (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))) color)) (* err 2))))) sandbox: (brline screen 1 1 5 5 12) There are two ideas stemming from this commit: - I need an extremely compact on-screen trace to underlie the trace UX - perhaps we should start truncating trace lines
* deemphasize fn arg evaluation slightlyKartik K. Agaram2021-04-191-0/+2
|
* some primitives for monitoring code integrityKartik K. Agaram2021-04-181-0/+3
|
* shell: ctrl-r runs on real screen without a traceKartik K. Agaram2021-04-171-2/+16
| | | | | We run out of memory fairly early in the course of drawing a chessboard on the whole screen.
* shell: reenable the traceKartik K. Agaram2021-04-171-0/+9
| | | | | | | | | | | | | | We now have a couple of protections: - if we get close to running out of space in the trace we drop in an error - if we run out of space in the trace we stop trying to append - if there are errors we cancel future evaluations This is already much nicer. You can't do much on the Mu computer, but at least it gracefully gives up and shows its limitations. On my computer the Mu shell tries to run computations for about 20s before giving up. That seems at the outer limit of what interactivity supports. If things take too long, test smaller chunks.
* evaluating fns is too similar to its inputKartik K. Agaram2021-04-171-1/+1
| | | | | When I edit disk images directly, it's easy to forget a pair of parens. Then the first expression of the body never executes.
* Bresenham line-drawing now workingKartik K. Agaram2021-04-171-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I can't run tests right now, and the trace is disabled. Still, progress. https://merveilles.town/@akkartik/106081486035689980 Current state of the disk image: ( (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)) )
* loosening a few more buffersKartik K. Agaram2021-04-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)) )
* data.img now has more than one sector of dataKartik K. Agaram2021-04-161-1/+1
|
* first session programming _within_ the Mu computerKartik K. Agaram2021-04-151-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I tried building a function to draw a horizontal line across the screen. Here's what I have in data.txt: ( (globals . ( (horline . (fn () (screen y) (horline_1 screen y 0 (width screen)))) (horline_1 . (fn () (screen y lo hi) (if (>= lo hi) () ((fn () (pixel screen lo y 12) (horline_1 screen y (+ lo 1) hi)))))) )) (sandbox . (horline_1 screen 0 0 20)) ) $ dd if=/dev/zero of=data.img count=20160 $ cat data.txt |dd of=data.img conv=notrunc $ ./translate shell/*.mu && qemu-system-i386 -hda disk.img -hdb data.img Result: I can't call (horline screen 0) over a fake screen of width 40. Some stream overflows somewhere after all the tweaks to various fixed-size buffers scattered throughout the app. Calling horline_1 gets to a 'hi' column of 20, but not to 30.
* shell: full closuresKartik K. Agaram2021-04-101-6/+11
|
* apply doesn't need caller env in lexical scopeKartik K. Agaram2021-04-101-6/+9
|
* shell: none of our primitives need to be closuresKartik K. Agaram2021-04-101-1/+1
|
* .Kartik K. Agaram2021-04-101-2/+2
|
* shell: UI now showing fake keyboardKartik K. Agaram2021-04-101-21/+21
| | | | But we don't actually support fake keyboards anywhere yet.
* shell: move fake screen to sandboxKartik K. Agaram2021-04-101-21/+22
|
* shell: structural equality checkKartik K. Agaram2021-04-091-3/+3
| | | | Mu can now compute (factorial 5)
* shell: ifKartik K. Agaram2021-04-091-0/+41
|
* shell: 'set' for defining globalsKartik K. Agaram2021-04-061-0/+47
| | | | Currently stateful, but still good for things.
* shell: quoteKartik K. Agaram2021-04-061-0/+28
|
* shell: look up globalsKartik K. Agaram2021-04-061-31/+12
|
* shell: extensible array of globalsKartik K. Agaram2021-04-051-74/+22
| | | | I'm not bothering with full dynamic scope for now.
* .Kartik K. Agaram2021-04-051-0/+822