This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-02-19
Channels
- # beginners (7)
- # boot (48)
- # clojure (50)
- # clojure-portugal (1)
- # clojure-russia (10)
- # clojure-spec (29)
- # clojure-uk (9)
- # clojurescript (116)
- # core-logic (1)
- # cursive (12)
- # datascript (2)
- # datomic (7)
- # defnpodcast (8)
- # dirac (80)
- # emacs (486)
- # hoplon (5)
- # instaparse (3)
- # keechma (1)
- # luminus (3)
- # lumo (35)
- # off-topic (65)
- # om (6)
- # onyx (6)
- # perun (42)
- # re-frame (5)
- # reagent (5)
- # rum (2)
- # untangled (170)
- # vim (13)
I have a java object that's being created by a factory class, so I'm not directly instantiating it. I'd like to add some state to the object, just a simple integer field, and maybe getter/setter for this field. I can proxy
or gen-class
a new type, but is there any way I can actually add state and methods, given that I do not directly create the object?
Hello, which libraries are used to do database work? I found java.jdbc package, is there any widely-adopted layer above it? Just trying to figure out what's the standard approach.
@sgdread Many options. One of the latest offerings is toucan. https://github.com/metabase/toucan
is there a cleaner way of writing:
(doseq [[x y] (map vector xs ys)]
...)
it seems like there ought to be a shorter way of writing thisso I think doseq would exec the assertions wheras map would create a lazy list which does not exec the assertions until they are needed
you can wrap it in doall
but I’m not sure if it’s more readable than you initial expression
while clever ppl are here, is there a hsorthand for (every? identity ...)? it's basically (apply and ...) but I can't do the latter becaseua nd is a macro not a function
@residentsummer it does work better because (did not put this in original question), the (fn [ x y] ... ) is an existing function which has a simple name, so it ends up being (map foo xs ys)
qqq: looks like (every? identity …)
is the best option...
I wonder why every?
does not have unary variant though
@qqq http://dev.clojure.org/jira/browse/CLJ-450 drowned in bureaucracy
how can I run a REPL session in my code directly? Say, I have a (try-catch) block and I'd like to run REPL in catch clause in my current ns. Thanks.
You can start a repl server using functions in clojure.tools.nrepl
This code should help you get a sense of how https://bitbucket.org/wsnetworks/env-repl/src/87935b133d7c20db1732b30354ea13dfa12b8599/src/ws/env_repl.clj?at=master&fileviewer=file-view-default
I'd like to have the following:
(try (call-my-func) (catch Throwable _ (repl/start)))
when repl/start
is called, a new interactive REPL session is started, so I can check the exception content. Then I interrupt it and the programm continue to execute.
unfortunately I don't think it's possible to do it to the extent python does. the JVM optimizes away a lot of things (like locals), so I don't think it's possible to just fire up a repl in the context of where an exception is thrown.
But you could start a global repl via https://clojure.github.io/clojure/clojure.main-api.html#clojure.main/repl
@qqq so in your example earlier, mapping vector
-- you said that you are running assertions, presumably to ensure that the resulting data is valid. But where are you performing the assertions?
ah, so in the doseq
block itself -- but then you don't get to hold on to your result, but i guess that's stuff you've already worked out
I’m attempting to integrate a servlet (from Auth0) into a clojure app. It requires context-params
be set in web.xml
Does anyone have any pointers here to make it work? I’m following this guide: https://auth0.com/docs/quickstart/webapp/java
Looks like they have a java library which I could use instead. https://github.com/auth0/auth0-java
can you write a spec for a protocol? something like:
(defprotocol Foo []
Bar
(s/fdef bar ...)
(bar [this x] ...))
Hello everyone. Just wanted to say hello! Just starting my clojure journey. Very excited, and looking forward to meeting some of you.
@U46T0D7ED same. I've been listening to a lot of talks by Rich Hickey. I keep hearing more good things about the language.
@U46LM0HR6 Seriously. I know i have a decent learning curve ahead of me, but i feel like the end will justify the means. It just seems so rich in possibilities and how it can do a lot in less code just blows my mind.
For what it's worth, the learning curve for Clojure is a lot smaller compared to several other languages. That's been my personal experience at least.
That's interesting to hear, @U08PR8LJZ. What was your language background prior to Clojure?
@U050CT4HR I actually consult. So I've written code in several languages.. Ruby, Java, Clojure, Scala, C# ... To name a few. Clojure was the simplest for me to wrap my head around. The biggest obstacle was getting used to functional programming. But once you figure that out, things fall into place
I'm curious, did you have any editor woes when you were first getting started? I know that can be an obstacle for new Clojurians.
@U050CT4HR yup! Luckily though, you can find a nice groove in a few different editors once you've established the plugins. I prefer vim. With a few different plugins added to it for Clojure specifically. I've been testing out Atom more recently and I like that as well. I hear good things about Cursive, but there is a price tag with that.
@U08PR8LJZ thanks. I kinda feel like since i don't have a ton of previous programming experience it won't be as hard as say, having years of experience, and then learning clojure. Not sure if this is true though haha.
I used to be a TA for Northeastern University's introductory computer science course which was taught in a dialect of Scheme. Our experience was that students who did and did not have prior programming experience faced different challenges, though it was hard to say which whose challenges were greater.
@U050CT4HR thanks!