From e61508e4764d69a4ea0073f419b89ff0a06e813e Mon Sep 17 00:00:00 2001 From: bd Date: Sun, 9 Jun 2024 22:02:45 -0600 Subject: AoC 2015.1 p1+2 --- not-quite-lisp/main.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 not-quite-lisp/main.scm (limited to 'not-quite-lisp/main.scm') 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)) -- cgit v1.2.3