This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-06
Channels
- # announcements (1)
- # aws (36)
- # babashka (105)
- # beginners (53)
- # calva (27)
- # cider (5)
- # clj-kondo (10)
- # clojure (232)
- # clojure-europe (4)
- # clojure-italy (6)
- # clojure-losangeles (9)
- # clojure-nl (3)
- # clojure-sanfrancisco (3)
- # clojure-uk (124)
- # clojured (3)
- # clojurescript (57)
- # clojutre (1)
- # core-async (9)
- # core-logic (1)
- # cryogen (23)
- # cursive (35)
- # datomic (12)
- # duct (4)
- # events (1)
- # figwheel-main (3)
- # fulcro (9)
- # graalvm (31)
- # jobs (1)
- # jobs-discuss (85)
- # kaocha (11)
- # leiningen (11)
- # luminus (19)
- # malli (47)
- # meander (12)
- # nrepl (8)
- # off-topic (32)
- # pathom (4)
- # pedestal (2)
- # reagent (7)
- # ring-swagger (1)
- # schema (3)
- # sql (5)
- # tools-deps (114)
- # vim (17)
- # xtdb (12)
Can I evalute an expression (send to REPL) and have the output as a comment in my text file without touching a mouse pointer?
Not right now, I have a plan to allow users to create configurable commands which will allow this.
Awesome - typical nice to have extension. I already use the custom REPL command stuff extensively and enjoy it a lot!
Is it possible to redefine the REPL prompt I see in Cursive? I've tried the following and it seems to work in a command-line REPL:
(ns user
(:require clojure.main))
(defn repl-prompt [] (printf "=== %s ===\n=> " (ns-name *ns*)))
(alter-var-root #'clojure.main/repl-prompt (constantly #'repl-prompt))
it works like this:
$ clj
Clojure 1.10.1
=== user ===
=> (defn repl-prompt [] (printf "=== %s === !!!\n=> " (ns-name *ns*)))
#'user/repl-prompt
=== user === !!!
=>
Not at the moment, no - currently Cursive doesn’t actually show a prompt at all. Being able to configure some kind of context information is an interesting idea, though, that might be possible.
My immediate use-case is that I'm connected to an in-memory db while im developing an importer, but then i want to be able to switch to a persisted version, when my importer worked on new data. I would like to provide this for others as "a shell"
No, I mean that it would probably be possible without too much work. I was thinking about an expression in the REPL run config which would be evaluated behind the scenes after each REPL eval. The returned value could be shown in the overlay in the bottom right of the editor or something like that.
For now I think I can just create a REPL command, assign it to some convenient function key and that could just print my current work context...
Iike how the namespace is reflected in the REPL tab, though I usually just keep it as user
, so my REPLs are indistinguishable. Would be useful if I could see the Deps project root folder name too or something like that.
If there would be a REPL prompt hook, we could just program anything there...
I've also experienced something funny around that overlay. Notice how the stdout got interpreted as the current namespace. That gave me the idea that I could somehow control that information programmatically 😉
Yes, that's an nREPL with Run with Deps option. I haven't narrowed the phenomena down yet, but it's roughly going thru this pipeline:
(-> "x.tsv" io/resource io/reader
clojure-csv.core/parse-csv
semantic-csv.core/mappify
(on-every 1e4 •)
(d/transact conn)
deref)
where on-every
is defined as
(defn on-every
"Wrap s in a lazy sequence that will call f, presumably for side effects,
on every nth element of s during consumption.
Source: "
[n f s]
(let [g (cons (comp first (juxt identity f)) (repeat (dec n) identity))]
(map #(% %2) (rest (cycle g)) s)))
to provide some visual feedback while the lines of my tsv file are consumed.but i suspect that the culprit can be that •
function, because
a, it's printing a non-ascii character
b, it's flushing the output
(defn • [& args] (print "•") (flush))
With an nREPL REPL, those values should only be set by the server explicitly sending the current namespace back to the client, it should never come from stdout.
As I see my nrepl is a bundled one on the latest stable version:
-classpath "/Users/onetom/JetBrains/apps/IDEA-U/ch-0/201.6073.9/IntelliJ IDEA 2020.1 EAP.app.plugins/clojure-plugin/lib/nrepl-0.6.0.jar
Maybe the latest 0.7.0-alpha3 fixes it. They mentioned some fixes around streaming printing in the changelog:
https://github.com/nrepl/nrepl/blob/master/CHANGELOG.mdI'm thinking about creating a Datomic admin interface, where I can dynamically set a session name, user name, which then gets added as some attributes on the "datomic.tx" entity of my operations
it would be also nice to summarize what kind of environment am i currently operating in (as in which database am i connected to and stuff like that
I've defined a macro which has a form that looks like this:
(defmymacro ::namespaced-keyword [args go here] forms go here)
i.e. akin to defn
but with a namespaced keyword instead of a symbol in the second position
would anyone happen to know if there's something that I could tell Cursive to resolve that as in order to get argument behaviour?
as it stands my only choice seems to be defn, which requires me to use a symbol in the second position 😞
@tekacs I don't think there is a way, but you can easily convert from symbol to keyword inside your macro if you really need that, no?
I was hoping to use namespaced keyword to get Cursive to autocomplete the keyword for me
then I get those to line up more easily and for Cursive to realize they're the same definition
ah, then I think you'll need to wait until cursive releases the expanded macro recognition thing