From a8f1a5ea129dcfc4ea2617d5de0daed02fef1905 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 30 Nov 2024 16:11:08 -0800 Subject: [PATCH] 2015/01: Initial commit --- 2015/day-01/main.fs | 54 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 2015/day-01/main.fs diff --git a/2015/day-01/main.fs b/2015/day-01/main.fs new file mode 100644 index 0000000..1c9aa90 --- /dev/null +++ b/2015/day-01/main.fs @@ -0,0 +1,54 @@ +: parse-instructions ( ulen addr -- ) + 0 >r + 0 u+do + c@+ + dup 40 = if + r> r> r> + 1 + + >r >r >r + then + 41 = if + r> r> r> + 1 - + >r >r >r + then + loop + r> ; + +s" (())" +parse-instructions +." return: " . cr drop + +s" ()()" +parse-instructions +." return: " . cr drop + +s" (((" +parse-instructions +." return: " . cr drop + +s" (()(()(" +parse-instructions +." return: " . cr drop + +s" ))(((((" +parse-instructions +." return: " . cr drop + +s" ())" +parse-instructions +." return: " . cr drop + +s" ))(" +parse-instructions +." return: " . cr drop + +s" )))" +parse-instructions +." return: " . cr drop + +s" )())())" +parse-instructions +." return: " . cr drop + +bye