From 86527bda35166f2ef18f39d5dcec8f953e611f49 Mon Sep 17 00:00:00 2001 From: Wouter Snoei Date: Wed, 28 Dec 2016 16:36:01 +0100 Subject: [PATCH] add Ppostln can post values from inside a pattern --- .../Main Features/Patterns/Ppostln.sc | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 wslib-classes/Main Features/Patterns/Ppostln.sc diff --git a/wslib-classes/Main Features/Patterns/Ppostln.sc b/wslib-classes/Main Features/Patterns/Ppostln.sc new file mode 100644 index 0000000..87ae66d --- /dev/null +++ b/wslib-classes/Main Features/Patterns/Ppostln.sc @@ -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 ) } +} \ No newline at end of file