Difference between revisions of "rev"

From TidalCycles userbase
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:rev}} Type: <syntaxhighlight lang="haskell" inline>rev :: Pattern a -> Pattern a</syntaxhighlight> '''rev''' returns a 'reversed' version o...")
 
m
Line 20: Line 20:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
[[Category:Functions]]
+
[[Category:Functions]] [[Category:Pattern Transformers]]

Revision as of 21:31, 25 November 2018

Type: rev :: Pattern a -> Pattern a

rev returns a 'reversed' version of the given pattern.

For example rev "1 [~ 2] ~ 3" is equivalent to rev "3 ~ [2 ~] 1".

Note that rev reverses on a cycle-by-cycle basis. This means that rev (slow 2 "1 2 3 4") would actually result in (slow 2 "2 1 4 3"). This is because the slow 2 makes the repeating pattern last two cycles, each of which is reversed independently.

In practice rev is generally used with conditionals, for example with every:

d1 $ every 3 rev $ n "0 1 [~ 2] 3" # sound "arpy"

or jux:

d1 $ jux rev $ n (iter 4 "0 1 [~ 2] 3") # sound "arpy"