fork download
  1. (def fields [".....
  2. ...O.
  3. .....
  4. ...^.
  5. ....." "...
  6. >O.
  7. ..." ">O.
  8. ..." "v....
  9. O...." "...........
  10. ...........
  11. O.........<
  12. ..........." "......
  13. ......
  14. .^..O." "......
  15. .....>
  16. O.....
  17. ......
  18. ......" ".O.
  19. ...
  20. .v." ".....<.
  21. ..O...." "<....O
  22. ......"])
  23.  
  24. (defn z[f](let[v(sort(keep-indexed(fn[i v](if(some #{v}[\v\>\<\^\O])[(if(= v\O)\& v)i]))f))l(+(.indexOf f"\n")1)d((nth v 1)0)q((nth v 1)1)p((nth v 0)1)r(=(quot p l)(quot q l))i(> q p)](cond(= d\^)(and i(=(mod(- q p)l)0))(= d\v)(and(not i)(=(mod(- p q)l)0))(= d\>)(and(not i)r):else(and i r))))
  25.  
  26. (println (map z fields))
Success #stdin #stdout 2.17s 335552KB
stdin
Standard input is empty
stdout
(true true true true true false false false false false)