$use Box System Arithm Convert StdIO "org.refal.plus.wrappers.java.lang.Thread" RefalThread; $use "org.refal.plus.wrappers.java.util.concurrent.atomic.AtomicInteger"; $box Count; $box Threads; $func Perm s (e) (e) = ; Perm s.box (e1) (e2) = { e2 : \{ ea tx eb, , $fail; = // : s.inc, >; // : s.inc, // :: e ; };; }; $func RunThread s e = s; RunThread s.func e.args = :: s.thread, , s.thread; Main = , //> :: s.threadCount, > :: s.listSize, s.listSize $iter e.list s.count :: e.list s.count, s.count : 0 = { e.list : e.head t.term e.tail, :: s.box, s.box)>, $fail; ; }, { : e (s.thread s.box) e, , : s.inc1, : s.inc2, >, $fail;; }, >;