This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-31
Channels
- # announcements (2)
- # beginners (208)
- # boot (4)
- # calva (5)
- # cider (3)
- # clojars (3)
- # clojure (59)
- # clojure-dev (27)
- # clojure-india (2)
- # clojure-spec (46)
- # clojure-uk (3)
- # clojuredesign-podcast (4)
- # clojurescript (11)
- # cursive (10)
- # emacs (2)
- # figwheel-main (3)
- # off-topic (73)
- # onyx (1)
- # re-frame (8)
- # reagent (3)
- # rewrite-clj (12)
- # shadow-cljs (29)
- # spacemacs (1)
- # tools-deps (19)
What am I missing?
user=> (defn same-suit?
#_=> [c1 c2]
#_=> (= (:suit c1) (:suit :c2)))
#'user/same-suit?
user=> (same-suit? a b)
false
user=> a
{:suit :diamond, :rank 2}
user=> b
{:suit :diamond, :rank 3}
user=> (= (:suit a) (:suit b))
true
What did you expect @srijayanth ?
ah darn
the typo 😄
Nevermind. Missing semi-colons are one thing, but superfluous colons…
LOL I just typed that all into the REPL and repro'd and I'm looking at it going "What the..." and then I noticed the :
🙂
Clojure is a concentrated language. I suggest you that at these times, step-back, take a deep breath and look again. @srijayanth. Do not forget breaks and long breaks while you work.
@scknkkrer - thanks.
How do I get access to the Clojure Jira to report a bug? I used to have an account, but I'm no longer able to access it after the migration to http://id.atlassian.com
http://ask.clojure.org is how to raise issues now
The current recommendation is to create an item at http://ask.clojure.org, and Clojure devs will create a JIRA issue if they believe it is a good idea.
Did you try the "code sample" button above the text box where you enter your question, that looks like double quotes?
Sorry, it looks like curly braces
Yeah, seems to only work with one liners, and didn't support a backtick in the sample
Hello, i’ve got a naming challenge for you 🙂
(fn [func]
(fn [& args]
(fn [this] (apply func this args))))
‘func’ can be viewed as a method implementation of ‘this’, ‘args’ are arguments to this method.
funky-curry
?
Actually flippin-funky-curry
@srijayanth not bad!
I notice that clojure.server
is designed to contain multiple socket repl servers. Is the typical use case to have one or multiple?
I hadn't noticed that the Clojure version it supports multiple ports, so just didn't implement it.
@U04VDQDDY Did you implement any special keywords to exit the REPL or just Ctrl-c?
why is the servers
var used together with alter-var-root
instead of just using an atom to administer them?
because you need locking to handle the thread control in tandem with the state updates
Not sure if I understand it correctly. If you would use an atom, what could go wrong? E.g.:
(swap! servers assoc name {:name name, :socket socket, :sessions {}})
instead of (locking lock (alter-var-root! #'servers ...))
?there's at least one spot where we are coordinating both shutdown and servers state update and we'd like that combo to be combined. and if doing it at one spot, you need to do it at all.
I guess also one issue is when stopping a server, you don't want to have the side effect of closing a socket happen multiple times (which can happen when using swap!
)
Is there a recursive descent reduce function available in spec? I'm writing a query DSL in using spec and my interpreter needs to pick various bits out of the parse tree. I wrote a recur-reduce fn that is specific to my DSL but it seems to me that spec has all the info it needs to generate one
a few different options - tree-seq + filter, clojure.walk/prewalk, clojure.zip traversal with next/end?
Maybe those would work but that's not how I was thinking of the problem. The public "execute" fn of my DSL first conforms the input DSL, the rest of the code operates on the result of the conform operation so i'm working with a nicely regular parse tree. Generic functions like tree-seq, prewalk, etc operate at the data structure level where I want something that operates at the syntax node level.
What is the best way to convert namespaced map to a map which is not namespaced?
@karol.wojcik traverse the map and replace all namespaced keys with non namespaced versions
Hello, when using defrecord
to implement a Java interface that has an overloaded method (with 1 and 2 arguments), how to do that? As if it was Clojure fn with multiple arities or as 2 separate functions??? Thank you!
Something like:
(defrecord MyRecord []
JavaInterface
(method [this arg] ...)
(method [this arg1 arg2] ...))
B/c they are separate in Java
Hello, how should I require this library https://github.com/worldturner/medeia-validator ? I added it to deps.edn and it gets installed but don't know how to require it yet
@drojascamaggi It's not Clojure so you don't require
it. You can import
classes from it tho'.
There are examples in Java and Kotlin, e.g., https://github.com/worldturner/medeia-validator/blob/master/medeia-validator-java-examples/src/main/java/com/worldturner/medeia/examples/java/jackson/objects/ReadObjectExample.java -- so you'd use it in Clojure via interop, like any other Java library...