Skip to content

Instantly share code, notes, and snippets.

View charliegriefer's full-sized avatar

Charlie Griefer charliegriefer

  • Peoria, AZ
  • 05:43 (UTC -07:00)
View GitHub Profile
@charliegriefer
charliegriefer / elegance.clj
Last active June 2, 2017 06:03
The Elegance of Clojure
;; For a given list with N integers, return a new list removing the elements at odd positions.
;; Source: https://www.hackerrank.com/challenges/fp-filter-positions-in-a-list
;; My solution:
(fn[lst]
(map
#(when ((comp odd? first) %)
(println (second %)))
(map-indexed list lst)))