Common Patterns: Difference between revisions
Content added Content deleted
Line 25: | Line 25: | ||
'''Examples''' |
'''Examples''' |
||
<code>-':1 2 3 4 -> 1 1 1 1 /the builtin eachp prepends an array with zero before evaluation, so the output is the same size</code> |
<code>-':1 2 3 4 -> 1 1 1 1 /the builtin eachp prepends an array with zero before evaluation, so the output is the same size</code> |
||
<code>-':5 2 4 8 -> 5 -3 2 4</code> |
<code>-':5 2 4 8 -> 5 -3 2 4</code> |
||
<code>{y/(1_;-1_)@\:x}[6 7 8;-] -> 1 1 /you can substitute the default eachp with your own for different behaviour, like this shakti example that just evaluates over each pair in x without prepending 0</code> |
<code>{y/(1_;-1_)@\:x}[6 7 8;-] -> 1 1 /you can substitute the default eachp with your own for different behaviour, like this shakti example that just evaluates over each pair in x without prepending 0</code> |
||
<code>/the difference is highlighted here: |
<code>/the difference is highlighted here: |
||
-':6 7 8 -> 6 1 1</code> |
-':6 7 8 -> 6 1 1</code> |