Dear all, I've recently thought of a possible syntax extension for (Perl5's) [un]pack() and I posted my "RFC" to clpmisc where it didn't have much success, I must say. However I'm not interested in proposing it here, only I would like to investigate a possible Perl6 technique inspired by those thoughts...
Well, to come to the point, it does happen, even if admittedly not too often and with not too long sequences, to use "cascaded" [un]pack()s. Now I'm not specifically interested in *these* functions anymore, but more generally in a generic function that accepts a first argument as a template according to which it interpretates the other ones. For clarity I will still use, say, pack(). Now I want to take a list of templates, say $t1, ... $tn and get the result of $result = pack $tn, ... pack $t2, pack $t1, @input; without actually writing the whole thing. To my knowledge and great pleasure Perl6 will support currying and a builtin reduce/fold operator. So what I would like to do is (i) C<map> the list of templates to a list of curried closures in which the first parameter is fixed to each given template, (ii) C<reduce> this list by means of right pipe binop ( C<< ==> >> ) with a "starting value" (leftmost) of, say, @input. What I'm asking is (i) wether this would actually be possible, and if so, then (ii) what it would probably look like in actual Perl6 code. BTW: I guess something like my $result = @input ==> reduce &operator:==>, map {...}, @templates; where {...} would represent the curried closures, if only I knew how they are supposed to look like! TIA, Michele -- {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB=' .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_, 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,