This code works perfectly on KLIPSE but returns a null pointer exception error in 4clojure (problem #53)

24 views
Skip to first unread message

Elliot Atkins-Turkish

unread,
Feb 27, 2019, 3:48:33 PM2/27/19
to 4Clojure
#(last(sort-by count (loop[c 0 r []]
  (if(get % c)
    (recur (+ c (count(loop[c2 c r2 [(get % c)]]
  (if (and (= (get % c2) (dec (get % (inc c2)))) (get % c2))
    (recur(inc c2)(conj r2 (get % (inc c2))))
    r2
    )
  )))(conj r (loop[c2 c r2 [(get % c)]]
  (if (and (= (get % c2) (dec (get % (inc c2)))) (get % c2))
    (recur(inc c2)(conj r2 (get % (inc c2))))
    r2
    )
  )))
    r
    )
  )))
Screenshot from 2019-02-27 20-42-29.png
Screenshot from 2019-02-27 20-44-41.png
Reply all
Reply to author
Forward
0 new messages