Today's is postponed until the evening, as it seems I have some fires to put off at work. Today I'm trying to use Chibi Scheme's parser combinators module to read the input, because it can no longer be read as a stream of plain Scheme values — which was great to avoid parsing. More later!

So, I've managed to get the parser combinators from the “(chibi parse)” module to work. I quite don't get it why giving an identifier to the grammar when later it is not used, and what gets referenced to start parsing is one of the functions that implement parsing a non-terminal... but it works and there is a nice “parse-fold” function which applies a parsing function over the input, possibly accumulating it e.g. into a set of records. Also: today I also figured how to use “define-record-type”!

Follow

Nevertheless, I haven't yet finished the programs for day 3 of the but on my defense I can say that now I know how to use a language feature (record types) which so far I had not touched in other functional languages that I know (OCaml, some Haskell, and so).

Scheme feels like one *really* needs to master the standard library and the language conventions to really become fluent in it. Has somebody else had the same impression with like languages?

@aperezdc All I remember was parentheses, lots of parentheses. And car, cdr. It was not my war! 😫

@KekunPlazas Surprisingly, the parentheses are kind of okay, and a good editor (Vim, Emacs... you name it) goes a long way to make that manageable. The car/cdr madness makes one wish for built-in syntax for destructuring, indeed!

@KekunPlazas On a related note, yesterday I discovered the “(chibi match)” module brings in structural pattern matching, and that saves *a lot* of car/cdr/cadr/etc. Example usage: github.com/aperezdc/aoc2018-sc

There's still plenty of parens, though... Which is inevitable in Lisp-y languages.

If I am understanding correctly, Chibi Scheme's “match” module should work with other implementations as well, docs here: snow-fort.org/s/gmail.com/alex

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!