Yeah, I'm not using any libraries. Hardest part, typically, is parsing the input in. Mainly because I don't know how. Found some fun dangerous ways that work for me
I actually really like it, oddly enough.
I've also been solving them in Ada. It's not as convenient as just read, but if you instantiate an IO package for a type you can do the same kind of thing. So I made an enumeration and an IO package:
type Command is (Forward, Up, Down);
package Direction_IO is new Enumeration_IO(Direction);
use Direction_IO;
Then reading each line was just: C: Command;
D: Integer;
Get(File, C);
Get(File, D);
Other than the setup (3 extra lines), it's as easy as the Lisp version to use.Granted... The solution for some is a four line loop...
(defun get-file (filename)
(with-open-file (stream filename)
(loop for line = (read-line stream nil)
while line
collect (parse-integer line)))) (with-input-from-string (stream "1,2,3")
(let ((*readtable* (copy-readtable)))
(set-syntax-from-char #\, #\ )
(loop for num = (read stream nil nil)
while num
collect num)))