Fork me on GitHub

What's the best way to install and manage Java on Ubuntu for someone hopping into the ecosystem purely for Clojure / Clojurescript?


@meow I use sudo apt install openjdk-8-jdk and am happy with the results. One thing to be aware of is that Current Ubuntu installs java11 if you just request the default; You will run into issues with java11 (these are easy to overcome, but is just a bit of a pain). You can also install both versions and switch between them with sudo update-alternatives --config java if you need to.


i'm using that too, no issues


How do I make Cursive recognize browser built-ins, e.g. js/DataView?


Is Immutant still considered a best-practice when building app servers?


is it possible to test for the fniness of something? for instance, a set is a data structure and also a function, but returns false when passed to fn?:

(fn? #{1 2 3})
=> false


solved as soon as i opened my mouth:

(ifn? #{1 2 3})
=> true
(ifn? "string")
=> false


@cureadvocate so far I've never needed the JEE features that Immutant offers. All my Clojure web apps run on either embedded Jetty or http-kit.


Thank you, Sean. Preparing for an interview Monday, so just curious what's popular now. (I switched to Go for channels for bit since Clojure lacked transducers at the time.)


what's a good way to do restful APIs with Clojure?


I've seen Liberator which might be interesting for example, other ideas?


I also rewrote the routing from Compojure to Bidi, but I don't find a way to have a route like /100 instead of /resource/100 where 100 should be mapped to resource-id for example


it's nice to have routes as data, but I don't find it so easy to wrap my head around this data centric DSL used


perhaps i’m misunderstanding, but i think bidi does have regex support for cases like that


@andrea.crotti something like ["/" {[:resource-id ""] :your-route}] maybe?


(and, yeah, I find Bidi pretty hard to get my head around)


@cureadvocate Good luck with the interview! I think Jetty is popular by default since that was kind of the "batteries included" setup with Ring for a long time. We ran into some problem around thread management with it some time back, so we switched to http-kit for most of our server processes. I think if we were building something more monolithic and needed built-in queuing and other JEE stuff, we'd look at Immutant but, I'll be honest, I haven't been following its development for a while now. It seemed very interesting when it first appeared tho'...


Immutant hasn't been JEE focused in a long time :) You can use it piecemeal, and embedded. So if you just need an embedded webserver, you can use immutant-web just like you would Jetty/http-kit


Nice! Thanks @tcrawley! I didn't realize it had changed so much -- that's great!


Yep, with 2.0 we dropped the need for the container and broke it up. See for an example of using the embedded web server


run-dmc :rolling_on_the_floor_laughing: Love it!


I'll have to take another look at it!


Thank you, @seancorfield! I'm looking at http-kit with Compojure right now, then monads and caching libraries. Tomorrow I'll build a front-end with ClojureScript and will hopefully be ready to go.


@tcrawley Very nice to see Immutant being as simple to get up and running as Jetty or http-kit!

seanc@DESKTOP-JMD1DBJ:~/clojure$ clj -Sdeps '{:deps {org.immutant/web {:mvn/version "RELEASE"}}}'
Clojure 1.9.0
user=> (require '[immutant.web :as web])
20:32:31.963 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
user=> (defn app [req] {:status 200 :body "<h1>I'm Immutant!</h1><p>I'm modular now!</p>"})
user=> (web/run #'app)
20:32:54.962 INFO  [org.projectodd.wunderboss.web.Web] (main) Registered web context /
{:path "/", :immutant.internal.options/validated? true, :dispatch? true, :auto-start true, :static-dir nil, :port 8080, :host "localhost", :virtual-host nil, :configuration nil, :contexts {#object[org.projectodd.wunderboss.web.undertow.UndertowWeb 0x662be9f7 "org.projectodd.wunderboss.web.undertow.UndertowWeb@662be9f7"] ({:virtual-host nil, :path "/"})}, :servlet-name nil, :filter-map nil}


a sequential destructuring naming pattern I just thought of:

(let [[foo & +foos] foos]

👌 4