Commit Graph

8620 Commits

Author SHA1 Message Date
Kartik K. Agaram
70919b45f0 .
Rename cells containing screens to screen vars because of the ambiguity
that each grapheme in fake screens is represented by a type screen-cell.
While we're at it, we also analogously rename keyboard vars.
2021-06-12 15:16:50 -07:00
Kartik K. Agaram
4bd1785c86 shell: larger fake screen 2021-06-12 10:46:28 -07:00
Kartik Agaram
662e6b7177 . 2021-06-11 23:02:12 -07:00
Kartik K. Agaram
d4968adbc9 . 2021-06-11 23:00:00 -07:00
Kartik K. Agaram
af2e837787 try to abolish NULL from primitives 2021-06-11 22:48:14 -07:00
Kartik K. Agaram
952fb9a677 car/cdr of nil is now nil 2021-06-11 21:46:59 -07:00
Kartik K. Agaram
0dc4f9c62b hacky bugfix: support floats in nth
Needed because we don't yet have a primitive in the shell to truncate/round
non-integers to integers.

Before:
  (nth (/ 31 10)    # we don't have float literals yet
       '(1 2 3 4))
  => NULL

..with an unpleasant abort likely later on.

Really the correct thing to do is ensure none of my primitives ever returns
NULL. Start with car/cdr.
2021-06-11 21:36:12 -07:00
Kartik K. Agaram
3191861242 better name 2021-06-11 20:11:16 -07:00
Kartik K. Agaram
ef29fcdc91 cancel pending test
After all that, I'm not sure this is the desired behavior. If a function
defines multiple bindings, we shouldn't rename all their keys. So how to
choose?

Perhaps it's not so bad to have "symlinks" in this "file system". To unlink
two bindings you now need to define one of them in the sandbox.

All the refactoring is still useful, though.
2021-06-11 19:33:08 -07:00
Kartik K. Agaram
cbf3de0f08 back to the pending test
I'm ready again to take on commit 6169ec59c after lots of refactoring.
2021-06-11 19:26:20 -07:00
Kartik K. Agaram
040b60bc6e .
Save a single trace to potentially multiple globals just like a gap buffer
(if say we have a single let binding defining multiple functions).

I don't have a strong use for this yet, but it seems cleaner. Maybe it's
redundant or wrong.
2021-06-11 19:17:08 -07:00
Kartik K. Agaram
6f64f5d3b6 . 2021-06-11 18:20:47 -07:00
Kartik K. Agaram
8257825468 . 2021-06-11 18:20:30 -07:00
Kartik K. Agaram
c1e5ddfa54 . 2021-06-11 18:20:25 -07:00
Kartik K. Agaram
18c8e8c82f . 2021-06-11 17:54:04 -07:00
Kartik K. Agaram
4de136fb85 . 2021-06-11 17:50:34 -07:00
Kartik K. Agaram
177fa96a93 . 2021-06-11 17:48:12 -07:00
Kartik K. Agaram
c6e3bce981 . 2021-06-11 17:37:28 -07:00
Kartik K. Agaram
14f00ab369 . 2021-06-11 17:34:45 -07:00
Kartik K. Agaram
6cc2cd6cb5 . 2021-06-11 17:32:22 -07:00
Kartik K. Agaram
d5ae556a0c . 2021-06-11 17:31:29 -07:00
Kartik K. Agaram
9487b2dde7 . 2021-06-11 17:19:48 -07:00
Kartik K. Agaram
f8c5b63cb9 . 2021-06-11 17:17:13 -07:00
Kartik K. Agaram
c29a10ac37 .
Inline a function by patching a few variable names. I don't even have to
worry about `return` statements if there's a single call and it's in tail
position in the caller.
2021-06-11 15:37:03 -07:00
Kartik K. Agaram
cc679f4234 . 2021-06-11 15:34:02 -07:00
Kartik K. Agaram
995ff89c8e start showing parse errors under definitions
We don't have support for browsing them yet. Just errors for now, which
should only be a line or two. Larger traces might be useful for inspecting
results of macroexpansion.
2021-06-11 11:32:27 -07:00
Kartik K. Agaram
0b055331bc . 2021-06-11 11:24:49 -07:00
Kartik K. Agaram
f6808302e5 . 2021-06-11 11:16:26 -07:00
Kartik K. Agaram
3e32a1b808 . 2021-06-09 21:52:07 -07:00
Kartik K. Agaram
eb8260b227 . 2021-06-09 21:38:30 -07:00
Kartik K. Agaram
a2d4e41583 . 2021-06-09 21:28:45 -07:00
Kartik K. Agaram
117229ae17 . 2021-06-09 21:21:47 -07:00
Kartik K. Agaram
be9fa3780a .
Add argument to a few functions.
2021-06-09 21:05:29 -07:00
Kartik K. Agaram
0aed24e222 . 2021-06-09 20:50:19 -07:00
Kartik K. Agaram
6169ec59c0 make tests pass again
I'm temporarily disabling the pending state. I'm also providing a clearer
error message when we encounter the bug.
2021-06-09 16:05:09 -07:00
Kartik K. Agaram
b7e8c2810a snapshot: attempt at modifying a function name
It turns out there's another problem, and it predates the ability to create
new definitions:

  ctrl-s triggers a call to `evaluate`, which inserts a new definition
  into globals. which has a null gap buffer.

All this happens long before the new code in this commit, resulting in a
null gap buffer by the time we get to word-at-cursor.

Which in turn happens because we perform a raw `evaluate`, which doesn't
update the gap buffer like `run` does (using `maybe-stash-gap-buffer-to-global`).

And arguably `evaluate` shouldn't mess with the gap buffer. Gap buffers
are a UI concern.

The hardest version of this immediate scenario: It's unclear how to guarantee
that every definition have a gap buffer, when two definitions may share
one (closures sharing a lexical environment).

New plan:
  - improve the logic for detecting definitions. Looking at the outermost
    layer isn't enough. And a single expression can create multiple definitions.
  - extract a helper to attach a single gap buffer to multiple definitions.
  - have the UI detect conflicts in gap buffers and prompt the user for
    a decision if a different gap buffer already exists for a definition.
2021-06-09 09:16:52 -07:00
Kartik K. Agaram
8cff44fef4 . 2021-06-08 21:45:10 -07:00
Kartik K. Agaram
d0d8fc7b04 . 2021-06-08 21:25:58 -07:00
Kartik K. Agaram
206493b5e1 . 2021-06-08 21:09:05 -07:00
Kartik K. Agaram
139620e3d2 shell: function modal now also creates functions 2021-06-08 20:47:07 -07:00
Kartik K. Agaram
e375f0104c shell: expand set of possible errors
Requires a change to mu.subx, to unify literal strings with generic
  (addr array _)
2021-06-08 20:21:39 -07:00
Kartik K. Agaram
d2f2ac59b6 . 2021-06-08 19:33:51 -07:00
Kartik K. Agaram
0b56336ba8 a place for error messages in the function modal
Probably not ideal, but it's a start.
2021-06-08 19:28:34 -07:00
Kartik K. Agaram
de013be794 ok, function modal now has full coverage 2021-06-08 18:09:17 -07:00
Kartik K. Agaram
25803914b3 . 2021-06-08 17:01:56 -07:00
Kartik K. Agaram
9b13d8858a first test for function modal 2021-06-08 16:47:23 -07:00
Kartik K. Agaram
1150170da0 . 2021-06-08 16:31:20 -07:00
Kartik K. Agaram
67aeff8934 .
I wrote a comment about how some code was not covered by tests, and then
promptly forgot what it was for. This is why we need tests.

Now the hack is gone.
2021-06-08 15:06:08 -07:00
Kartik K. Agaram
a7008328cb stop printing more than one '.' per assertion
Screen real-estate is precious on the boot screen since we have no scrolling.
2021-06-08 12:03:39 -07:00
Kartik K. Agaram
227d18f8a2 shell: first test for entire environment
This introduces some ergonomic issues. But we have to start somewhere.
2021-06-08 11:57:03 -07:00