This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-02
Channels
- # babashka (37)
- # beginners (19)
- # calva (5)
- # cider (14)
- # clojure (21)
- # clojure-europe (2)
- # clojurescript (16)
- # conjure (11)
- # datalog (78)
- # deps-new (3)
- # gratitude (2)
- # introduce-yourself (1)
- # joker (1)
- # jvm (4)
- # lsp (17)
- # malli (5)
- # meander (6)
- # minecraft (3)
- # off-topic (17)
- # other-languages (25)
- # practicalli (1)
- # quil (12)
- # reveal (6)
- # spacemacs (19)
(into {} (remove (comp #{:f} first) {:f 10 :a 11}))
;; I like to say
(remove-keys #{:f} {:f 10 :a 11})
does this function exist?dissoc
Not exactly the same but you can use it to write the function that takes a set
@roguas println
always prints to the console. Can you explain what you're asking about the REPL in relation to the Ring Jetty Adapter?
If you start your program from the REPL, println
in the program is going to print "to the REPL" because that's what stdout is bound to by default. But if you start your program from the command-line and then connect a REPL into that, your program has its stdout, and your REPL has its stdout -- separate.
Well mount lib should hold the same logic right? If I (mount/start) my http-server using repl it will pipe all (println) to repls stdout?
If you're starting the server from the REPL, I would expect println
output from the server to come back to the REPL.
I am starting server from the REPL, (jetty/run-jetty handler {:port 8000 :join? false}), inside mounts defstate, i have taken it out now... the handler is simple just returns (defn h [_] (println "hello2") {:status 200 :body "hello"}), when i pass the req to reitit.ring/ring-handler it prints fine
Starting the server from the REPL with a handler that prints, that output shows up in the REPL:
e$ clj -Sdeps '{:deps {ring/ring {:mvn/version "RELEASE"}}}'
Clojure 1.10.3
user=> (require '[ring.adapter.jetty :refer [run-jetty]])
2022-01-02 14:29:09.337:INFO::main: Logging initialized @29617ms to org.eclipse.jetty.util.log.StdErrLog
nil
user=> (defn h [_] (println "Hello!") {:status 200 :body "Hiya!"})
#'user/h
user=> (def server (run-jetty #'h {:join? false :port 8000}))
2022-01-02 14:30:23.412:INFO:oejs.Server:main: jetty-9.4.42.v20210604; built: 2021-06-04T17:33:38.939Z; git: 5cd5e6d2375eeab146813b0de9f19eda6ab6e6cb; jvm 17.0.1+1
2022-01-02 14:30:23.473:INFO:oejs.AbstractConnector:main: Started ServerConnector@5fa23c{HTTP/1.1, (http/1.1)}{0.0.0.0:8000}
2022-01-02 14:30:23.474:INFO:oejs.Server:main: Started @103754ms
#'user/server
user=> ; hit in a browser
Hello!
nREPL.
I've heard people have problems with nREPL-based stuff with process output sometimes.
You can probably solve it by starting the REPL outside Calva and connecting to it in Calva, instead of jacking-in?