develooper Front page | perl.perl6.language | Postings from April 2005

Calling junctions of closures

Thread Next
From:
Brad Bowman
Date:
April 20, 2005 01:27
Subject:
Calling junctions of closures
Message ID:
1113985623.1088.170.camel@oxum

Hi,

Assuming this is allowed, what will the .() calls below return?
Does the result depend on the calling context?

 use junctions;  # still required?

 my @subs = ( sub { return 1 } , 
              sub { return 2 } );

 # call the closures in the junction
 any(@subs).();
 all(@subs).();
 one(@subs).();
 none(@subs).();
 one(any(@subs),sub { ... }).();


I'd guess the rule is "call 'em all and return a similarly
structured junction".  How far off the mark am I?


On Fri, 2005-02-11 at 10:46 +1100, Damian Conway wrote:
> Subject: Re: Fwd: Junctive puzzles.
>
> Junctions have an associated boolean predicate that's preserved across 
> operations on the junction. Junctions also implicitly distribute across 
> operations, and rejunctify the results.


Brad

PS. Pugs 6.2.0 currently gets confused:
pugs: cannot cast from VJunc
any(<SubRoutine(<anon>)>,<SubRoutine(<anon>)>) to AST.VCode

--
  The occurrence of mysteries is alway by word of mouth.   -- Hagakure


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About