Skip to content

Commit

Permalink
add Ppostln
Browse files Browse the repository at this point in the history
can post values from inside a pattern
  • Loading branch information
woutersnoei committed Dec 28, 2016
1 parent 9c5f775 commit 86527bd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions wslib-classes/Main Features/Patterns/Ppostln.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Ppostln : Pattern {
var <>pattern, <>prefix;
*new { |pattern, prefix|
^super.newCopyArgs(pattern, prefix)
}
storeArgs { ^[pattern] }
embedInStream { arg inval;
var outval;
var stream = pattern.asStream;
loop {
prefix !? _.post;
outval = stream.next(inval).postln;
inval = outval.yield;
};
}
}

+ Pattern {
ppostln { ^Ppostln( this ) }
poll { |prefix| ^Ppostln( this, prefix ) }
}

0 comments on commit 86527bd

Please sign in to comment.