[Chicago-talk] [PERL6]: Fun with junctions (was Sets vs Junctions)
Steven Lembark
lembark at wrkhors.com
Wed Feb 16 19:55:52 PST 2005
-- Andy_Bach at wiwb.uscourts.gov
> I don't know if anybody *else* is on the edge of their seat, await P6 but
> ... I ran into the "Perl 6 and Parrot Essentials" book at a used book
> store and so ended up on the P6 lists. Its not your mother's perl
> anymore; well, it will be (it'll have full P5 compatability somehow), but
> its a whole lot more. One new feature are junctions:
> http://dev.perl.org/perl6/synopsis/S09.html
>
> set-like, array like, yet w/ their own set of operations, like "any" and
> "all" ... below is a nice summary of what junctions are and why we want
> them.
Take a look at Quantum::Superpositions.
My contribution to P6 was showing Damian enough ways to use them
that he took the time to get them in :-)
The real trick is that a disjunction evaluates all of
its arguments to determine the truth. Grammers are single
objects that can be applied to input to return an output
or nada. Hence, you can create a disjunction of grammers.
This doesn't sound very interesting until you realize that
P6 compiles to parrot object: it's language agnostic. So
long as your grammer works with a given language and returns
true then it'll hand back soemthing to the junction's test.
Net result is that in P6 you an create a language-agnostic
compiler via "map { $junction_of_gramz } @source_blocks"
(or something fairly similar).
Try that with Python :-)
--
Steven Lembark 85-09 90th Street
Workhorse Computing Woodhaven, NY 11421
lembark at wrkhors.com 1 888 359 3508
More information about the Chicago-talk
mailing list