This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-29
Channels
- # ai (2)
- # beginners (12)
- # bitcoin (1)
- # boot (41)
- # chestnut (5)
- # cider (9)
- # clara (24)
- # cljs-dev (11)
- # clojure (107)
- # clojure-dev (2)
- # clojure-italy (4)
- # clojure-nl (4)
- # clojure-russia (10)
- # clojure-spec (19)
- # clojure-uk (71)
- # clojurescript (121)
- # cursive (3)
- # data-science (7)
- # datacrypt (1)
- # datomic (72)
- # docs (7)
- # duct (2)
- # emacs (3)
- # ethereum (1)
- # figwheel (1)
- # fulcro (58)
- # graphql (16)
- # hoplon (9)
- # jobs (2)
- # jobs-rus (1)
- # lein-figwheel (1)
- # leiningen (25)
- # luminus (2)
- # lumo (5)
- # off-topic (6)
- # onyx (22)
- # pedestal (3)
- # portkey (1)
- # proton (2)
- # re-frame (7)
- # remote-jobs (1)
- # ring-swagger (3)
- # rum (2)
- # shadow-cljs (38)
- # specter (7)
- # yada (30)
Sorry, wrong thread. Moving to #beginners
I need to generate an image by: 1. adding some text 2. adding some salt & pepper noise 3. add some gaussian noise 4. distort the image a bit 5. write it out as a png is quil the right library to use for this, or should I use something else ?
how do I convert "GrayF32/class" to clojure ? GrayF32 image = UtilImageIO.loadImage("test.png",GrayF32.class);
is there a way to coax cider to allow inspection of return values in the repl like SLIME? currently it seems any value returned is just syntax highlighted but is otherwise a just a string in the buffer.
how can i print to the console from .cljc files? neither js/console.log
and println
work (which is understandable as we're not specifying a build target)
You can use something like (:require [#?(:clj clojure.spec.alpha :cljs cljs.spec.alpha :default clojure.spec.alpha) :as s]) to support both clj and cljs specific funtionality
(enable-console-print!)
Good day to all: I've encountered a namespace loading failure when using cloverage, which I'm not sure how to debug Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration missing, compiling:(/tmp/form-init5334710656729606392.clj:1:73
The tmp
files does seem to exist anymore so I cannot inspect /tmp/form-init5334710656729606392.clj:1:73
and the Exception trace doesn't address any lines of my own code... I'm a bit stumped tbh
Does anyone know if temporary files like /tmp/form-init5334710656729606392.clj:1:73
can be retained somehow?
I cannot find any obvious omissions of parameter declarations within my (defn ...)
's
Well, that wasn't much fun. By nuke all test namespaces and progressively removing clj files from my project, until cloverage worked I isolated the problem to a (defn exist-until)
- silly me.
Still it would be nice if these kinds of issues were easier to isolate - open to ideas
Seems like I was half-way through implementing a function I thought I'd need, but ended up not using it and since it was not referenced the application concerned compiles and runs fine.
But clearly cloverage
wants to instrument everything, regardless of whether code is used or not...
Actually, it turns out the function was the only (defn ...)
within a new clj
file I'd created, that was not being required by any other namespace - doubly silly me. Which is why lein run
was not picking it up.
When I actually require said file, I see a helpful error message that would have enabled me to isolate the problem a lot quicker Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration missing, compiling:(xxx/xxxx/xxxxxx/domain.clj:13:1)
- just in case anyone is interested.
Hi @alexmiller, I'm reading through this article of yours on sequences and was wondering what you meant by "logical" when you said: >Sequences are logical lists http://insideclojure.org/2015/01/02/sequences/
Unlike other lisps, Clojure has an abstract representation of a list. Instead of saying a list is a cons cell, in Clojure a "list" is something that implements ISeq
clojure.lang.ISeq, a interface that defines a "first" and "rest" method.
Seq - something that conforms to ISeq. May be a bunch of cons cells, may be an view over a collection, etc
Seqable - something that isn't itself a seq, but can be converted to a seq
List - a list is technically a PersistentList which is a ISeq that also implements some other features (like O(1) counting).
So all that to say, "logical list' is a way of saying all of that ^^ while also showing that Clojure defines lists a bit differently from other lisps, or even Java.
Thanks @U07TDTQNL 👍 Going to read that a few times over to let it sink in
@yogidevbear I'm not @alexmiller but I read this as "conceptually", i.e. something that conforms to the concept of a list, even if it may not be implemented as a classical Lisp list (cons pairs)
I wrote a spec for a function, but spec can't create a generator for it. Is there any way to provide the generator for that function to spec ?
@yogidevbear Perhaps this will help, https://clojure.org/reference/lazy "A seq is like a logical cursor"
Is there a way to run read-string
to get the from from a string without evaluating the defs?
So like something to wrap around (read-string (defn inc [x] (+ x 1)))
so that clojure.core/inc doesn’t get overwritten?
that doesn't make much sense, read-string operates on strings not on data and doesn't do any evaluation
Funny, I thought (read-string "(def inc (fn [x] (+ x 1)))")
would overwrite inc but it doesn’t seem to
Something fishy’s going on in my code. Somewhere the def is being evaluated, but I thought it was just being read…
Ok, so my problem wasn’t with read-string. @bronsa, is there a way to do (e/emit-form (ana.jvm/analyze '(def inc (fn [x] (+ x 1)))))
without overwriting clojure.core/inc?
Very intrigued by what @chalcidfly might be working on 🙂
@the2bears still in the initial research/brainstorming phase, but I hope to have something releasable within a month
@bronsa so it’s not really possible without forking and extending the lib?
@bronsa I see. If I end up going down the road, can I dm you for help? 😛
haha of course 🙂
- clojure needs to intern vars at analysis time, to support expressions like (def a (fn [] a))
, so that the var a
is reachable in the intialization body of the var def
- t.a provides a configurable create-var
function that you can replace with a no-op, so that the var won't get interned
- because t.a resolves vars using its global env map rather than inspecting directly clojure's reified namespaces, so that if you want you can make that expression analyzable w/o actually interning anything
however
- because side-effects can happen at macroexpansion time, including var interning and var unmapping, t.a. needs to rebuild its namespace map from clojure's reified namespaces after every macroexpansion (yes, there are actually libraries that do this sort of stuff, ugh)
- this means that the var assoced into t.a's namespace map will be dissoced after the first macroexpansion if it's not actually interned
- to work around this, the function responsible for updating t.a's namespace map is pluggable, thrugh a function under the :update-ns-map!
key in t.a.jvm's global-env, so that you can provide your own that ensures the non interned var is kept around
understanding all this requires some knowledge of how clojure's evaluation model works and some understanding of tools.analyzer's implementation
all this complexity is unfortunately unavoidable, since clojure's evaluation model wasn't designed with ease of analysis in mind
good heavens, that is complicated…
I need to save that somewhere
Is there a way to refer to unqualified void
in a syntax quote context?
isn’t that just nil?
I don’t think void means anything in clojure
I thought it did in gen-class
oh - gen-class probably wants the symbol
so in a syntax-quote, use
`(... ~'void)
it might ignore the namespace qualification I should test
ah there it is
many thanks
that would be handy, but usually the unquote / quote combo does the trick otherwise
that was exactly what I needed
don’t have to test
Lotta questions from me the last couple days. Got one more.
Is there a way to check if eval will work on a variable?
Something like evalable?
@chalcidfly you could see if resolve returns non-nil
user=> (resolve 'inc)
#'clojure.core/inc
user=> (resolve 'foo)
nil
I don’t know what you mean by variable though
do you mean symbols that may be bound to a var or a local? just vars?
are classes included?
Oh, I mean a form
So like true for (+ 2 2) but false for 5
Maybe seqable would do it?
but you can eval 5
user=> (eval 5)
5
Hm.. I guess eval isn’t really what I need then
do you want to know if something is fully simplified?
eg. in (case x (1 2) :a :b)
(1 2)
is fully simplified (one of the few places something that has parens inside it would be such)
Well in this case, I want a trigger on both
Both the outer form and the inner simplified form
OK but you’ll have gotchas for case and any other macro that treats parens oddly
(depending on how you’re doing this simplifying and whether the language you are supporting is actually clojure or not)
One last syntax quote context question of the day 😀.. I am trying to construct a map from a collection of forms
{~@yes-i-am-an-even-numbered-collection}
but I receive a compiler exception Map literal must contain an even number of forms
trying that now… my forms might be angry for another reason. thanks!
nah, hash-map
was the ticket…
@lxsameer There is a #clojure-spec room. There are many ways to have specs referencing specs, such as: (s/def ::checks (s/coll-of ::depend))
(`::depend` is a spec)