This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-17
Channels
- # aleph (2)
- # announcements (20)
- # aws (43)
- # aws-lambda (5)
- # babashka (9)
- # beginners (231)
- # calva (4)
- # cider (12)
- # cljdoc (8)
- # cljsrn (3)
- # clojure (47)
- # clojure-europe (5)
- # clojure-nl (4)
- # clojure-spec (41)
- # clojure-uk (47)
- # clojuredesign-podcast (3)
- # clojurescript (20)
- # cryogen (3)
- # cursive (4)
- # data-science (2)
- # datomic (15)
- # emacs (4)
- # fulcro (21)
- # jackdaw (6)
- # jobs (1)
- # joker (13)
- # juxt (8)
- # kaocha (10)
- # malli (7)
- # off-topic (29)
- # pathom (11)
- # re-frame (19)
- # reagent (3)
- # reitit (26)
- # remote-jobs (8)
- # schema (2)
- # shadow-cljs (112)
- # spacemacs (1)
- # tools-deps (49)
- # vim (2)
- # xtdb (7)
(or (str/replace main-class "-" "_")
"clojure.main")
I bet this should be (if main-class (str/replace main-class "-" "_") "clojure.main")
- just in terms of the behavior of and / str/replace https://github.com/seancorfield/depstar/blob/master/src/hf/depstar/uberjar.clj#L264haha you know what I'll just make that PR :D
Yeah, that's my bad from a fix I added in 0.5.1 😞
I need to do better testing!
luckily it looks like a shallow bug
@seancorfield on the plus side, I saw serious flaws with the other deps.edn jar / uberjar packagers that this lib avoids, that's why it's worth trying to make this one work
Workaround, until I get 0.5.2 out: specify -m
/ --main
🙂
makes sense
This will be a good opportunity for me to switch my deploy process over to @slipset’s deps-deploy
instead of mvn
🙂
@noisesmith Please try seancorfield/depstar {:mvn/version "0.5.2"}
to see if that works
Thank you for the PR!
Assuming I have two lists like [1 3 4]
["a" "b" "c"]
and I'd like to create something like [1 2 3 4]
and ["a" nil "b" "c"]
is there an idiomatic solution to that? I basically want to fill in the blanks with nils. Bit of a code golf I guess 🙂
My solution was to zipmap the first two structures, then map get
over that against (take (range) (count x))
zipmap seems a good solution, not sure what you need the get for:
(let [a [1 3 4]
b ["a" "b" "c"]]
(map (zipmap a b) [1 2 3 4]))
Hello Folks! I'm adventuring myself on java/clojure interop and i would like to ask something.
I create a function to create a temporary .docx
file (Huge thanks for @noisesmith for the suggestion)
(def tmp-dir (io/file (System/getProperty ".tmpdir")))
;my function
(defn create-temp-file []
(File/createTempFile "temporary" ".docx" tmp-dir))
;the return of it
#object[.File 0x25209e59 "C:\\Users\\JDOE\\AppData\\Local\\Temp\\temporary1235918644188287069.docx"]
I would like to get the path that is generated when i create my file to read this .docx
. I tried a deconstruct but it returns me a nil, probably because i'm having a object, not a vector.
Anyway, if you folks have some approach for it, i appreciate.you want to get the path of a http://java.io.File?
Yes, looking on it, i saw that i can use (. (object) getPath)
I don't know if it's the best approach
https://docs.oracle.com/javase/8/docs/api/java/io/File.html#getCanonicalPath-- this looks like a good method on http://java.io.File. and you would call (.getCanonicalPath your-file)
Sure, let me check that
Does anyone know of a clojure.test extension lib that lets you do something like this?
(deftest foo-test
(is (match= {:a [_ {:a "a"}]}
some-data)))
I want to test equality for everything but the _
.usually I just use get-in for that, I'm sure there's a test lib with a macro for it
Yeah, I could do that. It just means I need to dissect the whole map to test it, which is fine I suppose.
here's an approach using get-in and are
user=> (let [target {:a {:b :c} :d {:e [:f :g]}}]
(clojure.test/are [path d] (= (get-in target path) d)
[:a] {:b :c}
[:e 0] :f))
FAIL in () (NO_SOURCE_FILE:1)
expected: (= (get-in target [:e 0]) :f)
actual: (not (= nil :f))
false
user=> (let [target {:a {:b :c} :d {:e [:f :g]}}]
(clojure.test/are [path d] (= (get-in target path) d)
[:a] {:b :c}
[:d :e 0] :f))
true
Expectations lets you use a destructuring binding which would get you close...
user=> (require '[expectations.clojure.test :refer [expect more-of]] '[clojure.test :refer [deftest]])
nil
user=> (deftest example
(expect (more-of {[_{:keys [a]}] :a}
"a" a)
{:a [42 {:a "a"}]}))
#'user/example
user=> (example)
nil
(as long as you're comfortable using nested destructuring!)
I like https://github.com/metosin/testit . A combination of =in=>
and any
should work.
That's pretty neat too! I don't think mixing the midje syntax with a code base that pretty much exclusively uses clojure.test syntax is a great idea though 😬
Another possibility with Expectations:
user=> (deftest example
(expect (more-of {:keys [a]}
{:a "a"} (in a))
{:a [42 {:a "a"} :other :stuff]}))
#'user/example
user=> (example)
nil
This just expects {:a "a"}
to be any one of the elements in the vector value for :a
at the top level.(if you want an "exact" match of the structure with no extra keys or values, that's not going to help you tho')
http://github.com/nubank/matcher-combinators is great too and lets you do exactly that
(require '[matcher-combinators.test :refer [match?]])
(deftest foo-test
(is (match? {:a [any? {:a "a"}]}
some-data)))
there are definitely helper libs (juxt/aero, outpace, environ), that allow various mixes of environment variables, jvm system properties, and config file parsing / merging
you'll likely find one of them more aesthetically pleasing than the others
We liked features from several config libs so we wrote our own(!) but it currently has some World Singles Networks' specific code so I haven't gotten around to open-sourcing it yet...
Hello folks! Anyone here have experience with Clojure + AWS Lambda?
@matthewlisp Ask in #aws or #aws-lambda
Thanks :)