Skip to content

Commit

Permalink
class library: operators on pattern proxies embed
Browse files Browse the repository at this point in the history
This fixes supercollider#2412.
  • Loading branch information
telephon committed Oct 17, 2016
1 parent 6f52faf commit 897bb2c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions SCClassLibrary/JITLib/Patterns/Pdef.sc
Expand Up @@ -152,6 +152,23 @@ PatternProxy : Pattern {
^if(envir[\independent] === true) { (parent:envir) } { envir }
}

// function composition

composeUnaryOp { arg operator;
^NaryOpPatternProxy.new(operator, this)
}

composeBinaryOp { arg operator, pattern, adverb; // todo x-adverb
^NaryOpPatternProxy.new(operator, this, [pattern, adverb])
}
reverseComposeBinaryOp { arg operator, pattern, adverb;
^NaryOpPatternProxy.new(operator, pattern, [this, adverb])
}
composeNAryOp { arg selector, argList;
^NaryOpPatternProxy.new(selector, this, argList)
}

// state

storeArgs { ^[pattern] }

Expand Down Expand Up @@ -795,6 +812,22 @@ Pbindef : Pdef {

}

NaryOpPatternProxy : Pattern {
var <operator, <proxy, <arglist;

*new { |operator, proxy, arglist|
^super.newCopyArgs(operator, proxy, arglist)
}

embedInStream { |inval|
^proxy.embedInStream(inval, true).collect { |each| each.performList(operator, arglist) }
}

asStream {
^proxy.asStream.collect { |each| each.performList(operator, arglist) }
}
}


// general purpose lookup stream

Expand Down

0 comments on commit 897bb2c

Please sign in to comment.