fork(1) download
  1. (define (recombine left right)
  2. (if (not (null? right))
  3. (let ((tail (cdr right))
  4. (next (cons (car right) left)))
  5. (format #t "~a\n" (string-join
  6. (map number->string next) " "))
  7. (recombine next tail)
  8. (recombine left tail))))
  9.  
  10. (recombine '() '(1 2 3 4))
Success #stdin #stdout 0.03s 8656KB
stdin
Standard input is empty
stdout
1
2 1
3 2 1
4 3 2 1
4 2 1
3 1
4 3 1
4 1
2
3 2
4 3 2
4 2
3
4 3
4