• R/O
  • SSH

Joypy: Commit

Main interpreter and library.


Commit MetaInfo

Revision329fd72341107024e59704112b5001aa2978998d (tree)
Time2019-08-12 11:35:05
AuthorSimon Forman <sforman@hush...>
CommiterSimon Forman

Log Message

The sqrt/1 predicate wasn't working.

Change Summary

Incremental Difference

diff -r 7629cb8c1ad4 -r 329fd7234110 thun/gnu-prolog/Makefile
--- a/thun/gnu-prolog/Makefile Sun Aug 11 18:45:57 2019 -0700
+++ b/thun/gnu-prolog/Makefile Sun Aug 11 19:35:05 2019 -0700
@@ -1,5 +1,6 @@
11 #GPLC_OPTIONS=--min-size
22 GPLC_OPTIONS=--no-top-level
3+#GPLC_OPTIONS=
34
45 thun: thun.pl parser.pl defs.pl main.pl math.pl Makefile
56 gplc $(GPLC_OPTIONS) -o thun thun.pl parser.pl defs.pl main.pl math.pl
diff -r 7629cb8c1ad4 -r 329fd7234110 thun/gnu-prolog/main.pl
--- a/thun/gnu-prolog/main.pl Sun Aug 11 18:45:57 2019 -0700
+++ b/thun/gnu-prolog/main.pl Sun Aug 11 19:35:05 2019 -0700
@@ -20,6 +20,9 @@
2020
2121 */
2222
23+% :- debug.
24+% :- spy(thun).
25+
2326 :- initialization(loop).
2427
2528 loop :- prompt, line(Line), loop(Line, [], _Out).
@@ -32,9 +35,8 @@
3235 line(NextLine), !,
3336 loop(NextLine, S, Out).
3437
35-
3638 do_line(Line, In, Out) :-
37- phrase(joy_parse(E), Line),
39+ phrase(joy_parse(E), Line), !,
3840 thun(E, In, Out).
3941 do_line(_Line, S, S) :- write('Err'), nl.
4042
diff -r 7629cb8c1ad4 -r 329fd7234110 thun/gnu-prolog/thun.pl
--- a/thun/gnu-prolog/thun.pl Sun Aug 11 18:45:57 2019 -0700
+++ b/thun/gnu-prolog/thun.pl Sun Aug 11 19:35:05 2019 -0700
@@ -36,7 +36,7 @@
3636
3737 thun([Unknown|E], Si, So) :-
3838 damned_thing(Unknown),
39- write(`wtf? `),
39+ write(`huh? `),
4040 write(Unknown), nl,
4141 So = [[Unknown|E]|Si].
4242
@@ -82,7 +82,8 @@
8282 func(swap, [A, B|S], [B, A|S]).
8383 func(dup, [A|S], [A, A|S]).
8484 func(pop, [_|S], S ).
85-func(sqrt, [A|S], [sqrt(A)|S]).
85+
86+func(sqrt, [A|S], [B|S]) :- B is sqrt(A).
8687
8788 func(concat, [A, B|S], [C|S]) :- append(B, A, C).
8889 func(flatten, [A|S], [B|S]) :- flatten(A, B).
Show on old repository browser