OSDN Git Service
Simon Forman [Tue, 11 Oct 2022 03:32:57 +0000 (20:32 -0700)]
Add two lists of digits.
Simon Forman [Tue, 11 Oct 2022 03:26:59 +0000 (20:26 -0700)]
I think I got it.
Whew! Think slow and steady FTW. Don't get ahead of yourself. Put the
non-recursive parts in the non-recursive branch, duh.
Simon Forman [Tue, 11 Oct 2022 01:39:35 +0000 (18:39 -0700)]
Dang it...
Simon Forman [Fri, 7 Oct 2022 01:11:24 +0000 (18:11 -0700)]
Minor cleanup.
Simon Forman [Thu, 6 Oct 2022 22:36:16 +0000 (15:36 -0700)]
Just for me...
(That's how you look all clever, but it's a dick move removing the
commentary like that.)
Simon Forman [Thu, 6 Oct 2022 22:34:34 +0000 (15:34 -0700)]
Bisect for the win!
Simon Forman [Thu, 6 Oct 2022 22:31:24 +0000 (15:31 -0700)]
find_greatest()
I think it's ready to use...
Simon Forman [Thu, 6 Oct 2022 15:04:54 +0000 (08:04 -0700)]
Finish lil_divmod.
Simon Forman [Wed, 5 Oct 2022 19:31:35 +0000 (12:31 -0700)]
One more lil bug squash.
Subsidiary functions...
Fuzz FTW.
Simon Forman [Wed, 5 Oct 2022 19:21:46 +0000 (12:21 -0700)]
Div Mod of same sign ints.
That seems to be that.
Simon Forman [Wed, 5 Oct 2022 19:19:39 +0000 (12:19 -0700)]
Flush out and squash some bugs.
Simon Forman [Wed, 5 Oct 2022 17:16:47 +0000 (10:16 -0700)]
I think I figured something out...
Simon Forman [Wed, 5 Oct 2022 16:15:41 +0000 (09:15 -0700)]
Kinda sorta not really working,
as in broken.
This is getting out of hand.
Simon Forman [Wed, 5 Oct 2022 15:49:35 +0000 (08:49 -0700)]
Almost got it...
Simon Forman [Wed, 5 Oct 2022 15:27:01 +0000 (08:27 -0700)]
Divmod, yeah?
Simon Forman [Wed, 5 Oct 2022 05:21:58 +0000 (22:21 -0700)]
Minor cleanup.
I almost can't believe I did it. I guess I thought it would be harder
or more involved. Maybe divmod will be a pill?
Kinda relaxing after wasting the weekend nerd-sniped by curses.
Simon Forman [Wed, 5 Oct 2022 05:19:14 +0000 (22:19 -0700)]
Copyright and executable bit
Simon Forman [Wed, 5 Oct 2022 05:18:22 +0000 (22:18 -0700)]
Minor cleanup.
Simon Forman [Wed, 5 Oct 2022 05:06:49 +0000 (22:06 -0700)]
Minor cleanup; multiplication.
I forgot to commit after cleanup but before implementing multiplication
so this commit is kind of a mess.
Anyway, it works. :D
Simon Forman [Tue, 4 Oct 2022 23:41:09 +0000 (16:41 -0700)]
test_Subtraction_large_from_small
Simon Forman [Tue, 4 Oct 2022 23:28:43 +0000 (16:28 -0700)]
I guess subtraction works!?
Simon Forman [Tue, 4 Oct 2022 19:10:32 +0000 (12:10 -0700)]
Adding two negative numbers.
Simon Forman [Tue, 4 Oct 2022 19:05:41 +0000 (12:05 -0700)]
That was easy! Add BigInts of the same sign.
Simon Forman [Tue, 4 Oct 2022 18:37:55 +0000 (11:37 -0700)]
Red... (Green, Refactor)
TDD FTW!
Simon Forman [Tue, 4 Oct 2022 18:31:40 +0000 (11:31 -0700)]
Not using ctypes; test_twice_min
Simon Forman [Tue, 4 Oct 2022 18:21:07 +0000 (11:21 -0700)]
Minor cleanup.
Simon Forman [Tue, 4 Oct 2022 18:20:55 +0000 (11:20 -0700)]
Fix import.
Simon Forman [Tue, 4 Oct 2022 18:20:14 +0000 (11:20 -0700)]
BitInt start; unittest.
Simon Forman [Tue, 4 Oct 2022 15:53:32 +0000 (08:53 -0700)]
That was easy...
but it breaks associativity or is it commutivity?
Anyway you can't add THREE or more things in one expression (yet)
because adding OberonInt objects returns a two-tuple.
I could adjust the semantics of ObInt to accept such two-tuples and do
add_with_carry() but that's probably more trouble than it's worth.
Just gotta be careful with math expressions, eh?
Simon Forman [Tue, 4 Oct 2022 15:49:40 +0000 (08:49 -0700)]
Switch to double-underscore method names.
Worry about type conversions later.
Simon Forman [Tue, 4 Oct 2022 15:47:39 +0000 (08:47 -0700)]
Subtraction.
Simon Forman [Tue, 4 Oct 2022 15:32:04 +0000 (08:32 -0700)]
BigInts in terms of Oberon Ints
Oberon RISC has Two's Complement 32-bit ints with carry.
So far so good.
Simon Forman [Thu, 29 Sep 2022 05:07:28 +0000 (22:07 -0700)]
Minor cleanup.
Simon Forman [Thu, 29 Sep 2022 04:56:53 +0000 (21:56 -0700)]
Minor cleanup.
Functional Programming FTW!
Simon Forman [Thu, 29 Sep 2022 04:22:19 +0000 (21:22 -0700)]
Apparently this is redundant.
Discovered by running `nim doc joy.nim`, compiling doesn't flag it.
Simon Forman [Thu, 29 Sep 2022 01:28:25 +0000 (18:28 -0700)]
Clear out old docs; update defs.txt.
Simon Forman [Thu, 29 Sep 2022 01:21:13 +0000 (18:21 -0700)]
I had to model it in Python
before writing it in OCaml.
Simon Forman [Thu, 29 Sep 2022 01:18:20 +0000 (18:18 -0700)]
Improve compiling of step combinator.
Simon Forman [Thu, 29 Sep 2022 01:16:45 +0000 (18:16 -0700)]
Initial outline for a talk on Joy.
Simon Forman [Sun, 25 Sep 2022 04:19:35 +0000 (21:19 -0700)]
coms, swap
Simon Forman [Sun, 25 Sep 2022 04:00:26 +0000 (21:00 -0700)]
Comparison operations.
Simon Forman [Sun, 25 Sep 2022 03:45:06 +0000 (20:45 -0700)]
branch, dip, i, loop
The core combinators (except fork).
Simon Forman [Sun, 25 Sep 2022 02:39:10 +0000 (19:39 -0700)]
Minor cleanup.
Simon Forman [Sun, 25 Sep 2022 02:33:29 +0000 (19:33 -0700)]
Simple REPL.
Still very crude, and exceptions are not caught, but it works.
Simon Forman [Sat, 24 Sep 2022 21:54:07 +0000 (14:54 -0700)]
Minor cleanup.
Simon Forman [Sat, 24 Sep 2022 21:29:03 +0000 (14:29 -0700)]
concat
Ocaml's match is very powerful, respect, but if I want more precise
error messages (that conform to the joytest suite) then the extra
utility functions must be implemented and employed.
After that it's definition loading and the main REPL loop and I think
that's it, eh?
Simon Forman [Sat, 24 Sep 2022 21:16:44 +0000 (14:16 -0700)]
autoformat
Simon Forman [Sat, 24 Sep 2022 21:16:20 +0000 (14:16 -0700)]
clear
Simon Forman [Sat, 24 Sep 2022 20:13:44 +0000 (13:13 -0700)]
Autoformat.
Simon Forman [Sat, 24 Sep 2022 20:13:03 +0000 (13:13 -0700)]
Evaluation is working.
It's all downhill from here, like in skiing!
Simon Forman [Sat, 24 Sep 2022 19:54:46 +0000 (12:54 -0700)]
Eval symbols...
Simon Forman [Sat, 24 Sep 2022 19:44:20 +0000 (12:44 -0700)]
Working towards interpretation.
Simon Forman [Sat, 24 Sep 2022 19:02:00 +0000 (12:02 -0700)]
Nice and clean.
I wonder what Ocaml programmers would think of this code?
Simon Forman [Sat, 24 Sep 2022 18:00:19 +0000 (11:00 -0700)]
Parser.
Mighty battle.
Simon Forman [Sat, 24 Sep 2022 16:01:16 +0000 (09:01 -0700)]
Order is preserved.
Simon Forman [Sat, 24 Sep 2022 15:59:38 +0000 (08:59 -0700)]
A couple of little comments.
Simon Forman [Sat, 24 Sep 2022 15:54:04 +0000 (08:54 -0700)]
Parse tokens into joy_list.
That seemed a lot harder than it should have been...
Simon Forman [Sat, 24 Sep 2022 02:35:15 +0000 (19:35 -0700)]
A start of parsing tokens.
Simon Forman [Sat, 24 Sep 2022 00:47:31 +0000 (17:47 -0700)]
Formatting.
Simon Forman [Sat, 24 Sep 2022 00:31:16 +0000 (17:31 -0700)]
I think I got the tokenizer right.
Simon Forman [Fri, 23 Sep 2022 15:59:06 +0000 (08:59 -0700)]
So that's mutual recursion in Ocaml?
I like it. Just change "let" to "and" and you're good-to-go.
Simon Forman [Fri, 23 Sep 2022 15:54:37 +0000 (08:54 -0700)]
Ignoring _build.
Simon Forman [Fri, 23 Sep 2022 15:53:39 +0000 (08:53 -0700)]
Ignore _build dirs.
Simon Forman [Fri, 23 Sep 2022 15:38:17 +0000 (08:38 -0700)]
autoformat
Simon Forman [Fri, 23 Sep 2022 15:37:04 +0000 (08:37 -0700)]
Ocaml FTW!
Simon Forman [Fri, 23 Sep 2022 03:43:25 +0000 (20:43 -0700)]
At this point...
...I'm just relearning C semantics. (And they are garbage, as is widely
known.)
I don't think there's much point to this (at the moment) because I don't
want to relearn C (at the moment) and Nim is available (at the moment.)
Really, I'm trying to do away with the entire relationship of C et. al.
to the underlying machine. (For instance, Nim gives you a much nicer
relationship, without the vast distance that, say, Python imposes.) I
should really look at other compiled languages, like Ocaml or Julia.
Simon Forman [Fri, 23 Sep 2022 03:08:24 +0000 (20:08 -0700)]
Create an int and add ints.
Simon Forman [Fri, 23 Sep 2022 02:34:57 +0000 (19:34 -0700)]
Try using GC_register_finalizer?
Simon Forman [Fri, 23 Sep 2022 02:00:40 +0000 (19:00 -0700)]
Maybe this is the right thing to do?
https://stackoverflow.com/questions/
59489221/using-the-gmp-library-with-boehms-garbage-collector
Simon Forman [Fri, 23 Sep 2022 00:26:28 +0000 (17:26 -0700)]
What would a little C Joy look like?
Let's use GMP for ints and Boehm GC.
Simon Forman [Thu, 22 Sep 2022 20:20:30 +0000 (13:20 -0700)]
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().
Simon Forman [Thu, 22 Sep 2022 18:41:16 +0000 (11:41 -0700)]
Capture and fwd exceptions in subforks.
(Should there be only one subtask? Do the other quote in the main
proc?)
Simon Forman [Thu, 22 Sep 2022 16:13:11 +0000 (09:13 -0700)]
Let's play with more cores.
Simon Forman [Wed, 21 Sep 2022 00:56:18 +0000 (17:56 -0700)]
Basic system, incomplete.
Still needs the rest of the core functions and defs.
Could read defs from a file at compile-time?
Integer math? Boolean ops? Just type inference and maybe compiling?
Simon Forman [Wed, 21 Sep 2022 00:14:41 +0000 (17:14 -0700)]
Parse the tokens into a Joy expression.
Simon Forman [Tue, 20 Sep 2022 23:29:35 +0000 (16:29 -0700)]
Parser in GNU Prolog.
Wonky handling of UTF_8 blankspace.
Simon Forman [Tue, 20 Sep 2022 21:22:47 +0000 (14:22 -0700)]
The whole thing is kind of a mess.
Simon Forman [Tue, 20 Sep 2022 18:12:59 +0000 (11:12 -0700)]
Let simple joy be joy.
Still to do: clear away the rest of the old cruft.
Simon Forman [Tue, 20 Sep 2022 18:12:28 +0000 (11:12 -0700)]
Remove cruft.
Simon Forman [Tue, 20 Sep 2022 17:20:58 +0000 (10:20 -0700)]
Minor cleanup.
Simon Forman [Tue, 20 Sep 2022 17:19:45 +0000 (10:19 -0700)]
Add trace word back in.
Remove pretty_print module.
Still to do: update Nim implementation with a trace function. ;)
Simon Forman [Tue, 20 Sep 2022 02:43:34 +0000 (19:43 -0700)]
Fix typo in hyperlink in README.
Simon Forman [Mon, 19 Sep 2022 20:25:09 +0000 (13:25 -0700)]
Minor cleanup.
Simon Forman [Mon, 19 Sep 2022 20:22:31 +0000 (13:22 -0700)]
Add a flowchart for the interpreter.
Using PlantUML.
Simon Forman [Sat, 17 Sep 2022 03:49:46 +0000 (20:49 -0700)]
Fixed bug in appN
while updating some Jupyter notebooks with the Joypy kernel.
Simon Forman [Sat, 17 Sep 2022 00:54:42 +0000 (17:54 -0700)]
Remove old docs.
Simon Forman [Fri, 16 Sep 2022 19:28:13 +0000 (12:28 -0700)]
A bit more docs.
Simon Forman [Fri, 16 Sep 2022 18:27:00 +0000 (11:27 -0700)]
Got back the LI for lower-cased title notebooks.
Not sure what went wrong there.
Simon Forman [Fri, 16 Sep 2022 18:06:30 +0000 (11:06 -0700)]
Whence fun_with_scan and with_sympy?
Simon Forman [Fri, 16 Sep 2022 16:03:42 +0000 (09:03 -0700)]
Cleaning up docs.
Kinda...
Simon Forman [Fri, 16 Sep 2022 14:36:28 +0000 (07:36 -0700)]
The (crude) site.
It's funny that I'm using nbconvert, markdown, pandoc, tidy, and of
course python, all to make a simple static website...
"There's got to be a better way!"
Simon Forman [Fri, 16 Sep 2022 14:35:11 +0000 (07:35 -0700)]
Function Reference
Simon Forman [Fri, 16 Sep 2022 02:17:56 +0000 (19:17 -0700)]
bits and pieces
Simon Forman [Fri, 16 Sep 2022 01:14:01 +0000 (18:14 -0700)]
Rework docs, simpler (no Sphinx.)
Simon Forman [Fri, 16 Sep 2022 01:11:16 +0000 (18:11 -0700)]
delete all the extra notebook conversions
Simon Forman [Thu, 15 Sep 2022 16:34:39 +0000 (09:34 -0700)]
Ignore the Nim joy binary.
Simon Forman [Thu, 15 Sep 2022 04:09:20 +0000 (21:09 -0700)]
Check for minus before converting to int.
BigInts converts "-" to 0. This happens in the parser before you get to
the evaluator.
Simon Forman [Thu, 15 Sep 2022 04:01:50 +0000 (21:01 -0700)]
Minor cleanup, subtraction.
Testing with the joytest test suite revealed that I had forgotten to
implement subtraction. This also unconvered a (maybe) bug in the
BigInts package where it converts "-" to zero.
https://git.sr.ht/~sforman/joytest
https://github.com/nim-lang/bigints/issues/116
Simon Forman [Thu, 15 Sep 2022 03:15:25 +0000 (20:15 -0700)]
Let simplejoy be joy.
Simple pleasures are the best.
Simon Forman [Thu, 15 Sep 2022 03:14:34 +0000 (20:14 -0700)]
Remove old code.