summaryrefslogtreecommitdiff
path: root/not-quite-lisp/main.scm
diff options
context:
space:
mode:
Diffstat (limited to 'not-quite-lisp/main.scm')
-rw-r--r--not-quite-lisp/main.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/not-quite-lisp/main.scm b/not-quite-lisp/main.scm
new file mode 100644
index 0000000..2d54c54
--- /dev/null
+++ b/not-quite-lisp/main.scm
@@ -0,0 +1,20 @@
+;; -*- compile-command: "guile -L . -e main -s main.scm < input.txt"; -*-
+(use-modules (nql)
+ ((ice-9 rdelim))
+ (ice-9 binary-ports))
+
+
+(define (stdin-to-str)
+ (let loop ((result ""))
+ (let ((line (read-line)))
+ (if (eof-object? line)
+ result
+ (loop (string-append result line "\n"))))))
+
+(define (main args)
+ (let ((result
+ (if (null? (cdr args))
+ (nql (stdin-to-str) #t)
+ (nql (stdin-to-str) #f))))
+ (display result))
+ (newline))