Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
Being laid up with a bad foot, I decided to work through more of the Amzi! Prolog tutorial. I really like the tutorial as it's clearly written and show how things operate under the hood. I read the lists chapter to see if I could learn techniques to better explain lists. Unfortunately, they are something that you'll either get or your won't. However, working through each of the exercises is like solving a bunch of mini-logic puzzles. I like that.
Here's my stab at various questions (they can be harder than they look, but as is often the case, a simpler answer is more likely to be correct).
remove(X,[X|Tail],Tail).
remove(X,[Head|Tail],[Head|Remainder]):-
remove(X,Tail,Remainder).
next(X,[X|[Y|_]],Y).
next(X,[_|Tail],Y):-
next(X,Tail,Y).
split(X,List, Before, After)
:-
append(Before, [X|After],List).
last([X],X).
last([_|Tail],X):- last(Tail,X).
length([],0).
length([_|TAIL],N):-
length(TAIL,N1),
N is N1 + 1.
That last one was tricky because the math must be done last to ensure the N1 variable is instantiated since math is not done logically in Prolog.
Hobbled. Solving Prolog Puzzles. 0 Comments More | Login | Reply /