• Clojure
  • 10 lines
  • 33 views
  • 1 fork
  • Pasted by anonymous on June 23, 2013
;; amalloy's solution to Lazy Searching
;; https://4clojure.com/problem/108

(letfn [(in-lists? [x lists]
          (if-let [[list & more] (seq lists)]
            (and (= x (first (drop-while #(< % x) list)))
                 (recur x more))
            true))]
  (fn [source & sinks]
    (first (filter #(in-lists? % sinks) source))))

Did you know? CLOSE

  • There are keyboard shortcuts!
    • When Creating A Paste
      • ALT+P Toggle Private
      • CTRL+Enter Create Paste
      • ALT+W Toggle word wrap
    • When Viewing A Paste
      • ALT+G Go to a line
      • ALT+CTRL+E Edit the paste
      • ALT+R Show the raw code
  • There are URL options!
    • When Creating A Paste
      • ?lang=Javascript to default to javascript
    • When Viewing A Paste
      • #L-N Jump to line number N
?