This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-16
Channels
- # aleph (4)
- # bangalore-clj (10)
- # beginners (39)
- # boot (24)
- # cljs-dev (66)
- # cljsrn (79)
- # clojure (39)
- # clojure-italy (7)
- # clojure-russia (6)
- # clojure-spec (4)
- # clojure-uk (1)
- # clojurescript (91)
- # core-async (1)
- # core-typed (2)
- # datomic (49)
- # hoplon (42)
- # lumo (2)
- # nyc (1)
- # off-topic (1)
- # parinfer (20)
- # pedestal (2)
- # reagent (4)
- # rum (14)
- # vim (2)
Hi, i'm building a small microservice worker that needs to access a database. I find myself writing some database helper functions which I know a different service I will write later will also have to use. What is the recommended way of seperating the helper functions out so I can use them from both apps?
@jlmr if they don't call for making a library out of them, I'd say duplicate them.
Learning to use the REPL with vim and fireplace. I did the Seesaw repl tutorial. The wen on to playing with some of my own stuff. I got this weird lower-case error:
user=> (use 'playground.core :reload)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: lower-case in this context, compiling:(clj_http/util.clj:97)
using this: (ns playground.core
(:require [clj-http.client :as client]
[cheshire.core :refer :all]))
It went away when I removed Seesaw from my project.clj.I posted this here because I could not find a seesaw or http channel and because I was LEARNING the REPL. 🙂
@llsouder lower-case
is a function in clojure.string
Looking at this some more, I see this message in the REPL:
WARNING!!! version ranges found for:
[seesaw "1.4.2"] -> [j18n "1.0.1"] -> [org.clojure/clojure "[1.2,1.5)"]
Consider using [seesaw "1.4.2" :exclusions [org.clojure/clojure]].
most of the time things written for older clojure versions can be made to work with a new clojure pretty easily, that version range warning is newer than 1.5, so the dev who specified a version range had never seen it
lein is just being opinionated about this dependency feature (since it can lead to things breaking even when you didn't change your project, just because the version range sees a new version), but it shouldn't automatically make something not work
which version of clj-http are you using?
@val_waeselynck Thanks, will do that for now. When would you consider it worth making a library out of it?
When you can express the rationale of the library in a sound, simple, non trivial way
also, a separate lib may making testing more manageable. plus if you're a beginner it may be useful to get the hang of lib development workflow. lein or boot?
@U0LGCREMU, sorry was offline for a couple of days. I'm using lein now.
Easiest way to update the :selection
key to true or false based on the label of the inner map?
[{:label "Users"
:display-order 1
:choices
[{:label "Login"
:description "basic login page"
:selection false
:display-order 1}
{:label "Reset/Forgot Password"
:description "link to reset password via email"
:selection false
:display-order 2}]}]
@josh_tackett with Specter: (setval [ALL :choices ALL #(= (:label %) "Login") :selection] :some-value your-map)
@schmee specter work for cljs?
just check the gotchas here: https://github.com/nathanmarz/specter#clojurescript
what about a good json libaray for cljs? @schmee
[{:label "Users"
:display-order 1
:choices
[{:label "Login"
:description "basic login page"
:selection false
:display-order 1}
{:label "Reset/Forgot Password"
:description "link to reset password via email"
:selection false
:display-order 2}]}
{:label "NLP"
:display-order 1
:choices
[{:label "ngrams"
:description "basic sentence delimiters"
:selection false
:display-order 1}]}]
@schmee what about like this ^^^?
(spector/setval [ALL #(= (:label %) "Users")
:choices ALL #(= (:label %) "Login") :selection]
true app-selection-list)
@schmee does that work? ^^^
Caused by: java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IObj
at clojure.core/with_meta (core.clj:217)
clojure.lang.ExceptionInfo: clojure.lang.Var cannot be cast to clojure.lang.IObj at line 614 file:/Users/jtackett/.m2/repository/com/rpl/specter/1.0.2/specter-1.0.2.jar!/com/rpl/specter.cljc {:file "file:/Users/jtackett/.m2/repository/com/rpl/specter/1.0.2/specter-1.0.2.jar!/com/rpl/specter.cljc", :line 614, :column 1, :tag :cljs/analysis-error}
@schmee nope didn’t work
(spector/setval [specter/ALL
#(= (:label %) (:label group-data))
:choices
specter/ALL
#(= (:label %) (:label selection-option-data))
:selection]
selection app-selection-list)
don’t know if this is the issue, but you have spector/setval
instead of specter/setval
is there an easy way to do something like (-> {} my-fun print my-other-fun print)
? i need print to return the value it prints for this to work, though
(-> {} my-fun (doto print) my-other-fun (doto print))
To make the anonymous function version work you need extra parens: (-> {} my-fun (#(do (print %) %)) my-other-fun (#(do (print %) %)))
because ->
just inserts the threaded value into the s-exp as the second item -- use macroexpand
to see what happens...