Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Thanks for journaling about this so I can read it from afar. Very good slides.

    This has motivated me to install the Münster Curry compiler [], a Haskell implementation of the Haskell-Prolog hybrid language Curry [].

    I suspect it'll be a lot of fun reading about it. As for application programming, it seems that much of the semantic web stuff -- RDF in particular -- corresponds closely to logic programming models, so that might be a good vector to explain to people.

    • I'm glad you liked the slides. I've been hearing a bit about Curry and I should dig into it. Incidentally, you may be interested in the response I just made to Dom. I list a couple of Prolog/RDF links which may prove interesting.

      • I especially like how Curry reuses all Haskell syntax, but managed to express the logical paradigm through it. The key seems to be the free variable annotation and the =:= equivalence operator.

        In Perl 6, this might be:

        my $x is free;
        $x + 3 === 4;
        say $x; # 1

        Does this seem sane to you? I wonder if P6L can handle this. :-)

        • Well, there does seem to be a strong desire to get logical programming into P6, so I suspect that well-thought out proposals will be welcomed. The major problem I have in participating is two-fold. First, I simply don't have the experience with P6 to be able to make contributions that are going to fit well in the current model. Second, I fear that most who are involved are considerably brighter than I am. This makes me a poor sounding board for ideas. (I'm not trying to present this as false modesty.

          • I like the ` twigil -- the is free syntax is from Curry, but I think twigil fits Perl6 better.

            To define last with append in Curry, we write:

            append [] ys = ys
            append (x:xs) ys = x : append xs ys

            last l
                | append xs [x] =:= l
                = x
                where x, xs free

            Translating this to Perl6:

            multi append ([], @ys) { @ys }
            multi append ([*$x, *@xs], @ys) {
                ($xs, append @xs, @ys)
            sub last ($l) {
                my ($`x, @`xs);
                append(@`xs, [$`x]) === $l;

            • Er, sorry, it should be @l in that last:

              sub last (@l) {
                  my ($`x, @`xs);
                  append(@`xs, [$`x]) === @l;

              The trick of Curry is to introduce a special type, Success, that encapsulates constraint solutions. I'm still working through the tutorial [], so it will take a bit before coherent thoughts emerge...

            • OK, I'm definitely liking this better. I think it can work. Is multi enough, though? Would assert or something similar be a better keyword so Perl can know that it's working with a fact or rule?