3 ms·
From the README: <quote>We're going to declaratively define a parser for the tar format, and once we're done, our code will not only extract .tar files, but cre
by marbu 4y ago
From the README: <quote>We're going to declaratively define a parser for the tar format, and once we're done, our code will not only extract .tar files, but create them as well.</quote>
I recall reading about this somewhere, but haven't seen such nice real world example before. Well done.
- Avshalom 4y agoThere's a cool little bencode library that also works like that, all of 30 short lines too. https://github.com/mndrix/bencode/blob/master/prolog/bencode.pl https://github.com/mndrix/bencode/blob/master/prolog/bencode... https://en.wikipedia.org/wiki/Bencode https://en.wikipedia.org/wiki/Bencode
- zelphirkalt 4y agoI think if done right, this falls out of Prolog automatically, as you program in relations, rather than functions. Depending on which places you leave empty in a query, Prolog will work to fill in the empty places. One is probably the tar file and one is the folder being added to a tar archive, but none of the 2 is any more important than the other.
- samuell 4y agoCheck out "Production Prolog" by Michael Hendricks on YouTube, which demonstrates the same thing, at a talk at StrangeLoop: https://youtu.be/G_eYTctGZw8 https://youtu.be/G_eYTctGZw8