Difference between revisions of "inside"
From TidalCycles userbase
Line 1: | Line 1: | ||
[[Type signatures|Type]]: <source inline>inside :: Pattern Time -> (Pattern a -> Pattern b) -> Pattern a -> Pattern b</source> | [[Type signatures|Type]]: <source inline>inside :: Pattern Time -> (Pattern a -> Pattern b) -> Pattern a -> Pattern b</source> | ||
− | ''inside'' carries out an operation 'inside' a cycle. | + | '''inside''' carries out an operation 'inside' a cycle. |
For example, while <source inline>rev "0 1 2 3 4 5 6 7"</source> is the same as <source inline>"7 6 5 4 3 2 1 0"</source>, <source inline>inside 2 rev "0 1 2 3 4 5 6 7"</source> gives <source inline>"3 2 1 0 7 6 5 4"</source>. | For example, while <source inline>rev "0 1 2 3 4 5 6 7"</source> is the same as <source inline>"7 6 5 4 3 2 1 0"</source>, <source inline>inside 2 rev "0 1 2 3 4 5 6 7"</source> gives <source inline>"3 2 1 0 7 6 5 4"</source>. | ||
+ | |||
+ | What this function is really doing is 'slowing down' the pattern by a given factor, applying the given function to it, and then 'speeding it up' by the same factor. In other words, this: | ||
+ | |||
+ | <source> | ||
+ | inside 2 rev "0 1 2 3 4 5 6 7" | ||
+ | </source> | ||
+ | |||
+ | Is doing this: | ||
+ | |||
+ | <source> | ||
+ | fast 2 $ rev $ slow 2 "0 1 2 3 4 5 6 7" | ||
+ | </source> | ||
+ | |||
+ | .. so rather than whole cycles, each halves of a cycle is reversed. | ||
[[Category:Functions]] | [[Category:Functions]] |
Revision as of 19:28, 5 January 2019
Type: inside :: Pattern Time -> (Pattern a -> Pattern b) -> Pattern a -> Pattern b
inside carries out an operation 'inside' a cycle.
For example, while rev "0 1 2 3 4 5 6 7"
is the same as "7 6 5 4 3 2 1 0"
, inside 2 rev "0 1 2 3 4 5 6 7"
gives "3 2 1 0 7 6 5 4"
.
What this function is really doing is 'slowing down' the pattern by a given factor, applying the given function to it, and then 'speeding it up' by the same factor. In other words, this:
inside 2 rev "0 1 2 3 4 5 6 7"
Is doing this:
fast 2 $ rev $ slow 2 "0 1 2 3 4 5 6 7"
.. so rather than whole cycles, each halves of a cycle is reversed.