This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-20
Channels
- # babashka (36)
- # beginners (26)
- # calva (1)
- # clj-kondo (10)
- # clojure (94)
- # clojure-europe (7)
- # clojure-uk (16)
- # clojurescript (5)
- # conjure (6)
- # data-science (8)
- # datomic (24)
- # events (1)
- # fulcro (11)
- # funcool (1)
- # graalvm (6)
- # malli (18)
- # nrepl (5)
- # off-topic (13)
- # parinfer (3)
- # reagent (3)
- # reitit (6)
- # shadow-cljs (14)
when defining a namespace, I can use (:require [some-namespace :refer [name1 name2 ...])
Is there a way to only list the names I DONT want to import instead?
I guess this is the :exclude
option ?
but apparently I must use :refer :all :exclude [...]
Is it really not allowed to define a function by giving its fully qualified name?
(defn clojure-rte.api-test/-main []
(clojure.test/run-tests 'clojure-rte.api-test))
I get the following error
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling test/clojure_rte/api_test.clj at (31:1)
{:clojure.error/phase :macro-syntax-check,
:clojure.error/line 31,
:clojure.error/column 1,
:clojure.error/source "/Users/jimka/Repos/clojure-rte/test/clojure_rte/api_test.clj",
:clojure.error/symbol clojure.core/defn}
Compiler.java: 6971 clojure.lang.Compiler/checkSpecs
Compiler.java: 6987 clojure.lang.Compiler/macroexpand1
Compiler.java: 7074 clojure.lang.Compiler/macroexpand
Compiler.java: 7160 clojure.lang.Compiler/eval
Compiler.java: 7131 clojure.lang.Compiler/eval
core.clj: 3214 clojure.core/eval
core.clj: 3210 clojure.core/eval
interruptible_eval.clj: 82 nrepl.middleware.interruptible-eval/evaluate/fn/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 665 clojure.core/apply
core.clj: 1973 clojure.core/with-bindings*
core.clj: 1973 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 82 nrepl.middleware.interruptible-eval/evaluate/fn
main.clj: 414 clojure.main/repl/read-eval-print/fn
main.clj: 414 clojure.main/repl/read-eval-print
main.clj: 435 clojure.main/repl/fn
main.clj: 435 clojure.main/repl
main.clj: 345 clojure.main/repl
RestFn.java: 137 clojure.lang.RestFn/applyTo
core.clj: 665 clojure.core/apply
core.clj: 660 clojure.core/apply
regrow.clj: 20 refactor-nrepl.ns.slam.hound.regrow/wrap-clojure-repl/fn
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 79 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 56 nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 145 nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
AFn.java: 22 clojure.lang.AFn/run
session.clj: 202 nrepl.middleware.session/session-exec/main-loop/fn
session.clj: 201 nrepl.middleware.session/session-exec/main-loop
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 834 java.lang.Thread/run
1. Caused by clojure.lang.ExceptionInfo
Call to clojure.core/defn did not conform to spec.
{:clojure.spec.alpha/problems [{:path [:fn-name],
:pred clojure.core/simple-symbol?,
:val clojure-rte.api-test/-main,
:via [:clojure.core.specs.alpha/defn-args
:clojure.core.specs.alpha/defn-args],
:in [0]}],
:clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2509
"0x1f2ac1cd"
"clojure.spec.alpha$regex_spec_impl$reify__2509@1f2ac1cd"],
:clojure.spec.alpha/value (clojure-rte.api-test/-main
[]
(clojure.test/run-tests
(quote clojure-rte.api-test))),
:clojure.spec.alpha/args (clojure-rte.api-test/-main
[]
(clojure.test/run-tests
(quote clojure-rte.api-test)))}
...stuff omitted...
it would seem so: https://github.com/clojure/core.specs.alpha/blob/master/src/main/clojure/clojure/core/specs/alpha.clj#L86
what is a simple symbol actually?
(defn simple-symbol?
"Return true if x is a symbol without a namespace"
{:added "1.9"}
[x] (and (symbol? x) (nil? (namespace x))))
seems to be a symbol whose namespace is nil
I wonder what the reasoning for that is. coming from Common Lisp, this seems really bizarre.
perhaps it is to maintain the invariant that the reader remain side-effect free ?
However, what does the reader do when it encounters
(defn some-ns/fname [] ...)
I.e., the reader parses that and hands it over to spec to verify, then spec calls simple-symbol?
on a symbol which is not simple. Did the parser actually create a symbol in the some-ns
namespace?my guess after looking at: * https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L305 * https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L408 * https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L416-L464 is that a symbol (fully-qualified, so with the namespace part) is created, but not in any particular namespace. it appears one can do this kind of thing:
user=> (symbol "hi/there")
hi/there
user=> (find-ns 'hi)
nil
so symbols can be created that are not associated with a namespace.
or if that demo was not so good:
user=> (symbol "there")
there
user=> (type (symbol "there"))
clojure.lang.Symbol
user=> there
Syntax error compiling at (REPL:0:0).
Unable to resolve symbol: there in this context
i find many things in clojure to be not so easy to determine reasoning for. sometimes there seem to be answers if an appropriate party is consulted.
I think the intention is to discourage you from creating symbols in another namespace, to keep things modular. If there is a symbol already, you can set it from 'outside' with alter-var-root. Hopefully someone with more knowledge can provide more detail.
Hi folks. what can cause this? :
Exception in thread "async-dispatch-1" clojure.lang.ArityException: Wrong number of args (3) passed to: clojure.core.async.impl.ioc-macros/put!
besides the fact that I dont have any put! <! >!
with 3 arity!you can use clojure.walk/macroexpand-all to see what code might be producing that problem
Thank you! but well its a huge project, How should i use it? @U7RJTCH6J
where did all this code come from?
i was thinking you would have some narrowed down portion of the code that you could macroexpand, and examine all the put! calls
is this clojure or clojurescript?
:thumbsup:
Did I get this right about datomic ions: When I deploy a web application, I can still modify the underlying system my main application runs on, because it's just an EC2 instance running linux under the hood?
I'm asking because i need libpython-clj
to run some python scripts on the backend as well, so I need to have a python environment on wherever my code will run