Commit Graph

79 Commits

Author SHA1 Message Date
Simon Forman 109cddae12 Readline support would be nice. 2022-10-17 17:51:12 -07:00
Simon Forman 0b4b79f884 Not quite as smooth as I'd hoped. 2022-10-14 20:36:50 -07:00
Simon Forman 6ade65ef0c Subtraction seems to work now. 2022-10-14 17:52:31 -07:00
Simon Forman e7f4a021fe Misc stuff. 2022-10-10 22:28:50 -07:00
Simon Forman 2cf2b56751 Dang it... 2022-10-10 18:39:35 -07:00
Simon Forman cdec813b24 I had to model it in Python
before writing it in OCaml.
2022-09-28 18:21:13 -07:00
Simon Forman c591bf4138 branch, dip, i, loop
The core combinators (except fork).
2022-09-24 20:45:06 -07:00
Simon Forman 92338037e7 Wait for both results together.
If one causes an error before the other is finished SIGKILL the other
job.  (I do not know if this will kill the sub-tasks if any.  The Python
docs say that with terminate() "descendant processes of the process will
not be terminated – they will simply become orphaned." but it doesn't
say whether that's true with kill().
2022-09-22 13:20:30 -07:00
Simon Forman 0904bad81b Capture and fwd exceptions in subforks.
(Should there be only one subtask?  Do the other quote in the main
proc?)
2022-09-22 11:41:16 -07:00
Simon Forman 50293908d9 Let's play with more cores. 2022-09-22 09:13:11 -07:00
Simon Forman d080cd20c7 Let simple joy be joy.
Still to do: clear away the rest of the old cruft.
2022-09-20 11:12:59 -07:00
Simon Forman 2367191918 Remove cruft. 2022-09-20 11:12:28 -07:00
Simon Forman a6ff9857d2 Add trace word back in.
Remove pretty_print module.

Still to do: update Nim implementation with a trace function. ;)
2022-09-20 10:19:45 -07:00
Simon Forman 36a9967e6c Fix typo in hyperlink in README. 2022-09-19 19:43:34 -07:00
Simon Forman fab172daf4 Minor cleanup. 2022-09-19 13:25:09 -07:00
Simon Forman b2a1f40155 Fixed bug in appN
while updating some Jupyter notebooks with the Joypy kernel.
2022-09-16 20:49:46 -07:00
Simon Forman 6b07d7d30b Minor cleanup 2022-09-14 09:46:31 -07:00
Simon Forman aad2da35cf divmod
We don't need floor if we have only ints.

Id is too easy as a definition.

divmod is cool.
2022-09-12 16:38:14 -07:00
Simon Forman 1e3b2f76bb step, times 2022-09-12 16:07:21 -07:00
Simon Forman 8778f12b68 dipd, dipdd, cmp 2022-09-12 15:17:32 -07:00
Simon Forman f640f437f1 cond 2022-09-12 13:50:40 -07:00
Simon Forman a2cabe2189 Bringing over some of the "upgrades". 2 2022-09-11 14:07:55 -07:00
Simon Forman 4bd32f2c0b Bringing over some of the "upgrades". 2022-09-11 13:57:19 -07:00
Simon Forman cb553a1a65 id func 2022-09-11 11:46:10 -07:00
Simon Forman f7315291a9 clearing out cruft 2022-09-11 11:45:46 -07:00
Simon Forman a2cf184301 minor cleanup 2022-09-11 09:33:50 -07:00
Simon Forman 64946dc239 Put definitions in the docstring.
Why not? ¯\_(ツ)_/¯
2022-09-11 09:03:58 -07:00
Simon Forman aea619953d Model expr as stack-of-stacks, minor cleanup. 2022-09-11 08:57:45 -07:00
Simon Forman 16e6c77fa2 Don't bother to return the expression.
We mutate it instead of replacing it with new versions.
2022-09-10 17:42:38 -07:00
Simon Forman 4156da3511 Cleaner iteration of expression.
It's a destructive operation.  It breaks functional purity (but it could
be made functional by using a stack instead of a list for the stack.)

There's no point to returning the expression object now because it's
being mutated by the prepend() method (rather than being replaced by new
forms.)
2022-09-10 17:37:07 -07:00
Simon Forman 15c143e3d1 over
This slipped through the cracks, eh?  Should add a test to joytest.
2022-09-10 17:31:56 -07:00
Simon Forman 1032fc8e76 No point in a separate _parse() function. 2022-09-10 17:22:37 -07:00
Simon Forman 4fbe2ed4a0 Simpler tokenizer.
Once the syntax was simple enough the re.Scanner became overkill.

From
http://norvig.com/lispy.html
by way of
https://github.com/ckkashyap/s2c
2022-09-10 17:08:46 -07:00
Simon Forman 2ad303c247 A bit more docs. 2022-09-09 11:58:35 -07:00
Simon Forman f2791c02c3 Move ParseError to parser section; add a few type guards. 2022-09-08 20:59:12 -07:00
Simon Forman f08db94db1 Minor cleanup. 2022-09-08 14:25:02 -07:00
Simon Forman 359131f7b1 Expression objects.
This should be more efficient than concat().
2022-09-08 11:31:09 -07:00
Simon Forman eecc983b99 blacken 2022-09-08 10:37:46 -07:00
Simon Forman d7f047cee6 move stack code up under interp & minor edits 2022-09-08 09:06:26 -07:00
Simon Forman 20c4b90298 make type checks into Joy functions 2022-09-08 08:46:34 -07:00
Simon Forman ebdb8da03d move type checks and exceptions to bottom 2022-09-08 08:27:47 -07:00
Simon Forman ac326590db minor cleanup 2022-09-07 23:43:50 -07:00
Simon Forman e13a7b9f5c Remove debug session. 2022-09-07 22:23:23 -07:00
Simon Forman 69cb7febf6 That doesn't go there. 2022-09-07 21:15:09 -07:00
Simon Forman 9bb31cbc8a Minor cleanup. 2022-09-07 21:01:07 -07:00
Simon Forman 2c0a0aafcc halt and quit
halt captures the rest of the pending expression and stops evaluating,
but the interpreter loop keeps running.

quit ends the interpreter session and quits the Thun program.
2022-09-07 20:42:48 -07:00
Simon Forman 08f977324f Passes (updated) tests.
https://git.sr.ht/~sforman/joytest
2022-09-07 20:33:13 -07:00
Simon Forman 7594fb887f Harden up the types. 2022-09-07 19:39:00 -07:00
Simon Forman d7b445fdd4 Quiet mode for testing. Misc cleanup. 2022-09-07 17:27:36 -07:00
Simon Forman 660fdb0bef Just put ≡ inline. 2022-09-07 14:46:26 -07:00