Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.
I just had an epiphany about how to make the AI::Prolog parser work much better. It would be cleaner and faster and probably allow for proper operators. The latter would allow me to do this:
X is Y + Z * 2.
Instead of:
is(X, plus(Y, mult(Z, 2))).
The latter, of course, is just plain ugly. I've also figured out a better way to handle precedence which might allow me to change the Prolog syntax at runtime (op/3 allows this in normal Prolog).
The only problem with my new idea is that I don't have time
In other news, Randal found a nifty solution to a weird problem. Someone wanted to count all instances of a string in another string, even if they were overlapping. So 'AA' can be found in 'AAAA' 3 times. Randal's solution, though Perl, is straight from Prolog:
sub match_count {
my ($string, $pattern) = @_;
my $n = 0;
$string =~/$pattern(?{ $n++ })(?!)/;
return $n;
}
Neat, eh?
Re: (Score:1)
What are you talking about?
</lisp-guy>That’s straight from Mastering Regular Expressions, basically. :-)
Re: (Score:2)
It might be from MRE (Meal, Ready to Eat?), but Randal did give credit specifically to Prolog :) In this case, it's a very common Prolog idiom to force something to fail in order to backtrack and cover all solutions:
Thus learning Prolog well enough makes solutions like Randal's seem natural.