Skip to content
Permalink
Browse files

Use List.{take,drop}Until from basis

  • Loading branch information...
myreen committed Feb 4, 2019
1 parent 0b669f7 commit e7cd7ceda85d6a30852b189f76fd28ca07f85860
Showing with 3 additions and 13 deletions.
  1. +3 −13 unverified/sexpr-bootstrap/x64/64/extract_code.cml
@@ -13,16 +13,6 @@ val lines =
(TextIO.print_err ("usage: " ^ CommandLine.name() ^ " <filename>\n");
raise Bind);

fun takeUntil p xs =
case xs of
[] => []
| (x::xs) => if p x then [] else x :: takeUntil p xs;

fun dropUntil p xs =
case xs of
[] => []
| (x::xs) => if p x then x::xs else dropUntil p xs;

fun normal_text_line line =
not (String.isPrefix " " line) andalso
not (String.isPrefix "\n" line);
@@ -37,10 +27,10 @@ fun get_code_lines lines =
[] => []
| (line::rest) =>
if String.isPrefix " $" line then
get_code_lines (dropUntil normal_text_line lines)
get_code_lines (List.dropUntil normal_text_line lines)
else if String.isPrefix " " line then
List.map remove_indent (takeUntil normal_text_line lines) @
get_code_lines (dropUntil normal_text_line lines)
List.map remove_indent (List.takeUntil normal_text_line lines) @
get_code_lines (List.dropUntil normal_text_line lines)
else get_code_lines rest;

print (String.concat ["(", "*\n This file has been generated by extract_code.cml.\n*",")\n"]);

0 comments on commit e7cd7ce

Please sign in to comment.
You can’t perform that action at this time.