Fork me on GitHub
#beginners
<
2021-06-10
Angel Rojas00:06:47

hello, could you please tell me where find a tutorial for create an API REST

sova-soars-the-sora01:06:20

2 links there, one is the tutorial, one is the source code of the main core.clj file

sova-soars-the-sora01:06:31

if you need any help feel free to ask in the channel ! ^.^

Angel Rojas00:06:28

its great to be here...!😃

Chris K00:06:55

Hello I'm using doom emacs and cider for clojure and for some reason, if I run cider on certain directories, emacs will go crazy and use 100% of my cpu, the cider repl will also not open

seancorfield01:06:02

If you haven’t asked there already, you may have a better chance of getting answers in #cider and/or #doom-emacs

Chris K00:06:09

this happens only on like 1 directory and others projects are fine

Chris K02:06:19

I have a map that I need the keys to be characters like '(' or ';' but I'm not sure what's the best way to make a map with keys like this I currently have it as : {";" "SemiColon"}

jaihindhreddy03:06:17

Character literals are preceeded by a backslash in Clojure:

{\; "SemiColon" \( "OpeningParenthesis"}

Chris K03:06:37

Thanks!! Been a while also 😄

1
popeye08:06:10

I have json structure like below

{
    "fruit": "Apple",
    "size": "Large",
    "color": "Red"
}
{
    "fruit": "orange",
    "size": "Small",
    "color": "Red"
}

popeye08:06:25

How can I group like below structure

popeye08:06:27

fruit=[Apple, Large]
size=[Large,Small]

delaguardo08:06:13

(reduce
 (fn [acc {:strs [fruit size]}]
   (-> acc
       (update "fruit" (fnil conj []) fruit)
       (update "size" (fnil conj []) size)))
 {}
 [{...}])
as an example of using reduce

popeye08:06:38

What us :strs ?

delaguardo08:06:47

destructuring instruction, same as :keys but for string

👀 1
popeye08:06:45

I got update does noot found , I am using clojure 1.9

popeye08:06:15

I got {f{r{u{it{s{mango orange}}}} after using update-in

delaguardo08:06:15

update-in expect to have a sequential path provided as a second argument. I guess you have a string instead. The problem that in clojure string is also sequential data

delaguardo08:06:23

just use update

popeye08:06:38

it says update not found

delaguardo08:06:44

could you share your code?

popeye08:06:26

@U04V4KLKC

(reduce
               (fn [acc dt]
                 (-> acc
                     (update "fruits" (fnil conj []) (:fruits dt))
                     (update "size " (fnil conj []) (:size dt ))))
               {}
               data)

popeye08:06:44

oh sorry , i had the code updat eexclude above