This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-19
Channels
- # announcements (5)
- # beginners (40)
- # cider (3)
- # clara (8)
- # cljs-dev (2)
- # cljsrn (4)
- # clojure (8)
- # clojure-spec (24)
- # clojure-uk (4)
- # clojurescript (3)
- # cursive (6)
- # data-science (3)
- # datomic (53)
- # emacs (3)
- # figwheel-main (11)
- # fulcro (37)
- # lein-figwheel (17)
- # off-topic (13)
- # parinfer (1)
- # re-frame (9)
- # reagent (2)
- # remote-jobs (7)
- # shadow-cljs (75)
- # tools-deps (4)
- # yada (16)
anyone know how to pass an env
to resolve
?
i'm having trouble finding documentation about what a clojure env
is
"clojure env environment" is a particularly difficult google search 🙂
@michael740 It looks like it is just a map. Check out (source resolve)
and (source ns-resolve)
I don't think it's a map, since you can't pass a map to contains?
it's a collection.
oh, nvm... (contains? '{k v} 'k)
works just fine
&env
is one of the 'special variables' available to macros: https://clojure.org/reference/macros#_special_variables
=> (defmacro foo [] (prn &env))
#'boot.user/foo
=> (foo)
nil
nil
=> (let [a 2] (foo))
{a #object[clojure.lang.Compiler$LocalBinding 0x41fdf8ca "clojure.lang.Compiler$LocalBinding@41fdf8ca"]}
nil
(defn ^String return-string [] (str "hello, world!"))
The ^String
is a type hint for function return value of a metadata for function var?
@stardiviner Yeah, but in ClojureScript that would be (defn ^string return-string [] ...)
while in Clojure it would be (defn return-string ^String [] ....)
(Normally you wouldn’t hint in ClojureScript. The one case where it is even remotely common to put type hints on function return types in ClojureScript is for predicates, in order to avoid checked ifs (see http://blog.fikesfarm.com/posts/2015-12-04-boolean-type-hints-in-clojurescript.html).)
And the need to add function return type hints will be reduced further in the next release of ClojureScript where the return type is inferred.
@mfikes I see. Thanks
hey a question I have I just tried to make multiarity function like (defn myfun [number] (myfun number []) [number list] (...)) But obviously I can't do it as second version is not defined when first is trying to use Essentially I want to get function with 1 or 2 params, and if it is invoked with 1 param, then it is realized as calling itself with 1st param and default 2nd param... Or in other words, how do I supply "default" for params if they are not provided by call?
(defn myfun ([n] (myfun n [])) ([n l] ...))
Hello Clojurians, I’ve read a few articles about Yada, also received a guidance and recommendations by Ray, but somehow I’m unable to follow Yada’s the manual. Details: 1 - cloned edge and ran boot dev (inside edge dir) and I receive the following error:
giga@ubuntu:~/edge/app$ boot dev
java.lang.Thread.run Thread.java: 748
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 624
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1149
java.util.concurrent.FutureTask.run FutureTask.java: 266
...
clojure.core/binding-conveyor-fn/fn core.clj: 2022
boot.core/boot/fn core.clj: 1032
...
boot.core/construct-tasks core.clj: 986
java.lang.IllegalArgumentException: No such task (dev)
clojure.lang.ExceptionInfo: No such task (dev)
line: 3
2 - boot.properties:
#
#Sun Aug 19 02:23:39 PDT 2018
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_VERSION=2.7.2
BOOT_CLOJURE_VERSION=1.9.0
Tried on mac then then on Ubuntu in VM, result is all the same.@chokheli looks to me like edge is using deps.edn now. See the readme at https://github.com/juxt/edge/tree/master/app. Perhaps that is the problem?
Yeah, I received assistance by JUXT guys, I was following the manual which provides boot instructions.
But one thing that baffles me is why take away “instant reload on each save?” and implement explicit command to enter - (reset)
Guys do you use any lib for validating http post requests? I've created my own right now but would be good to see some other code to get some inspiration
is there a way to define a symbol in clojure such that it's re-evaluated each time it's invoked or named?
for example, this is evaluated just once (def my-random-number (rand-nth (range 10)))
alternatively, i could wrap in a fn
that's how it's actually done
(def my-random-number #(rand-nth (range 10)))
?
yeah, though for that specific example #(rand-int 10)
does the same thing
sweet, thank you sir
wow… @ryan.russell011 I came here to post the exact same thing
I am trying to find out if anything changed in the postgresql or jdbc library that might be causing the error
so I changed the dependency in project.clj to [org.postgresql/postgresql "42.2.4"]
... and it doesn't throw errors anymore. I haven't tested to see if it works.. but at least the repl didn't throw up on me.
I used a library to perforl the dsl and tried to run that code (I already had played with dsl and worked just fine…) but the error showed up again
@ryan.russell011 it worked just fine with this new version. Cheers!