This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-28
Channels
- # ai (1)
- # beginners (239)
- # bitcoin (1)
- # boot (4)
- # cider (5)
- # clara (3)
- # cljs-dev (16)
- # cljsjs (5)
- # cljsrn (1)
- # clojure (152)
- # clojure-android (3)
- # clojure-dev (3)
- # clojure-greece (4)
- # clojure-italy (5)
- # clojure-spec (14)
- # clojure-uk (24)
- # clojurescript (81)
- # data-science (1)
- # datomic (47)
- # devcards (34)
- # docs (3)
- # emacs (6)
- # ethereum (1)
- # events (9)
- # flambo (5)
- # fulcro (11)
- # graphql (1)
- # immutant (3)
- # lein-figwheel (2)
- # leiningen (2)
- # luminus (6)
- # lumo (90)
- # off-topic (25)
- # proton (2)
- # re-frame (44)
- # reagent (5)
- # ring (7)
- # ring-swagger (11)
- # shadow-cljs (11)
- # spacemacs (6)
- # vim (13)
- # yada (25)
@seancorfield From https://dev.clojure.org/jira/browse/JDBC-37, > Clojure/core specifically wanted java.jdbc to move away from dynamically bound variables Is there somewhere the reasons for this are described?
Is that reasoning mostly from a library API’s perspective? Or are there reasons to not use a dynamic var to do transactions even within application code, where we’re fairly certain that the statements are actually on the same thread?
I've been trying to use core.match to match on the type of a Record but haven't been able to figure out the syntax. Does anyone know how to reproduce the following condp but with core.match? (defrecord A [a]) (defrecord B [b]) (defrecord C [c]) (let [x (B. 2)] (condp = (type x) A "A" B "B" C "C" nil))
try saying `A instead of just A
here the result of type x is a class
why not just specify condition as (type A) instead of A
nvm you're looking for core match solution
btw does anyone have a good library for continuations in clojure?
(ns server.snip.boof
(:import [boofcv.struct.image GrayU8]))
results in:
1. Unhandled java.lang.ClassNotFoundException
boofcv.struct.image.GrayU8
URLClassLoader.java: 381 java.net.URLClassLoader/findClass
DynamicClassLoader.java: 69 clojure.lang.DynamicClassLoader/findClass
ClassLoader.java: 424 java.lang.ClassLoader/loadClass
now, I know that I have the boofcv loaded (via boot). Is there some way, via the repl, to dynamically get a list of all the classes / packages loaded?classes are loaded on demand
jvm doesn't load classes which aren't used
how do I debug something like this? docs says:
[org.boofcv/all "0.26"]
pulls in all the jars/classes
and I'm trying to use http://boofcv.org/javadoc/boofcv/struct/image/GrayU8.htmlwell my IDE tells me all the jars I have in my build
and I can locate any class in those
your class is in ip
artifact
and that dep pulls it
did you restart repl?
when you add dependencies you need to refresh your environment
does anyone know of a good way of instrumenting middleware so that I can step-debug through a particular wrap-something
function. When I try C-u C-c-c
(cider instrument?) it sometimes seems to work, but often not. My guess is that when the system is started - changes to the function no longer work. I thought that I could perhaps call out to another function that works like identity
that I could then instrument?
I don’t know how helpful #cider was, but the root issue here is that if you call (wrap-foo x)
to make a handler, redefining wrap-foo doesn’t change that return value until you repeat that call - which likely means reloading the namespace in which the handler was wrapped after instrumenting the middleware
and, depending on how you start up your server, you might also have to restart it
Hello, I have several functions spec
ed with spec/fdef
and I can easily generate tests in the REPL with spec.test/check fn-sym
. How to integrate this functionality with clojure.test or clojure.test.check nicely without having to generate manually the inputs with prop/for-all
?
The guides at https://clojure.org/guides/spec#_testing and https://github.com/clojure/test.check don't show how to integrate functions spec'ed with fdef and clojure.test(.check)
Seems like spec.test is not really integrated with test.check and clojure.test, I would have to manually parse the result of fdef and pass it to clojure.test/report
:64-bit-architecture ;; => :64-bit-architecture
:energy-star/64-bit-architecture ;; => RuntimeError
it seems that if the name portion of a keyword would make a valid keyword then it should remain valid after adding a valid namespace portion
Hey guys. Hopefully quick question...
I'm trying to use java.jdbc with hugsql. Should work without a problem as far as I've read.
I've got my dbspec in place and if I pass this directly to one of my hugsql-generated functions, it works great
But if I attempt to (jdbc/get-connection dbspec) , I keep receiving an IllegalArgumentException saying that my PgConnection object is missing a required parameter
Yes, one moment
(def dbspec { :dbtype "postgresql" :dbname (env :database-db) :host (env :database-server) :port (env :database-port) :user (env :database-user) :password (env :database-pass) })
I honestly wish I knew - it doesn't tell me or give me any clue
IllegalArgumentException db-spec org.postgresql.jdbc.PgConnection@187eff88 is missing a required parameter clojure.java.jdbc/get-connection (jdbc.clj:374)
Relevant file from github: https://github.com/clojure/java.jdbc/blob/java.jdbc-0.7.1/src/main/clojure/clojure/java/jdbc.clj
have you evaluated each of the (env :...)
forms to ensure they are returning the value you are expecting?
@U11BV7MTK yes, they all appear to be exactly what I expect. The only questionable one was the port, because it probably needs to be an int. I've manually replaced that line with 5432, however, and that doesn't matter.... And as I said - if I pass this same dbspec thru a hugsql-generated function, it works as expected
I've looked at the docs and source for jdbc/get-connection, and I'm supplying all of the ones that are marked required - and since the same dbspec works thru hugsql, I honestly don't know what to do
Anyone else run into anything like that?
Let’s say I take a function, like (defn whatever [x] (+ x x))
, and a specific usage of this function, say (whatever 10)
, is there a way I can return the original function definition but with the args replaced? So in this case, (defn whatever [5] (+ 5 5))
?
Not sure what to call. Argument-replacement, some kind of static analysis or something
So like (replace-args [5] (partial whatever 10))?
Oh crap I meant (defn whatever [10] (+ 10 10))
@chalcidfly you can get close if you replace defn with defmacro and use macroexpand
what even do you mean 😄
but there’s definitely nothing baked in
(defn whatever [10] (+ 10 10))
wat
@reefersleep maybe more like (replace-args whatever 10)
, and that would output (defn whatever [10] (+ 10 10))
@noisesmith interesting, I hadn’t thought of macroexpand
still doesn’t quite make sense to me
user=> (defmacro whatever [x] `(+ ~x ~x))
#‘user/whatever
user=> (macroexpand-1 ‘(whatever 10))
(clojure.core/+ 10 10)
can you have 10
as an arg?
or not as an arg, but as a parameter denomination
Yeah @noisesmith that’s exactly what I’m thinking, but with regular functions instead
@reefersleep what do you mean by parameter denomination?
as the name of an arg in an argument vector in a function definition
there might be some trick based on clojure.tools.analyzer but it’s likely going to be a lot of work done by hand to create something that behaves that way
@reefersleep Yeah, any way of invoking it is fine. I’m trying to picture a new kind of tool for code debugging
@noisesmith that’s a solid lead, I’ll check that out
some of the folks that work on tools.analyzer hang out here, if you can’t find a dedicated channel they are active in the clojure-dev channel
tools.analyzer isn’t used by clojure itself, but it’s used by a lot of people who also work on clojure itself
@chalcidfly what I mean is this:
(defn do-stuff [10] (+ 10 10))
CompilerException java.lang.Exception: Unsupported binding form: 10, compiling:(*cider-repl query*:145:6)
that’s not what he’s trying to do at all though
this is about showing inline substitution to help you debug your code - eg. what edebug does in emacs with elisp code
then I get the reference to analysis
or what you would do by hand if you were trying to step through code by hand on a whiteboard
yeah I see
so something like, what’s the editor by Chris Granger
Light Table?
Yeah, something like that
well there you have it
can’t you look in the Light Table source?
or is their approach unacceptable?
Does light table actually do a full on replacement? I haven’t seen that
no idea
I just thought they did an instarepl kind of thing that turned out to be disappointing
But maybe I should give it another look
The way that I think I’ve seen it is that for a function invocation, you can see the current values for symbols in like, little balloons or something like that
I may be wrong
@reefersleep yeah, that’s pretty much what I’m envisioning, but like, a general library for that sort of thing
not necessarily tied to Light Table but usable in different tools
Tear it out of Light Table, then! 😄 If they can do it in this specific way, I’m guessing you can generalize it.
It appears that the light table source code has exactly zero comments anywhere
maybe I dreamt the balloon bit? or maybe that video is out of date
go ahead, @genec 😄
@reefersleep I'm thinking about it, but it's complex. I've used the F# extension Ionide for vs code and something like that for Clojure would be insanely great
I bet it is, @genec 🙂 Is there a video example of the greatness of Ionide? I’d like to see.
if i can figure out how to write vs code extensions in clojurescript, I would consider it
I haven’t ever seen VS code in action, I’m an emacs man these days, but certainly not religiously so
here's a link to ionide and the author of it's a really good guy (very active in the F# community) https://www.youtube.com/watch?v=JWe1pOeh84U&feature=youtu.be&t=18m
I don’t know precisely what ionide does, but F# is strongly and statically typed, which are two features clojure lacks, and both features tend to make it easier to make helpful tooling
you can’t make the same kind of far reaching assumptions in clojure code that you can in f#
yeah, but i think getting the vs code extension on par with the atom/proto-repl would be a good start
I would love to see an implementation of the Language Server Protocol for clojure -- that is not tied to nREPL
(But certainly can reuse some of the nREPL functionality, just not the protocol) http://langserver.org/
Lots of tools (like VS Code or Emacs) are planning on implementing the language server protocol
just realeased version 0.3.0 of postagga, the easy natural language parser - now with more flexible parsing rule 🙂 https://github.com/fekr/postagga
@turbopape just glancing, it's not clear that you could handle unmarked passives, whiz deletion, gaps, pp attachment etc, using your approach, is that correct?
Oh yeah that’s true, it’s there just to get you going with extracting meaningful information from text whose structure is known
Hello, I would appreciate a little help
I created a luminus template with the +postgres
option
Yeah, feels like Yale case frame parsers from the schank era. Definitely useful for a bunch of stuff still!
@turbopape do you have precision/recall for Brown Corpus POS and file size for the cljs tagger? Looking for a small tagger that can run in the browser but everything seems to be impractically large :(
Yeah I assume this is not the fanciest NLP methodology out there but it is there for the rest of us to use :)
Nono, not a slight at all! Been feverishly studying oldschool semantic parsers and great to see things being done for humans :)
Problem with "compact" taggers i found you still need the corpus dictionary in the browser
Is there a clojure library for emitting plain clojure?
Sort of along the lines of what Tim Baldridge does here, but more complete: https://www.youtube.com/watch?v=KhRQmT22SSg
an AST
of Clojrue
from Clojure to Clojure haha
Really? hmmm
(in fact, that's the pass that core.async uses from going from AST back to clojure code)
Not sure how I missed that, thanks a bunch!
tools.analyzer's documentation is not the best, my fault. contributions are more than welcome tho :)
pretty junior clojure guy here, but I’ll help if I see a way to