Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on CAD Is a Lie: Generative Design to the Rescue. Parent comment
Here's a fun little puzzle then. I wrote this predicate:
==
c(A-B, B-T, A-T).
That's all the predicate definition - nothing else to it. One line, yeah?
So, you put it in a Prolog source file, consult it, and then fire queries like this:
--
?-c([a,b|A]-A,[c,d|B]-B,T-B).
A = [c, d|B],
T = [a, b, c, d|B].
?- c([a,b|A]-A,[c,d|B]-B,T-[e,f|C]).
A = [c, d, e, f|C],
B = [e, f|C],
T = [a, b, c, d, e, f|C].
?- c([a,b|B]-B, B-T, [a,b,c,d|T]-T).
B = [c, d|T].
?- c((a,b,A)-A,(c,d,B)-B,T-B).
A = (c, d, B),
T = (a, b, c, d, B).
Now, based on your understanding of Prolog from ~50 lines of Lisp- how does that predicate work?
There are no comments on this comment yet.
Here's a fun little puzzle then. I wrote this predicate:
==
c(A-B, B-T, A-T).
==
That's all the predicate definition - nothing else to it. One line, yeah?
So, you put it in a Prolog source file, consult it, and then fire queries like this:
--
?-c([a,b|A]-A,[c,d|B]-B,T-B).
A = [c, d|B],
T = [a, b, c, d|B].
?- c([a,b|A]-A,[c,d|B]-B,T-[e,f|C]).
A = [c, d, e, f|C],
B = [e, f|C],
T = [a, b, c, d, e, f|C].
?- c([a,b|B]-B, B-T, [a,b,c,d|T]-T).
B = [c, d|T].
?- c((a,b,A)-A,(c,d,B)-B,T-B).
A = (c, d, B),
T = (a, b, c, d, B).
--
Now, based on your understanding of Prolog from ~50 lines of Lisp- how does that predicate work?