shithub: martian9

Download patch

ref: 7bcded464070dc7573edcdaa2c6f451d3f20b78d
parent: 8493d9a4b6c4ce926637287bbc437d8bb2ca2baa
author: McKay Marston <[email protected]>
date: Thu Sep 17 06:40:06 EDT 2020

further macro work

--- a/macro.ml
+++ b/macro.ml
@@ -86,21 +86,27 @@
 let lambdaize pattern template args =
   match pattern, args with
   | ph :: pt, ah :: at :: rest ->
-    print_endline ("lambdaize: list list: args: " ^ Printer.stringify args true);
-    Reader.read ("((lambda " ^ ellipsis pt template args ^ Printer.stringify args false ^ ")")
+     let expr = "((lambda " ^ ellipsis pt template args ^ Printer.stringify args false ^ ")" in
+     print_endline ("  lambdaize list list: " ^ expr);
+     Reader.read expr
   | ph :: pt, ah :: at ->
-    print_endline "lambdaize: list short";
-    Reader.read
-      ("((lambda ("
+     let expr = "((lambda ("
       ^ Printer.stringify pt true
       ^ ")"
       ^ Printer.print template true
       ^ ")"
       ^ Printer.stringify args true
-      ^ ")")
+      ^ ")" in
+     print_endline ("  lambdaize short list: " ^ expr);
+    Reader.read expr
   | ph :: pt, [] ->
-    print_endline "lambdaize: list empty";
-    Reader.read ("((lambda (" ^ Printer.stringify pt false ^ ") " ^ Printer.print template true ^ "))")
+     let expr = "((lambda ("
+      ^ Printer.stringify pt false
+      ^ ") "
+      ^ Printer.print template true
+      ^ "))" in
+     print_endline ("  lambdaize empty list: " ^ expr);
+    Reader.read expr
   | _ ->
     print_endline "lambdaize: empty";
     Reader.read ("((lambda () " ^ Printer.print template true ^ "))")
--- a/reader.ml
+++ b/reader.ml
@@ -102,6 +102,7 @@
     | _ -> read_form tokens)
 
 and read_form all_tokens =
+  print_endline ("READ_FORM: " ^ String.concat " " all_tokens);
   match all_tokens with
   | [] -> raise End_of_file
   | token :: tokens ->