Shift list elements to left by 3: Difference between revisions

(→‎{{header|Excel}}: added an Excel LAMBDA version.)
Line 703:
or 3 to right: [7,8,9,1,2,3,4,5,6]</pre>
 
=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang jq># input should be an array or string
def rotateLeft($n):
.[$n:] + .[:$n];</lang>
Examples:
<pre>
[1, 2, 3, 4, 5, 6, 7, 8, 9] | rotateLeft(3) #=> [4,5,6,7,8,9,1,2,3]
 
"123456789" | rotateLeft(3) #=> "456789123"
</pre>
=={{header|Julia}}==
<lang julia>list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
2,458

edits