Fork me on GitHub
#beginners
<
2016-09-19
>
shaun-mahood01:09:33

@eslachance: check out the docs at https://clojuredocs.org/clojure.core.async , the version with one ! has to be called within a go block - Not sure about the !! version bu lt it sounds like they are showing you different errors

eslachance01:09:34

Honestly I was just curious. tbh that's test code I was just running in the repl, but I was surprised to see it no load correctly.

eslachance01:09:58

The disconnect between "Runs in REPL" and "Won't let REPL load" didn't immediately occur to me.

eslachance01:09:04

I do have an actual #beginners question though. The following code is failing with Parameter declaration "let" should be a vector, and I'm not sure why. Looks the same as other defn blocks with a let...

(defn start-socket
  (let [ws-address (:body (http/get API))]
    (connect-socket ws-address)))

coyotespike01:09:40

How do basic migrations work? I'm using the migratus library. I thought running migratus/up config <numberhere> and then migratus/down config <numberhere> would create and then kill a table. However, the table is created but not dropped. That is, the up seems to work but not the down. Am I missing something incredibly basic?

coyotespike01:09:23

I've confirmed that running the SQL in the down file drops the table when run in psql at the command line.

coyotespike03:09:12

Never mind, the ever-helpful Yogthos confirmed my solution: https://github.com/yogthos/migratus/issues/88

plexus05:09:12

@eslachance your defn is missing a parameter list

plexus05:09:53

(defn start-socket []

plexus05:09:39

Regarding <!! it will block unless the channel is buffered, or there's another thread already doing a !!>

plexus05:09:23

There's probably a go loop somewhere draining that channel, but it needs to start before you do that log or you get a deadlock

dev-hartmann09:09:00

hey guy, i could need some help here. i am trying to add to a list inside a map of maps if the if the id matches

dev-hartmann09:09:04

problem is, finding the matching element is not a problem, but updating the value inside the nested structure makes my head explode 😞

dev-hartmann09:09:40

structure example: {:items ({:item-id 1 :sub-items '({:sub-item-id 1 :value ...))}

st09:09:11

update-in does not help?

dev-hartmann09:09:19

maybe i'm not getting that, but i need to find the right element in the nested structed and have no fixed path

dev-hartmann09:09:53

or maybe i don't know how to add a filter predicate to update-in

dev-hartmann09:09:04

if that is possible

sveri09:09:45

@dev-hartmann For complex paths in data structures currently https://github.com/nathanmarz/specter is the go to tool.

dev-hartmann09:09:59

thanks @sveri, found that too, but can't use it for some odd clojurescript error

dev-hartmann09:09:31

@sver that's the error by the way: any? already refers to: cljs.core/any? being replaced by: com.rpl.specter.impl/any? at line 530 resources/public/js/compiled/out/com/rpl/specter/impl.cljc

willyfrog10:09:12

that’s not an error, but a warning

sveri10:09:18

@dev-hartmann Dont want to be pedantic here, but that is a warning and not an error. You will have to exclude the any? function from either specter or cljs.core.

dev-hartmann10:09:54

hm, figwheel reports an error and does not compile

willyfrog10:09:35

I haven’t used figwheel, sorry πŸ˜•

sveri10:09:38

@dev-hartmann does it work if you (:require [specter... :as spec]...?

dev-hartmann10:09:04

Compiling "resources/public/js/compiled/frontend.js" from ["src/cljs"]... ERROR: any? already refers to: cljs.core/any? being replaced by: com.rpl.specter.impl/any? at line 530 resources/public/js/compiled/out/com/rpl/specter/impl.cljc Compilation aborted Subprocess failed

dev-hartmann10:09:10

that's the error message

sveri10:09:22

I got that, please see my question above πŸ™‚

dev-hartmann10:09:26

and i require it like (:require [com.rpl.specter :as specter])

sveri10:09:44

then we need to exlude the any? function from cljs.core

sveri10:09:58

I never did that for clojurescript though, will have to look for that myself

dev-hartmann10:09:24

excluding any? in :require does not work, clojure.lang.ExceptionInfo: Only :as, :refer and :rename options supported in :require / :require-macros; offending spec:

sveri10:09:22

Ok, try seomthing like (:require [com.rpl.specter :as specter :rename {any? spec-any?}])

sveri10:09:00

If that does not work I suggest you ask in #clojurescript on how to exclude / rename either of these functions, they probably know best πŸ™‚

dev-hartmann10:09:00

that's a pretty good idea

sveri10:09:37

@dev-hartmann yea, np, I am curious, just choined #clojurescript, I want to know it myself πŸ˜„