Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Elegantly map fizz to buzz

by raiph (Deacon)
on May 22, 2016 at 20:30 UTC ( [id://1163804]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Elegantly map fizz to buzz
in thread Elegantly map fizz to buzz

Rakudo does not yet attempt parallelization of any Junctions. Even if/when it one day does, overhead will sometimes dominate, especially when trying to parallelize really tiny computations. I'm curious what you meant by "duplicate removal phase" and would enjoy reading an elaboration of that.


Here are the two rules which drive how the grammar distinguishes a Whatever * from a multiplication *:

  1. If a token appears where an operator is allowed and there's a corresponding operator definition then it's that operator.

    For example, an operator is allowed between values, and an infix:<+> definition is in scope in ordinary code (here's the built in Numeric role's contribution to that definition), so the token + in 2 + 3 is treated as invoking infix:<+>. The same thing applies for other infix operators including multiplication with Infix:<*>.

  2. If an asterisk is NOT treated as an operator and appears where a value is allowed then it's a Whatever.

    For example, 2 + 3 includes the two values 2 and 3 and there is no prefix:<*> so one could write * + * to express "Whatever plus Whatever".

Replies are listed 'Best First'.
Re^5: Elegantly map fizz to buzz
by Laurent_R (Canon) on May 23, 2016 at 06:22 UTC
    Thanks Raiph for your explanations about the whatever. It still looks very magical to me.
    I'm curious what you meant by "duplicate removal phase" and would enjoy reading an elaboration of that.
    If you grep multiples of 5 and multiples of 5 separately (in parallel, assuming Rakudo would parallelize junctions), you would end up with multiples of 15 on both streams, so you would need to remove those duplicate before proceeding to the summation.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1163804]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2024-04-18 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found