Skip to content

Instantly share code, notes, and snippets.

@bradlucas
Last active April 29, 2019 21:48
Show Gist options
  • Select an option

  • Save bradlucas/1370555 to your computer and use it in GitHub Desktop.

Select an option

Save bradlucas/1370555 to your computer and use it in GitHub Desktop.
solution to Nth Element ;; https://4clojure.com/problem/21
04e7022... 04/06/16 17:11 private Recent Proximo Traffic
6e2d3d6... 03/30/16 10:53 private Pipeline Release 1.0.15 configration changes
449e987... 03/23/16 16:56 private Supersonic edn change notes
b0180b4... 03/23/16 14:10 private Pipeline Release 3-28-2015 configuration changes
b38895e... 03/17/16 10:05 private mehmet-query.sql
194b163... 03/16/16 14:02 private Pipeline configuration settings
4a5af98... 03/04/16 14:32 public get-all-first-commit-authors-repos.sh
c77b5cf... 03/04/16 13:57 public get-all-first-commit-authors.sh
f1feb63... 03/04/16 13:41 public Get first git commit
9b0449f... 03/03/16 13:37 private Heroic Apps Chart (Text Version)
164bf99... 03/02/16 16:33 private Heroic Apps Chart (Markdown Version)
2536c57... 03/02/16 13:15 public release-procedures.md
5ea1cd2... 03/02/16 11:38 public git-flow-enhancements.sh
3f8e58f... 03/02/16 11:21 public git-flow-pattern.md
7e82d08... 03/01/16 13:30 private meterstick-outage-notes.md
3e8cae7... 02/25/16 11:17 private hot-to-start-clustering-in-dev.md
b002e51... 02/14/16 09:34 private Meterstick TOC
+ 1596adf... 02/12/16 16:11 private Fiksu Trafficking Documents
cca6a68... 02/12/16 16:08 private example-millennial.md
7847fb1... 02/12/16 11:37 private Meterstick Click URL Construction Guide
e9c03c5... 02/12/16 11:24 private Meterstick postback definitions (Forked)
+ db7cab0... 02/02/16 11:22 private
+ 7007372... 01/21/16 15:47 private
82ba4fa... 01/14/16 10:08 private Downloading with s4cmd error
83add21... 12/29/15 14:34 private ActionX Collate Dev Config Settings
923e672... 12/08/15 11:29 public Pipeline Eclipse Notes
5708933 06/04/13 15:47 public Fixes issue with tablesorter scroller showing the first table's header as the header for all subsequent pages
1370555 11/16/11 11:30 public solution to Nth Element ;; https://4clojure.com/problem/21
1233763 09/21/11 20:53 public find-new-members
;; blucas's solution to Nth Element
;; https://4clojure.com/problem/21
(fn [col n]
(if (zero? n)
(first col)
(recur (rest col) (- n 1))))
@jclosure
Copy link

;; bit simpler way to go is convert list to a vector and look it up with get

(get (vec %1) %2)

@viktor-evdokimov
Copy link

what about #(first (drop %2 %1))

@slifin
Copy link

slifin commented Apr 29, 2019

I ended up with

#(first (nthrest %1 %2))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment