shithub: martian9

Download patch

ref: 02e52de48838943242250b85d2bf23c97755111f
parent: 02b360fe6c10ef6ec280c44a7935df743e68e0de
author: smazga <smazga@greymanlabs.com>
date: Mon Aug 24 18:55:20 EDT 2020

too delirious to do anything more tonight

--- a/macro.ml
+++ b/macro.ml
@@ -30,17 +30,29 @@
          | hd :: tl ->
            print_endline ("__ hd: " ^ Printer.print hd true);
            print_endline ("__ arg length: " ^ string_of_int (List.length args));
+           print_endline ("__ args: " ^ Printer.dump args);
            (match hd with
            | T.List
-               { T.value = [ T.List { T.value = pattern }; T.List { T.value = body } ] }
+               { T.value = [ T.List { T.value = pattern }; T.List { T.value = template } ] }
              ->
              print_endline (" _ pattern: " ^ Printer.dump pattern);
              print_endline
                ("__ pattern length: "
                ^ string_of_int (List.length pattern)
-               ^ "   body: "
-               ^ Printer.dump body)
+               ^ "   template: "
+               ^ Printer.dump template)
            | T.List { T.value = [ T.List { T.value = pattern }; atom ] } ->
+              let rec wrangle p a pp =
+                (match (p, a) with
+                 | sh :: st, ph :: pt ->
+                    print_endline (">>>>>  sh:" ^ (Printer.print sh true) ^ " ph:" ^ (Printer.print ph true)); wrangle st pt pp
+                 | sh :: st, [] ->
+                    print_endline (">>>>>  sh:" ^ (Printer.print sh true));
+                    let ss = Printer.print sh true in
+                    let x = if ss = "_" then sym else (if List.mem sh (Core.seq literals) then sh else (T.String "")) in
+                    wrangle st args []
+                 | _, _ -> "<end>") in
+              print_endline ("wrangle: " ^ wrangle pattern (Core.seq args) []);
              print_endline (" _ pattern: " ^ Printer.dump pattern);
              print_endline
                ("__ atomic pattern length: "