Re: Cfor as a junction operator
Damian Conway wrote: Yes, but will it junctify them con-, dis-, ab-, or in-junctively??? Probably most similar to injunctively. But sequentially. I had been thinking of something like this: while (DATA) { print matched $_ if $_ == for(1,2,3,4,5); } __DATA__ 1 2 9 3 4 5 Like the old bistable operator, each instance of the loop would maintain the current state of the sequence. There's still the issue of implicit serialization. Junctions...err...don't. Perhaps you're right that this isn't really a junction; but its not completely dissimilar, either. I used the term junction as a frame of reference for the type of behavior I was thinking of. Besides, I don't think we need to sacrifice Cfor to achieve this behaviour. If ordered junctions are a useful concept (and I can see that they might well be), we can have them like so: [...] I wasn't thinking of a sacrifice: just an adjustment of perception to integrate with pipelining. Dave.
Cfor as a junction operator
In the L2R thread, I made a comment where I contrasted a for loop with a junction. On reflection, I think we could go further. If we defined my $prev = 0; sub mangle($value) { $value + $prev; $prev=$value } and then used it as: my $x = any(1,2,3); $y = mangle($x); then the semantics of junctions are defined to fork 3 threads, to evaluate Cmangle for each member of the junction in an arbitrary order. So there are now many possible values for $y. For example: any(2,5,6) if the order of evaluation is 2,3,1. Let us now imagine that Cfor is a junction operator, instead of a looping statement. Now we could write: my $x = for(1,2,3); my $y = mangle($x); and we can be certain that $y == (1,3,6), because a for-junction will distribute that evaluations sequentially. This ties in nicely with the pipeline syntax discussion, because for 1,2,3 ~ print; and for 1,2,3 - { print }; would naturally behave correctly. But by defining a special type of sequentially distributed junction, we can do all sorts of clever (and therefore nasty) things. Dave. -- mailto:[EMAIL PROTECTED]; http://dave.whipp.name
Re: Cfor as a junction operator
Dave Whipp wrote: Let us now imagine that Cfor is a junction operator, instead of a looping statement. Now we could write: my $x = for(1,2,3); my $y = mangle($x); and we can be certain that $y == (1,3,6), because a for-junction will distribute that evaluations sequentially. Yes, but will it junctify them con-, dis-, ab-, or in-junctively??? Besides, I don't think we need to sacrifice Cfor to achieve this behaviour. If ordered junctions are a useful concept (and I can see that they might well be), we can have them like so: my $x = any(1,2,3) but ordered; my $y = mangle($x); This ties in nicely with the pipeline syntax discussion, because for 1,2,3 ~ print; There's still the issue of implicit serialization. Junctions...err...don't. Damian