This is how the Idris prelude defines nat, the type of natural numbers (with some magic making it actually fast). I think that’s very cool.
On the other hand CLP(FD) is not new at all (it is very popular for constraint programming).
I then took it and added a second level: once it has found a minimal number of sheets, minimize the number of cuts. Super handy little tool! Once I had the solver part figured out and added a little tweak for handling kerf, it was quite simple to have it spit out an SVG that showed all of the pieces and cuts.
And now… I want to go find that code and play with it again. Super fun stuff outside of the daily grind.
It starts out pretty easy but gets harder and requires more thought. It has different sections on things like list processing or graph problems.
It’s being done to facilitate Fortnite metaverse, as he’s doing this work at Epic.
That list is roughly in order of how capable and useful the pattern matching is in each of those languages. Erlang was originally written in Prolog.
Also, I definitely agree it's a feature I miss everywhere when not using Erlang/Elixir.
I do wish they went the opposite direction and made the feature better instead of keeping it as a weird assignment thing in the body. The match statement is a similarly unfortunate solution, in my opinion.
Oh well. :)
I checked the release notes, and the reason they removed it: no one was using it. I guess it's unsurprising, but sad.
There's a decent discussion from a few years ago on hn, as well: https://news.ycombinator.com/item?id=24662262
append([], List, List).
append([Head|Tail], List, [Head|Rest]) :- append(Tail, List, Rest).
Is a simple list append function: append(X, Y, Z) is a predicate that match if Z is the list of all elements of X, followed by all elements of Y. You can use it to concatenate lists, of course. But you can also use it to confirm that a particular list start with a particular sequence, or ends with a particular sequence! The idea that the same predicate can be used in multiple different ways is really fascinating to me. I have no idea to what extent that would scale in a large system, but it's very interesting