This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-10
Channels
- # admin-announcements (2)
- # arachne (2)
- # beginners (53)
- # boot (52)
- # cider (7)
- # cljs-dev (61)
- # cljsrn (12)
- # clojure (61)
- # clojure-greece (22)
- # clojure-nl (16)
- # clojure-russia (103)
- # clojure-spec (84)
- # clojure-uk (15)
- # clojurescript (137)
- # community-development (14)
- # cursive (4)
- # datomic (14)
- # devcards (6)
- # euroclojure (3)
- # funcool (26)
- # hoplon (27)
- # jobs (4)
- # lambdaisland (1)
- # leiningen (1)
- # om (75)
- # onyx (77)
- # planck (15)
- # proton (2)
- # re-frame (23)
- # ring-swagger (9)
- # schema (1)
- # specter (95)
- # untangled (124)
- # yada (27)
is this the way to create a namespaced keyword from a string with the namespace being the one of the source file the keyword is being created in? (keyword (str *ns*) "aka")
Hence a new Object with a different implementation of toString is returned. Since str is called which in turn calls the toString on that method a new value is returned. Am I right on this?
Hi is it possible to build in boot clj, in easy way, a whole package with jar+log.xml file and a few bash scripts?
some question, what is the difference of ::something and :something ?
If both are equals, when I use each idiomatic expression ?
I didn't got it 😕
:something is always equal to :something no matter the namespace where you compare them
::something
reads as :the.current.namespace/something
thanks..
@stuartsierra I am your fan man ... nice work ... 🙂
Thank you.
Is there an easy way to do exponents using core Clojure functionality?
hey guys, quick question: Are there any guidelines for when to return lazy seq as opposed to eager ones? I am creating a lib, and I can't decide whether lazy or not lazy. The problem is that if I make it lazy, the results are not properly ordered which is not so nice as a return value. But being lazy gives it a speed boost as not everything has to be computed
@yogidevbear: (Math/pow 2 3)
;; => 8
Thanks
@carocad: In general, if there is an advantage to the user in having a lazy sequence, then that is what you should return.
But it is important to remember that lazy sequences are not always 100% lazy. For example, functions like map
have optimizations which may cause them to realize more values than the consumer used.
If you truly want to leave the user in control of how many values get produced, then you probably want a pull-oriented API in which the user has to ask for the next value. It is trivial to build a lazy sequence on top of that.
I'm trying to wrap creation of various randomization algorithms (using apache math classes) into multimethod
how to avoid use of map as a function parameter or in other words: how to force multi-arity in defmethod?
the part after the dispatch value in a defmethod can be anything that goes after the (fn ... for a function
or you could (defmulti make-randomizer (fn [m & args] (:algorithm m)))
which allows all defmethods to define whatever arities they want
sorry didn't see that question
tsulej: yeah a macro is the only way to factor out that part without reflection
you don't need the indirection of having the macro create a function
(defmacro multiarity-new [cl arg]
(let [arg# arg] (if arg# (new cl arg#) (new ~cl))))
(defmacro multiarity-new [cl arg]
(let [arg# arg] (if arg# (new cl arg#) (new ~cl))))`
compilation
I have two simple macros. I’m trying to add metadata to a function var. The first one doesn’t work, while the second does. Anyone knows why?
magnus: I don't have time to explain, but using ~(vary-meta x assoc :a :b)
should work
general macro stuff is highly relevant
@magnus using a backquote expands to clojure code that appends unquoted expressions into the desired location. Using a regular quote and THEN a backquote lets you inspect what it's doing behind the scenes.
user> ' ` ^:a a
(clojure.core/with-meta (quote user/a) (clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat (clojure.core/list :a) (clojure.core/list (quote true))))))
user> ' ` ^:a ~(symbol 'a)
(symbol (quote a))