This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-15
Channels
- # announcements (13)
- # beginners (106)
- # cider (70)
- # cljdoc (1)
- # cljsjs (1)
- # clojure (97)
- # clojure-finland (1)
- # clojure-italy (13)
- # clojure-mexico (16)
- # clojure-russia (1)
- # clojure-spec (53)
- # clojure-uk (146)
- # clojurescript (44)
- # core-async (5)
- # cryogen (1)
- # css (1)
- # cursive (11)
- # datomic (89)
- # duct (10)
- # emacs (4)
- # figwheel-main (58)
- # fulcro (5)
- # hispano (35)
- # hyperfiddle (1)
- # jobs (2)
- # jobs-discuss (1)
- # lambdaisland (1)
- # leiningen (3)
- # off-topic (13)
- # onyx (50)
- # parinfer (3)
- # pedestal (4)
- # reagent (9)
- # ring-swagger (56)
- # rum (3)
- # shadow-cljs (85)
- # spacemacs (4)
- # vim (4)
@joshua.d.horwitz @eigenhombre @dbernal Just to close the loop here - the default repo is hosted by a Fastly CDN. I suspect they were having some temporary issues.
Thanks @tcrawley!
@emccue try already has an implicit do
when I wrote that macro I used (catch Exception _#)
bodies with nothing in them return nil
shell script for calling the structural diff library autochrome
like git diff
.
Library: https://github.com/ladderlife/autochrome Readme: https://fazzone.github.io/autochrome.html
I'm trying to get tools.cli to parse an option with the config: [["-ph" "--proxy-host HOST" "Proxy host"]]
, but it interprets the short version as two unknown flags -p
and -h
. Is there a way to make -ph
work?
Question about tools.deps
/ clj
. I'm trying to use a :gen-class
namespace with tools.deps, but haven't been successful so far. I have to go back to boot to get what I want (i.e. compile a namespace). Is there a way to get tools.deps to support :gen-class
namespaces?
Built-in, no - tools.deps is designed for projects that don’t require a build step and their deps
You could explicitly invoke compile and include the output dir as two commands
Cool, thanks. I'll experiment a bit to find a workable option
@U064X3EF3 The following works for me. If I compile my subproject with boot (and a deps.edn file) like follows
boot -d seancorfield/boot-tools-deps:0.4.5 deps aot -a target
And when I add the dir target
to the classpath the depending projects don't need to compile anything:
{:paths ["resources" "src" "target"]
...
}
@dominicm is this what you’re looking for? https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1157-L1177
That appears to convert ~
to (clojure.core/unquote ...)
. But how does unquote do something?
if you search for “unquote” in LispReader.java you can see all the places where it is handled
It’s all in the reader
quick experiment using tools.deps in docker such that it could be used in a shell script (long story, it makes sense in a specific infrastructure)
justin.smith@C02RW05WFVH6: ~/ledger$ docker run -i clojure:tools-deps-1.9.0.381 clojure -e '(def important :a)' - << HERE
> (defn go
> []
> (println important))
>
> (go)
> HERE
#'user/important
:a
hi guys
how can reset atom to it's default state ?
(def hello (atom {:hello nil :world []}) ; default state
now doing some processing and want to get back to default state again how can i do this?
something like copy object in OOP
you can use reset!
if you don't care about what some other thread is doing with the data
to be clear, the "default state" would be a concept in your code but not actually built into the atom itself
but if i have an atom with default values which behave as initial values
thanks guys got it
Seems like gorilla-repl is a bit unmaintained these days. Are there alternative notebook style environments that support CLJ/CLJS?
@fingertoe Nextjournal does support both (and is written in it). But support isn’t as easy as we’d like it to be yet, see or remix https://nextjournal.com/schmudde/repl-driven-development for how to add deps currently. If you’d like to give it a try, use the invite code curryon2018
to signup.
is there a good walkthrough of wiring lacinia up to a ring app outside of pedestal? specifically I want to use graphiql and have a schema available like with apollo
please remind me someone: what's the syntax for defining fixed arity anon fn, eg. #(foo)
with fixed arity, of say 2 args, meant for java interop, there was some special syntax for that, in front of the # or between the # and (, not sure
yeah, you can, they become Runnable
or something, not sure how this works with arguments
@skrat, how about (fn [_ _] *do stuff* )
@smith.adriane of course, I'm just nitpicking here, and I'm quite sure there is a syntax for this 🙂
ah, yeah I had that issue too and I just did what skat did in the past if I recall correctly.
user=> (supers (class (fn [_] _)))
#{clojure.lang.IFn java.lang.Runnable clojure.lang.IObj java.io.Serializable clojure.lang.IMeta clojure.lang.AFunction java.util.concurrent.Callable java.util.Comparator java.lang.Object clojure.lang.AFn clojure.lang.Fn}
user=>
you may be thinking of memfn, but don't think about it, it is a best forgotten thing that existed before the #()
short hand syntax did
the only form I’ve seen with the #
type of anonymous function is (#(do %1 (+ 1 2)) 1)
for specifying arity
but all that is silly, better to use (fn [& _] ...)
or similar as already recommended
you are type hinting the value returned when looking up the name + with with the gensym the reader creates
slightly less gross, but still, what are you even doing? just write some code people will be able to read
cljs$user$thing(p1__50868_SHARP_,p2__50869_SHARP_,p3__50870_SHARP_,p4__50871_SHARP_,p5__50867_SHARP_){
return ((1) + (1)).call(null);
}
yupyeah, not sure I'd call it side effecting, but it makes it recognize 4th arguments being used, and creates arity 4 fn
yes, #(do %2 ...) does as well, but why not (fn [ ] ...)