diff options
author | bd <bdunahu@operationnull.com> | 2024-06-09 22:02:45 -0600 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2024-06-09 22:02:45 -0600 |
commit | e61508e4764d69a4ea0073f419b89ff0a06e813e (patch) | |
tree | b2f49eeced70c552c73e4030c87406f47a0a8f5e /not-quite-lisp/main.scm | |
parent | aec326408dd6ad16347b5661112895e60335893a (diff) |
AoC 2015.1 p1+2
Diffstat (limited to 'not-quite-lisp/main.scm')
-rw-r--r-- | not-quite-lisp/main.scm | 20 |
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)) |