Fork me on GitHub

@noisesmith, that is really good to know! But undocumented, right?


hmm... I thought I saw it documented somewhere, let me see if I can dig it up


there are examples here and there, but I don't find anything mentioning that all the -> related macros are designed to work inside ->


oh wow this one - I never thought of using as-> with destructuring


I guess it's implied that nesting would work, since it isn't prohibited.


That is an interesting one with as-> and :as.


i'd like to use clojure to generate some defrecord classes (and some helper methods) that i intend to consume from Java... eg:

(ns my.core
  (:gen-class :name my.core.Support :methods [^:static [getEvents [] ...]]))

(defrecord Event [^String name ^Date date_])
(def -getEvents [] ...seq of Events...)
from Java i should be able to stuff like this:
import my.core.Event;
import my.core.Support;
public static void main(String[] args) {
   events = new ArrayList<Event>(Support.getEvents()); 
   // ^^ i get ClassCastException here b/c the imported Event is loaded by AppClassLoader
   //     but the Events produced by the clojure-compiled gen-class are loaded by clojure's DynamicClassLoader
   //  ... what's the best way to do this kind of thing


don't you have to load Support before Event at the very least?


I've found calling Clojure via Java to be much easier with the clojure.lang.RT static methods (var, require, etc.) rather than trying to use gen-class namespaces as classes

Alex Miller (Clojure team)03:04:46

note that this is not a public api and you should not rely on it. Instead, you should use the Clojure Java API -


hmm i do need to statically link/compile in my case.. .. wondering if there's a way to tell Clojure to load certain classes like these instead of dynamically complie them


you can't call the clojure API from the java code?


if you properly aot-compiled you will be able to import the classes, and the classes will in turn initialize clojure if it isn't initialized yet


oh sweet @noisesmith didn't know you could nest ->> and as-> inside a ->... feel like i'm gonna overuse this thoroughly now


(a gotcha is that with eg. lein, it assumes that your java needs to be compiled before your clojure, and here I think you really want the opposite)


that's fixed with `:prep-tasks ["javac" "compile"]` :prep-tasks ["compile" "javac"] (fixed)


@atdixon what type are you defining for getEvents to return in gen-class btw?


(I assume java.util.Collection by context)


interesting thx for that noisesmith, let me try something incidentally i'm using clojure-maven-plugin not lein so let me what i can find out here


@noisesmith very cool. thank you for doing that repro. it led me to a fix... while lein excludes the .clj sources from the built target/jar files, clojure-maven-plugin (what i'm using) does not do this by default so the presence of my clj source was causing clojure to prefer loading the defrecord by dynamic compilation rather than using the .class file that the static/linker was using - so the Event loaded by the java compiled code was not the same as the Event getting dynamically produced by clojure/DynamicClassLoader anyway i'm able to configure out the clj sources so that all is getting loaded by the AppClassLoader and now i'm working---thx again !


Anyone had issues with lein deps constantly failing with something like Could not transfer artifact amazonica:amazonica:pom:0.3.123 from/to clojars (): Connection reset during docker build and remember a solution?


This particular dependency doesn't seem like the issue, it's different every time. Works fine outside of docker.


sounds like issue about docker environment


or your Internet connection


I ended up using a multi-stage build and compiling the uberjar outside of the runtime environment. Was able to get it to work then, and with a smaller final image, so yay


How to figure out how to mute logging for Java dependency? I use flyway and it make so huge mess in REPL by printing even debug info. In the past this was working (.setLevel (Logger/getLogger "org.flywaydb") Level/WARNING), but not today (new ver. of flyway? I guess they changed logger or something). How to deal with such situations?


on the end jdbc use logback, flyway use who knows what, how to deal with this mess?


I mean what is the one right way to set level for logging? I have to do it separately for slf4j, log4j, logback etc. or is the way to do it in one consistent way? Should I use slf4j or logback?


In most of examples I see people set this levels by logback, not in slf4j even if they use it


another question: If one of my dependency use log4j, but another use logback I guess logback will capture log4j input as facade.


How to control it?


Personally I use timbre as logger, but Java libraries make a mess sometimes


Looks like flyway uses slf4j bindings, so if you use logback, you should be able to set the flyway log level in your logback.xml (or whatever method you use). I haven’t tried it myself though


Finally I did (.setLevel (org.slf4j.LoggerFactory/getLogger "org.flywaydb") Level/WARN) but still I don’t feel it 🙂


Also I have logback because jdbc use it


So probably dependency from jdbc (logback) bind slf4j to logback… who knows how this hell works 🙂


I use timbre in my code

Eric Clack14:04:04

Ages ago I think I saw some people talking about the site. I'd like to contribute and get it working well, e.g. this would be good to fix.

Eric Clack14:04:09

Anyone have any pointers?


On one can write clojure programs, if that's what you ask.

Eric Clack18:04:01

Not quite. 4clojure is a learning platform, which works well but has some shortcomings and it seems to have been abandoned. I wondering if anyone knows the authors or has tried to get it active.


aaah, I thought that you want a replacement for


has anyone used ions in production and can vouch for it? considering using it for a small production project

Lauri Rutanen19:04:51

Does clojure have some command-line tools which are required by some clojure projects to run?


yes, the core clojure project has cli-tools that are installable via your package manager (eg. homebrew on a mac)

Lennart Buit19:04:16

some projects depend on leiningen

Lauri Rutanen19:04:05

More specifically, I am trying to run 'lein repl' in one such project's root, and I get 'clojure.lang.ExceptionInfo: Could not find clojure executable {:tried-paths ["/usr/local/bin/clojure"]}' which seems to indicate I should have /usr/local/bin/clojure

Lennart Buit20:04:44

/usr/local/bin/clojure is installed by homebrew on my macos system. What are you using?

Lennart Buit20:04:54

its part of clojure itself

Lauri Rutanen20:04:25

I was trying Fulcro (following this documentation here:

Lauri Rutanen20:04:03

So it seems it's not related to leiningen actually but how that Fulcro template is set up

Lennart Buit20:04:37

I am sorry, but I don’t know.

Lennart Buit20:04:41

maybe ask in #fulcro ^^!

Lauri Rutanen20:04:00

Yeah! good idea, thanks Lennart 🙂