This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-19
Channels
- # announcements (1)
- # aws (9)
- # beginners (136)
- # boot (4)
- # cider (11)
- # clara (36)
- # clojure (337)
- # clojure-europe (5)
- # clojure-italy (3)
- # clojure-nl (2)
- # clojure-spec (9)
- # clojure-uk (112)
- # clojured (7)
- # clojurescript (93)
- # core-async (2)
- # cursive (30)
- # datomic (6)
- # duct (4)
- # emacs (2)
- # figwheel (1)
- # figwheel-main (7)
- # fulcro (153)
- # kaocha (1)
- # off-topic (12)
- # om-next (1)
- # pedestal (58)
- # planck (6)
- # re-frame (15)
- # reitit (11)
- # shadow-cljs (113)
- # spacemacs (1)
- # specter (3)
- # vim (8)
has anyone hit clojure jira's api? i tried a few paths under http://dev.clojure.org but getting 404. not sure if it's enabled.
I use it every week to collect numbers of votes on each JIRA ticket.
sample path i tried GET
ing https://dev.clojure.org/jira/rest/api/3/user/assignable/multiProjectSearch (with auth) getting 404
The URLs I use are in this code somewhere: https://github.com/jafingerhut/clj-prescreen/blob/master/src/clj_prescreen/presc.clj Search for occurrences of http and you should see them.
I do not necessarily exercise parts of the API that you want to use...
I notice that my code never uses 'rest' in any of its URLs. Also note that Clojure JIRA may be an older version than the most recent, by several years.
@hiredman built a neat looking way to query jira with core.logic but mentioned that the clojure jira doesn't send a lot of stuff back in the api
Well, loved by a few, and stable. Updating it can be a pain, I am sure.
I am sure it gets more fun to update to the latest version, the more intermediate versions there are 🙂
looks like we're on v7.6.6
at work, which is what i've developed against previously. so i bet none of my code will work against clojure's
When you’re using the api, please be kind. It’s not on a mammoth server or anything
I’ve unsuccessfully spent weeks trying to upgrade this jira instance to their cloud version. It’s a nightmare.
Jira is brilliantly engineered in that it's extremely hard to get out of once you're in. On the other hand, the same indeed applies to Jira itself.
The former in Java. The Clojure library that tools.reader.edn lives in, also works in ClojureScript
Hi, I reinstalled Java and lein, but lein seems to be broken:
lein
clojure.lang.Compiler$CompilerException: Syntax error compiling at (cider/nrepl.clj:1:1).
#:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "cider/nrepl.clj"}
...
Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class, clojure/tools/nrepl/server.clj or clojure/tools/nrepl/server.cljc on classpath.
at clojure.lang.RT.load (RT.java:466)
java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
but same issue with java 8the latest cider has moved to a new nrepl - that exception indicates the old nrepl. I don't know quite enough to point you at where things are amiss
I think things that would help someone answer this better would be which leiningen version and cider version you have
usually lein 2.9.0 is enough. check your deps for the presence of tools.deps.nrepl which is poisonous to have now
Looks to me like an old cider version? the error is that t.d.n can't be found. You might have cider in your ~/.lein/profile.clj
Yes, you are right, I completely forget this file ~/.lein/profiles.clj
which was pointing to an old version of cider, I put the version displayed on clojars and it worked. Thank you.
thanks @andy.fingerhut @dpsutton, I was asking for a "max value" value only out of convenience
anyways, it's used in REBL and various other things https://github.com/clojure/clojure/blob/master/changes.md#25-prepl-alpha
It'll be nice to see more tooling using prepl so less dependencies need to be involved.
Well, the usual caveats apply--JS doesn’t support Java interop or Java-style threads. If your Clojure code isn’t running into any Java/JS incompatibilities, it probably compiles as CLJS already.
I may not have understood what you’re asking for tho.
No, you understand correctly. =D But, just because I have the org.clojure/clojurescript dependency it will compile to cljs? (if I have no incompatibilities)
I would tend to expect so, that was one of the goals of CLJS. You might also want to use .cljc files if you’re interested in code that compiles to both.
Here’s the link if you haven’t seen the docs for this: https://clojure.org/guides/reader_conditionals
Just to clarify: I have an application written in Clojure and I would like to compile it to cljs/js and run it in a Node VM.
Sounds plausible, but you’ll have to port the code that works with dependencies, so anything to do with, say, databases or web servers
That can be a bigger rabbit-hole than you might think because you may have Clojure libraries that depend on something Java-specific internally, meaning you’ll have to find a CLJS replacement for the whole library.
Depending on the application, it may prove to be simpler/faster to use the Clojure implementation as a reference, and write the CLJS from scratch. But that’s a worst-case scenario.
Right, make sense! Thanks! Do you have any doc/post about compiling clj to cljs? I just would like to run some " lein comile clj to cljs" and see some exceptions popping up (because of some Java/JS incompatibilities).
I would just start by copying the files into a cljs
directory instead of clj
, and changing the file extensions from clj
to cljs
. (Actually, I’d inspect them as I copied them just to see what I was getting into.)
Actually, I’d say prepl is not framing, but data over a stream
What else could it be?
Well, I mean. Say you return a long printed string. Can you start decoding the characters before the full string is returned?
It’s packed in an edn string, so in general you would wait to read the whole data structure response (unless your client was very clever)
But the key here is that in general your interactions with a repl are short, not a streaming video
Where as with unrepl bytestream, you can do whatever you want. You could return streaming video for that matter
Would replacing a node in a tree with clojure.zip be an example of path copying?
With the path copying method a copy of all nodes is made on the path to any node which is about to be modified. These changes must then be cascaded back through the data structure: all nodes that pointed to the old node must be modified to point to the new node instead. These modifications cause more cascading changes, and so on, until the root node is reached.
I think it pretty much describes zipping up a tree. Just realized that stuff I’ve been reading about Scala is described as path copying rather than anything related to functional zipper.I guess pRepl is more a replacement for nRepl then. Which would be bundled with Clojure. It seems like the advantage over unRepl might just be easier for tooling to build on, because of the defined data-format.
I see all of them as different approaches
Prepl and unrepl are built over streams and certainly Rich has expressed at great length the heritage and benefits of streams for composability and portability
I guess I'm not seeing the value proposition of pRepl over nRepl except for it being bundled in the Clojure jar.
Every Unix thing already knows how to work with character streams
Stream repls compose, so you can nest one inside another
It’s a framed protocol
Probably better for you to go read their well written docs than for me to explain
It’s bencoded messages over a socket
nrepl in practice is mostly bencoded messages over a socket, but you can define different transports
I must admit I am some what baffled at the turn prepl has taken, because it has been my experience that tunneling framed messages is easier to do both over on framed message protocols (like websockets) and over streams (like a socket), and when nrepl as a project started I seem to recall rich suggesting looking at STOMP(a message bus protocol) for inspiration
(tunneling is near and dear to me because at work I do a lot with an nrepl tunneled over http://socket.io)
but then, like reading the doc string on prepl, most of the doc string is example framed messages that out-fn is called with
so the idea that that you can differentiate between prepl and nrepl saying one is framed messages and the other is streams, rings rather hallow
What is the best possible way to generate list using clojure on a map like
(def somemap {:name 'John Doe' :gender 'male'})
and generate
(some-ns/property :name 'John Doe')(some-ns/property :gender 'male')
if you want a list of those lists (map (fn [entry] (cons 'some-ns/property entry)) somemap)
but often lists aren't the right data type
@noisesmith @hiredman , I m trying to generate this form from a map
(traverse g (add-V :person)
(property :name "John Doe")
(property :gender "male")))
@UFURXR7PT Luckily you don't have to try to chain property
calls together as they mutate the underlying traversal object. Something like
(defn add-properties
[traversal m]
(doseq [[k v] m]
(o/property traversal k v))
traversal)
will work. That saves you from a fairly nasty macro that I didn't enjoy trying to writebut, assuming traverse is a function, and property is a function, and what you want to do is call the traverse function with those arguments (instead of creating a that as a datastructure)
although, my (wild)guess is you are using clojurescript, not clojure, and for in clojurescript might not work on maps like that
@hiredman I m dabbling with ogre library for JanusGraph and trying to create a graph traversal in clojure
"generate this form" makes me think you might be trying to do a macro - is traverse a function where you can precalculate args, or a macro that needs another macro around it?
so, here is how ogre lets us create a vertex in Janusgraph with traverse function. so I am wondering if there is a macro approach - https://github.com/clojurewerkz/ogre/blob/master/test/clojure/clojurewerkz/ogre/suite/add_vertex_test.clj#L22
don't use a macro if you dont' need one - if traverse is a function, use a function like hiredman demonstrated
macros can do a few things a function can't, but are less flexible / usable in other code, so if either a macro or a function would work, use a function
Equality and hashing ignore metadata, so it’s best used for annotations that you would not consider part of an object’s value
I'm not sure I see the difference between bencode, and EDN. Both sound framed to me. And neither seem to be streamable protocols. They both require the full payload to be received before decoding can proceed. That said, EDN in Clojure-land seems more natural. So I still feel pRepl is more like a new take on nRepl, with Clojure jar bundling. Which is fine, better then nRepl. But unRepl still seems like the wholy grail to me. That said, I recognize it might be harder to implement a tool with unRepl, since you're left implementing the protocol you want on your own. So, maybe pRepl is the right compromise in this case.
in fact technomancy had a proposal for using hypermedia kind of things to build emacs/vim/whatever uis for tooling on top of nrepl instead of having to build them again for every editor
Well, for me the differentiator for unRepl, is really just the idea that you inject your repl code through a standard socket repl or clojure.main repl.
So if nRepl injected itself like that, to bootstrap, instead of requiring hard dependencies. Then it would be totally fine
Yes! Awesome, I was just thinking that in theory, unrepl could inject nRepl or even pRepl (:p), though that one is just part of Clojure so no reason to do so. That's great.
@hiredman I've seen hints of this in nREPL, but not sure where this was going. Do you know of a blog post or something?
I think he even proposed a talk at the conj about (I don't recall if it was accepted)
prepl being streaming means that you can connect remotely and still nest new repls, which you can't with nrepl afaik. I think cgrand was even looking at deploying unrepl that way over prepl?
depends what you mean by nest repls, but nrepl middleware can pretty much do whatever it wants
I mean like run clojure.main/repl
I have a repo somewhere that runs swim (clustering) over nrepl, and then lets you proxy in to different members of the cluster
By the way, is there currently a way to start the socket repl from within a REPL? Or you need to have the JVM arg on app startup ?
it has a programatic api
so you can start it yourself if you like
http://clojure.github.io/clojure/clojure.core-api.html#clojure.core.server/start-server
each socket server has a thread, and each incoming client gets its own thread
you could just go read the code for this too, it's pretty straightforward
as in not, designed for humans but for programs (like rebl) to talk
https://groups.google.com/forum/#!msg/clojure-dev/Dl3Stw5iRVA/IHoVWiJz5UIJ is some stuff from rich when the socket repl was added that you might find useful to read if you're interested in his opinions on it
it's a long thread
this pre-dates prepl but I think you can project most of what's said there to prepl as well
Hum, havn't read it all. But I wonder if pRepl is a realization that no one used the Socket Repl. And thus, a thin RPC, or lets call it more, a easier time building REPL based programs was needed to gain more adoption. Thus pRepl
it's important to separate the socket server from the socket repl
the socket server is the more important bit imo
the socket repl is the clojure.main repl, with a few minor tweaks, over the socket server
to some degree, it is mostly a minimal example to be in the box - we never expected it by itself to be used much
we expected more people would build interesting custom remote repls (unrepl is a great example)
stepping away... need to get some work done :)
the whole thing is so frustrating to read, the stream vs. messaging framing because streams are an ordered sequence of messages, the rpc vs. repl framing because after saying a repl is not an "Eval RPC Server/Window", rich turns around and releases prepl, which I mean, a programatic repl, how is that not an rpc server?
It supports streamed messages which are independent. If you have a thread pumping out, you’ll keep getting messages independent from the repl
I'm taking this bit: With the improved read-ability of REPL output, I think an edn-based REPL makes a fine RPC server for program-to-program communication, especially since the set of 'verbs' supported is bounded only by what you can evaluate, and the types of things you might discover is open.
This sounds a lot like pRepl. And I feel it is. I can see how the Socket server is the true primitive. And then unRepl, happened to be the only take on it. So maybe, it is true that people seemed to have been baffled by how bare bones socket server was, and just having to decide of a serialization format to exchange was too hard for tooling to adopt it. So maybe pRepl is trying to solve that. Adding a basic edn serialization on top.
Which is that a response to? I can see how that could be used to argued against it being rpc, but then again plenty of rpc frameworks have someway to stream information. As for streams vs. messages you can't describe what the stream is doing without calling it messages, so I dunno.
I feel like my parents got divorced so I get more toys (so many repls) but then they keep making digs at the toys the other parent got me
It's really important to separate Socket Server vs. Socket REPL
Socket REPL is clojure.core.server/main
running as the "connection accept" function for a Socket Server
You can conceivably run a JSON-RPC endpoint, or some HTTP server as your "connection accept" function
prepl is another thing you can run on a Socket Server -- specifically clojure.core.server/io-prepl
would be the accept function for that
diverse transports? nrepl has them (as I said nrepl ships with bencoded data over sockets and a plain socket repl, and there are throd party transports for things like message queues and http)
Right, I see that. I guess the thing is. Once you have a socket server, and an accept function that can take a char-stream and eval it, and return a char-stream of the result. You have all the power as a client. So now, you can send to be evaled the entire code of pRepl if you wanted. And eval a swap of the socket server accept-fn to be the one you just sent.
Now, pRepl, or nRepl, or wtv else. Those are just protocols or middleware, etc. over your foundation. Maybe as a tool writer, I prefer to exchange EDN back and forth. Or maybe I prefer bencode.
That said, its also an added responsibility to the tool writer. So maybe, I don't care. And its best that Rick just says, it'll be EDN from now on.
transport encoding is the least interesting part of this. How the REPL handles *in*
is really important
I haven't looked recently so I don't know if this is out of date information w.r.t. nREPL, but that old thread above brought up some difficulties with issuing (read *in*)
in nREPL
"Returns a LineNumberingPushbackReader suitable for binding to *in*.
When something attempts to read from it, it will (if empty) send a
{:status :need-input} message on the provided transport so the client/user
can provide content to be read."
I remember Stu saying something like that on the apropos cast i think? His daughter was making a program and requested the users height or something. And he said it should read from in, not send a message.
as I have said in the past, I have a nrepl repl tunneled over http://socket.io
so framing streams as some fundamental answer that will give us super powers is kind of silly
Rich sais: > There must be some source (stream) of things read. That source is the same source that should be used should the code being evaluated call 'read'.
when I said "tricky but doable" and then did it, I was imply it is tricky but has been done
Like if I wanted to return a big image from the REPL, and have it rendered in my tool.
Yes, where the messages don't add considerable overhead to the stream. And where you can begin to deserialize very early.
you can write an nrepl middleware that recognizes java Image objects and starts and a webserver and serves them over http and just sends a link to the client repl
If my REPL just returns bytestreams. It could just return the image bytes with a byte header and done
but you can also certainly write an nrepl middleware that detects java Image objects and sends them back as a bunch of bytes
(but for example, if you are transporting over something that json encodes things will be tricky)
Yes, but now I'm having to add middleware dependencies ahead of time. So to use a tool, the user is forced to add code to their program. That's why I love unRepl
With unRepl, the tool is in full control. And can choose to be as sophisticated, or as little.
all critiques of nrepl I have seen so far instead of making me think "well nrepl could be better" leave me thinking "oh, I guess so and so hasn't used nrepl much"
if you want to inject it right in to an existing repl, I don't know if I buy there being a lot of demand for that, but if there is, while nrepl can't do that now, I don't see why reason why it couldn't do that
at one point, and this may predate nrepl in the slime/swank days that is how a lot of the functionality was done, it would inject code in to the clojure process
so of course there was a backlash, and now I guess we are scheduled for a backlash to the backlash
Ya, so this is where unRepl comes into play as well. Once you say, let's inject things into a socket repl. You have so much freedom, that you can also mess up, and different tools could inject incompatible things. Which is where, you want a framework around it. That's where unRepl goes beyond just the idea of injecting REPL functionality into a socket repl, into an actual library to use.
That said, nRepl isn't free of that issue also. Different middlewares need to play well with each other.
they do, but atleast if you have to included them in a versioned manner in your project.clj or deps.edn or whatever you can try to pin them to something that works together
Well, I can't speak of more details, since it is beyond my knowledge. But in my experience, I've had less issues overall with unRepl then nRepl.
the idea that unrepl is better because people haven't written terrible tools around it yet, well, just wait
Oh, you want refactoring, add this to your project.clj file. Oh, you don't want the refactor lib deployed to prod, okay, figure out a way to use profiles, or aliases to only depend on it in dev. Oh but now, you actually do want to connect to a prod remote repl, and miss your auto-complete? Well too bad, maybe just include that middleware when going to prod?
Would you really rather inject some tooling code into prod than include it as a normal dependency though?
I agree that sideloading/upgrading is a cool feature but having to add a dep or two surely isn’t a blocker. lein and boot bundle nrepl anyway 🙂
Normally my flow is, have issue, ssh to prod host, start a second instance of my app with socket.repl flag. Connect to REPL and debug.
Well, actually, I start a second instance into clojure.main to be more precise. And then I use unRepl to enhance the clojure.main repl to support all kinds of cool features.
That bypasses my server from instantiating, and thus avoids binding to an existing port, as well as make sure it is not serving traffic
I don't think the dependencies are a huge ordeal. But, its a pain point. Especially to newcomers. There's a reason cider-jack-in choose to inject them into lein.
my generator generates invalid inst
's
Is it a know issue?
clj -Srepro -Sdeps '{:deps {org.clojure/test.check {:mvn/version "0.10.0-alpha3"}}}' -e "(do (require '[clojure.test.check.generators :as gen] '[clojure.spec.alpha :as s]) (gen/generate (gen/vector (s/gen inst?)) 120 6))"
[#inst "1970-01-01T01:24:38.462-00:00" #inst "1969-12-06T11:54:24.666-00:00" #inst "820499-07-18T05:28:23.398-00:00" #inst "1969-08-08T01:04:53.430-00:00" #inst "1970-01-01T00:00:00.000-00:00" #inst "1970-01-01T00:00:00.001-00:00"]
The 3
one: #inst "820499-07-18T05:28:23.398-00:00"
the reader can read it.
not a known issue, file a jira
Well, I'm not feeling like I'm making bad comparisons. I'm only stating a difference, which I think is not mistaken. nRepl requires hard dependencies to it and its middlewares. UnRepl does not.
And others seem to say that nRepl handles input and output in a way that makes certain code not behave normally. I can't speak to that fact. Maybe nRepl is handling all that correctly now, so it isn't an issue anymore.
Finally, I feel neither nRepl nor pRepl can allow for streaming data. So there use case suffers when you need to return gigantic results. Obviously, no tools needs this as of yet. But I like that UnRepl doesn't limit that, because the tool could choose its own mechanism.
I'm not totally sure about that last one though. I might be wrong about both nRepl and pRepl in that regards, I admit.
I also understand that, none of these might seem like good enough differentiator to warrant splitting the REPL ecosystem in three. And ya, maybe that'll end up worst, now having some tools use nRepl, others pRepl, and some more unRepl.
Anyways, I just wanted to understand where pRepl differentiated itself from nRepl, or unRepl. So thanks everyone for helping me understand that better.
nrepl can “stream” evaluation results over one or more messages since 0.6, and it was always possible with middleware (cider’s pretty printing middleware has done that for a long time). So you can interrupt an evaluation while printing a large (or infinite) result
Hey thanks for that piece of info @cichli I know you've been hard at work on the cider orchard and nRepl. I love all the improvements being done. And actually agree with @bozhidar choice to stick with nRepl and double down. Lots of good stuff uses it, and it makes sense to just keep improving and making better what we already have.
I think it’s a good thing if there are other REPL implementations tbh, tooling ecosystems can be diverse without being fragmented. If nrepl makes tradeoffs that dont make sense in some circumstances (i.e. how it handles *in*
/ *out*
) then we should have other options
I think once the nREPL clients can side-load the nrepl
dependency over a Socket REPL or pREPL, no one will really care about the differences.
It'll just become more and more common to start from a simple Socket REPL or pREPL, initiated by Clojure itself based on JVM options, and any and all tooling will start from that point and build up.
For me, that's the main benefit: you can start an arbitrary JVM process (that contains Clojure), using JVM options to start a basic REPL, and then connect to that process from any editor, command-line tool, whatever, using whatever set of tooling features you like best.
That depends on which cljs repl you’re using – e.g. Nashorn handles interruption how you’d expect since it’s in the same runtime. Any kind of browser or foreign runtime and it gets complicated
I spent lunch thinking about streams vs. messages, and it seems like what differentiates nrepl and socket repl/prepl in that regard is, nrepl has different message types for "user input" and "forms to evaluate input" where as for socket repl/prepl there is effectively one "input" message type for both
are there any libraries that modify clojure.test output for exceptions to also show the ex-data
?
yeah, that was CLJ-1209
does it print everything?
is it pretty printed?
*print-length*
?
Dear Clojurists, any recommendations for DynamoDB API's? So far, Faraday https://github.com/ptaoussanis/faraday looks the most promising, even though last commit was on 2017 :thinking_face:
thanks @alexmiller
https://github.com/cognitect-labs/aws-api/blob/master/examples/dynamodb_examples.clj
I've used faraday a little, ended up ripping it of a project in favor of the java sdk (and ultimately getting rid of dynamo altogether and the deployment target changed). faraday was a little too magic for my taste, if you try and do anything actually database like with dynamo vs. just using it as a key value store, a lot of the decisions faraday makes with regards to serialization will bite you
aws-api doesn't use java sdk, just makes web calls, so it's much lighter weight
working with the java sdk is also frustrating because you can tell it is all json under the hood but you have to build all these java objects, which the aws-api stuff avoids
what, you don't like needless data -> object -> data transformations?
I first parsed that as "needless data" -> "object" -> "data transformations" and that was much weirder
Is there a way to expose an nrepl port (remote) to cider for a clj/deps instantiated repl?
ssh port forwarding?
@johanatan are you asking how to use CIDER to connect to a remote REPL, or how to setup your project to include nREPL
@lilactown the former. I know how to do it generally just not for a repl started via clj
(with a backing deps.edn)
I know how to do it on the cider/emacs side. But doesn’t the repl server have to somehow include nrepl?
the new project has moved it all in to some fancy docs site that doesn't work without javascript
(nrepl-server/start-server :bind "0.0.0.0" :port nrepl-port
:handler cider-nrepl-handler)
That (and a whole lot more) is in my .clojure/deps.edn
file @johanatan https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L47 as some inspiration of what you can do with CLI / deps.edn
I pretty much just use -A
for everything -- so for aliases where I might want just the dependencies sometimes and also the main opts other times, I tend to break them into two aliases. Hence -A:test:runner
for example, and the ability to combine the REBL aliases with others to add dependencies, start a Socket REPL Server, and so on.
Happy to answer any questions -- we switched over from Boot to CLI / deps.edn
completely last year, after being on Boot for three years (we were on Leiningen for four years before that). Feel free to DM me about it.