Intersecting number wheels: Difference between revisions

(→‎{{header|jq}}: works with)
 
Line 1,371:
# where $wheel is the wheel to be read (a string)
# Input: a set of wheels
# Output: an object such that .value is the next value, and .state is the updated state of the set of wheels
# and .state is the updated state of the set of wheels
#
def read($wheel):
 
Line 1,380:
 
.[$wheel][0] as $value
| (.[$wheel] |= rotate) as $state
| if ($value | type) == "number"
then {$value, state: (.[$wheel] |= rotate)state}
else (.[$wheel] |= rotate)state | read($value)
end;
 
# ReadingRead wheel $wheel $n times
def multiread($wheel; $n):
if $n <= 0 then empty
2,442

edits