This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-28
Channels
- # announcements (2)
- # babashka (15)
- # beginners (13)
- # chlorine-clover (17)
- # cider (14)
- # clj-kondo (1)
- # cljfx (3)
- # clojure (21)
- # clojure-australia (2)
- # clojure-europe (3)
- # clojure-nl (4)
- # clojurescript (25)
- # core-async (7)
- # cursive (8)
- # datomic (4)
- # defnpodcast (17)
- # events (1)
- # honeysql (5)
- # jobs-discuss (18)
- # pathom (8)
- # polylith (6)
- # reagent (2)
- # reveal (1)
- # shadow-cljs (2)
- # spacemacs (12)
- # tools-deps (13)
- # xtdb (2)
Hello! Could someone explain to how I should think about (apply map ....)
I understand apply
and map
but don't quite understand how something like (apply map list
((0 1 2) (3 4 5) (6 7 8))`
;; => ((0 3 6) (1 4 7) (2 5 8)) works
Map can take multiple seqs from which it takes an element of each sequence and passes it to the function
In the first iteration it takes 1 and 4 and passes it to list so it would end up (list 1 4)
Or to give another example you can do (apply map + [[1 2] [3 4])
and get ((+ 1 3) (+ 2 4))
and then (4 6)
any tips on making paginated links ?
example: collection of 500 maps each with a timestamp.
show first 50 elements on page 1
page 1: 0-50, page2: 51-100... page 3: 101-150... etc
and have 10 clickable "page" buttons to go between them
is there take
for specific ranges in a sequence? I notice there is subvec
...
this is normally done with some implicit page size and a way to efficiently skip items in the collection. if you're just using a clojure datastructure, skip and take can get this with obviously linear performance
oh I see. like (drop 50 (take 50 coll))
or maybe I did that backwards...
(take 50 (drop 50 coll))
linear performance is probably Ok.