Cycle detection: Difference between revisions

m
→‎{{header|jq}}: indentation
(→‎{{header|jq}}: move specifics to the end)
m (→‎{{header|jq}}: indentation)
Line 1,287:
'''Works with gojq, the Go implementation of jq'''
<lang jq>def floyd(f; x0):
{tort: (x0|f)}
| .hare = (.tort|f)
| until( .tort == .hare;
.tort |= f
| .hare |= (f|f) )
Line 1,302:
| until (.tort == .hare;
.hare |= f
| .lambda += 1 )
| {lambda, mu} ;
 
2,442

edits