This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # beginners (35)
- # boot (5)
- # cider (16)
- # cljs-dev (22)
- # cljsrn (11)
- # clojars (1)
- # clojure (205)
- # clojure-uk (19)
- # clojurescript (76)
- # cursive (22)
- # duct (4)
- # editors (1)
- # emacs (4)
- # fulcro (1)
- # hoplon (3)
- # leiningen (5)
- # off-topic (25)
- # onyx (29)
- # other-languages (5)
- # parinfer (1)
- # re-frame (13)
- # reagent (8)
- # reitit (2)
- # shadow-cljs (3)
- # tools-deps (11)
- # vim (6)
@ackerleytng the same way you’d use spec to validate regular data; you’d read the edn config and then use s/valid or others means to check it against a spec
I read two books ( brave of clojure - https://www.braveclojure.com/quests/reducers/know-your-reducers/#Eliminating_Intermediate_Collections) and Clojure High Performance ( https://www.amazon.com/Clojure-High-Performance-Programming-Second/dp/1785283642 ) .
I’m intrigued because both books talks about lazy-seq
brave of clojure says that code below is super stupid because we are going to create intermediate collections and
clojure high performance says exactly the opposite (lazy seq does not produce intermediate collections and we are running the code in O(n) )
my question is> Does the follow code will produce intermediate collections or not ? my understanding is that will not create any intermediate collections , both lazy-seq ( 1 and 2 ) will memoize which will increase the memory footprint. is that correct ? which book is correct ?
(->> (list "Shake" "Bake") ; (map #(str % " it off")) ; 1 (map clojure.string/lower-case) ; 2 (into ))
@alexmiller 1 will return a lazy-seq to 2, right ?
((map clojure.string/lower-case) lazy-seq-1)
every map returns lazy-seq in order to run the code in 0(n) you have to use transducers
yeah I see, so both 1 and 2 are memoizing the values which is considered intermediate collections
into is implemented with reduce, which walk the lazy seq asking for the next value, which asks the top lazy seq which asks the next lazy seq which asks the list
The transducer version would create one composite reduce function, walk the list, and drop the results into the output vector
Are there any guides on setting up a in-memory database for testing? Creating the database in a fixture, adding some records for one group of tests and so on?
Michael Nygard had a good video on Youtube using Datomic, but I have to use relational database so I will need to use H2 or SQLite :mem: instead.