This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-05
Channels
- # announcements (3)
- # babashka (64)
- # bangalore-clj (1)
- # beginners (12)
- # calva (21)
- # cider (7)
- # clj-kondo (16)
- # cljdoc (1)
- # clojure (49)
- # clojure-dev (2)
- # clojure-europe (10)
- # clojure-germany (3)
- # clojure-italy (1)
- # clojure-uk (13)
- # clojuredesign-podcast (6)
- # clojurescript (2)
- # code-reviews (21)
- # data-science (2)
- # datomic (3)
- # emacs (20)
- # events (1)
- # fulcro (2)
- # graphql (4)
- # java (3)
- # malli (14)
- # off-topic (45)
- # re-frame (2)
- # shadow-cljs (7)
- # tools-deps (167)
- # vrac (14)
- # xtdb (4)
I recommend looking at Integrant and adopting integrant.repl/reset
as part of the dev workflow. All stateful things are reseted, including routers.
As a reminder @nando, you can find the integrant.repl/reset
setup on the repo that I shared with you last time.
The Sean Corfield's usermanager with Reitit / Integrant version: https://github.com/PrestanceDesign/usermanager-reitit-integrant-example
@UFBL6R4P3 Thanks for the tip! I've been planning to integrate Integrant into my app as the next major step moving forward. And I've been using your repo as a reference, so thanks again for sharing it with me. It's been very helpful.
As a reminder @nando, you can find the integrant.repl/reset
setup on the repo that I shared with you last time.
The Sean Corfield's usermanager with Reitit / Integrant version: https://github.com/PrestanceDesign/usermanager-reitit-integrant-example
@vnazaryan That depends on what the lazy sequence contains. Can you be more specific about the context of your question?
For example:
user=> (def a (for [x (range 5) y (range 5)] [x y]))
#'user/a
user=> (type a)
clojure.lang.LazySeq
user=> (into {} a) ; a is a lazy seq of vector pairs so this works
{0 4, 1 4, 2 4, 3 4, 4 4}
user=> (def b (map inc (range 10)))
#'user/b
user=> (type b)
clojure.lang.LazySeq
user=> (into {} b) ; plain ol' sequence -- won't work
Execution error (IllegalArgumentException) at user/eval168 (REPL:1).
Don't know how to create ISeq from: java.lang.Long
user=> (into {} (partition 2 b)) -- sequence of (non-vector) pairs -- won't work
Execution error (ClassCastException) at user/eval170 (REPL:1).
class java.lang.Long cannot be cast to class java.util.Map$Entry (java.lang.Long and java.util.Map$Entry are in module java.base of loader 'bootstrap')
user=>
@seancorfield please see the result or print function of returned data. its class is clojure.lang.LazySeq that is why I am not able to read values by keys, need to convert it into map.
I am looking to read in some CSV files and do some very simple manipulations on the result, like concatenating two CSV files on same-named column, altering the value of a column, and computing a new column based on the values of other columns in the same row. If you are familiar with R
, I am thinking a very small subset of what is implemented in the {dplyr}
package there. I started looking at incanter
, but that appears to no longer be under active development, and I'm not sure I can find the appropriate ways to do it via that anyway (though if it is no longer supported, and I am missing the basic data manipulation tooling, I'd be happy to be pointed to it). I imagine I can implement from scratch, but I have to assume this has already been implemented elsewhere and far more robustly than my first pass will do. Is there a section of incanter
that does basic tabular data manipulation? Or is there another package that is smaller that does this for the data structure that is read in by clojure.data.csv
?
@vnazaryan That looks like a hash map inside a sequence. Use first
to get the hash map out.
(and it's much easier for folks to help if you post code as text instead of images)
You can use triple backticks around blocks of code to make it more readable, or single backticks around a short expression
block of
code with three ` before and after
And ({:short "expression"})
@seancorfield "first" works, thanks so much.