Commit Graph

42 Commits

Author SHA1 Message Date
sforman 0e380b7748 Div, mod handle zero. 2023-09-23 21:20:37 -07:00
sforman 20b5f05d29 Elm reformatting and demo HTML page. 2023-09-23 09:37:43 -07:00
sforman 68488cc9d2 Elm version using BigNums.
This went pretty smoothly, I just followed the compiler errors after
substituting Integer for Int in the type definition.

The only tricky thing is that the div and mod functions for Integer
return Maybe Integer rather than just Integer, so I need to wrap those
or something?  (For now I just put in add to get it to compile.)

Oh, and "not equal" is not correct? The compiler didn't complain.
2023-09-02 11:30:18 -07:00
sforman 10c1d6ccde Let's use bignums. 2023-09-02 11:11:42 -07:00
sforman 4f27f3305f Don't use andThen.
It's less clear than spelling it all out.
2023-09-02 09:44:57 -07:00
sforman b65e948cce Chaining with andThen works but is ugly.
It's lees clear to me what's going on, and I wrote it.
2023-09-02 09:38:15 -07:00
sforman ee4c3bc9b6 Thread the dict through the interaction loop.
Like a total newbie I put the call to the interpreter in the view
function instead of the update function!  I thought it was weird having
to specify the HTML twice, but I figured I was just doing it wrong.  I
was, but not in the way I suspected.

In any event, I like how this make it clear that errors can't affect the
dictionary.
2023-08-02 21:19:43 -07:00
sforman 45f00c8f2e Elm README.
And minor edits.
2023-07-31 11:30:12 -07:00
sforman 540bdd97bd Sort out the and/or/... ops. 2023-07-30 15:51:29 -07:00
sforman 1089ab7c24 Error type (not just a string.)
This is mostly for fun, but I bet it comes in handy, eh?

At the very least, it's a nice catalog of the possible errors that the
basic Joy system might encounter.
2023-07-30 14:59:09 -07:00
sforman 850bc3a500 type alias JoyFunction 2023-07-30 14:27:27 -07:00
sforman 64d9bb75a4 Format. 2023-07-30 07:47:26 -07:00
sforman 9963a73322 inscribe, definitions. 2023-07-30 07:45:06 -07:00
sforman 200c390fd5 Initialize dict with defs.
Just sqr for now, but it shows that it works.

I would like to return Results from add_def but it makes using foldl
slightly tricky,  not a lot, just slightly, and my brainpower is low at
the mo'.
2023-07-29 17:10:45 -07:00
sforman edfd7c526f Look up words in the dictionary.
If they are not built-in, which means you can't "shadow" built-ins with
"inscribe", which may or may not turn out to be what we want?
2023-07-29 12:35:47 -07:00
sforman 4acdec71ed Thread the dictionary through the call stack. 2023-07-29 12:30:22 -07:00
sforman 4d6230e01d Empty string is not an unknown word. 2023-07-29 12:11:43 -07:00
sforman 9220361871 Gotta keep a Dict around. 2023-07-29 12:09:08 -07:00
sforman b1d4c3c5b8 Logical ops. 2023-07-29 11:37:07 -07:00
sforman 2c9d5cf4bf Left- and Right-shift. 2023-07-29 11:32:22 -07:00
sforman a69b988684 Comparison ops. 2023-07-29 11:07:50 -07:00
sforman 36dc5b619f loop 2023-07-29 10:44:51 -07:00
sforman 8fb48008cd branch 2023-07-29 10:38:12 -07:00
sforman ed8f8f9edf dip 2023-07-29 10:28:31 -07:00
sforman 9c381f0e8f i 2023-07-29 10:23:06 -07:00
sforman 99a5fd93b1 truthy
I have to check into this: the Python version has "bool" and no
"truthy".
2023-07-29 10:19:39 -07:00
sforman 7c9ea764ea swap 2023-07-29 10:09:40 -07:00
sforman fcdf916013 stack, swaack 2023-07-29 10:00:16 -07:00
sforman c50f2a7541 pop 2023-07-29 09:55:28 -07:00
sforman 4a0fce2492 first, rest 2023-07-29 09:53:00 -07:00
sforman b50be3b64b dup 2023-07-29 09:22:26 -07:00
sforman eb8b282bc2 cons 2023-07-29 09:17:27 -07:00
sforman 70c5223319 clear, concat 2023-07-29 09:06:14 -07:00
sforman af882e2be4 Minor cleanup. 2023-07-29 08:57:58 -07:00
sforman e9f971460f Type alias JList 2023-07-29 08:49:31 -07:00
sforman 9917a2cfba Refactor pop_int.
I don't like passing the stack through isnt_int but that let's you chain
with andThen.

There's probably a clever or idiomatic way to not do that and couple the
stack to the result without passing it through the type checker function
but I don't know what it is right now, and this works.
2023-07-29 07:51:31 -07:00
sforman b6b3acf350 Binary Math Ops 2023-07-29 07:32:56 -07:00
sforman dc065d1943 I don't think andThen helps here? 2023-07-29 07:19:08 -07:00
sforman 48f6e78196 I can add integers! 2023-07-29 06:54:15 -07:00
sforman 5315edbe83 Parsing working.
Modeled on the OCaml code.
2023-07-28 21:51:34 -07:00
sforman 9d57545533 A start on Joy types. 2023-07-28 15:04:35 -07:00
sforman 590a5b207c In Elm. 2023-07-28 14:18:12 -07:00