Fork me on GitHub
#clojure
<
2021-12-26
>
Ho0man06:12:25

Hi everyone, Suppose I write a custom class loader ... how can I make my JVM  to add this class loader to its hierarchy of classloaders ? (Also are there any special concerns I need to address while using Clojure compared to Java when setting custom class loaders ?) Thanks a lot ----- This is sort of a follow up question to this https://clojurians.slack.com/archives/C053AK3F9/p1640024375266700.

FiVo08:12:28

Hey. I don't if it helps but try https://github.com/lambdaisland/classpath and maybe read the corresponding article https://lambdaisland.com/blog/2021-08-25-classpath-is-a-lie. It explains how to add a dynamic classloader.

Simon11:12:48

Can this be done in a better way?

(defn left-par? [par]
  (condp = par
    "(" true
    "{" true
    "[" true
    "<" true
    false))

bortexz11:12:14

you can use a set to test for presence:

(#{"(" "{" "[" "<"} par)

👍 2
bortexz11:12:58

Then the set itself is the function:

(def left-par? #{"(" "{" "[" "<"})

👍 1
ribelo11:12:10

or (#{"("...} par)

p-himik12:12:14

Also, condp = can be replaced with case for compile-time constants.

(defn left-par? [par]
  (case par
    ("(" "{" "[" "<") true
    false))
It's not as useful in this particular case but definitely should be used in place of condp = where possible. Finally, in this particular case you might find String.contains to be the best solution:
=> (.contains "[{<(" "(")
true

FiVo16:12:08

Is it possible to access private members in extend-type?