Fork me on GitHub
#clojure
<
2020-02-21
>
dpsutton05:02:49

how can i reify a functional interface? https://docs.oracle.com/javase/8/docs/api/java/io/FileFilter.html naively it would be

(reify
  .FileFilter
  (accept [^.File file]
    (not (.isHidden file))))

ghadi05:02:42

Need the this argument @dpsutton (ignored)

ghadi05:02:23

Add an _ to your param vec

dpsutton05:02:45

oh of course. thanks @ghadi πŸ™‚

robert-stuttaford05:02:24

is there a channel on here specifically to do with the clojure runtime as installed by homebrew? seems it now automatically installs openjdk 13, which is problematic because we're still all the way down on 8, which then makes this issue occur https://github.com/clojure-emacs/orchard/issues/20

seancorfield05:02:51

@robert-stuttaford I'm a bit surprised by that since I've used homebrew to install and upgrade clojure a lot on both macOS and Linux and never seen it install a JDK...

robert-stuttaford05:02:17

i know, right! i had to brew remove openjdk --ignore-dependencies to fix it

βœ— brew info clojure
clojure: stable 1.10.1.510
The Clojure Programming Language

/usr/local/Cellar/clojure/1.10.1.510_1 (11 files, 18.6MB) *
  Built from source on 2020-02-21 at 05:06:22
From: 
==> Dependencies
Required: **openjdk ✘**, rlwrap βœ”
==> Analytics
install: 7,516 (30 days), 17,701 (90 days), 58,798 (365 days)
install-on-request: 7,425 (30 days), 17,484 (90 days), 58,045 (365 days)
build-error: 0 (30 days)

seancorfield05:02:56

What JDK/JRE did you have installed before you tried to install Clojure?

robert-stuttaford05:02:32

yeah, this homebrew change is going to catch a lot of people.

seancorfield05:02:37

OMG! They switched from "any Java >= 1.8" to "openjdk"?

robert-stuttaford05:02:58

seems this person has been doing it to a bunch of brew recipes https://github.com/Homebrew/homebrew-core/commits?author=reitermarkus

seancorfield05:02:53

Wow... I commented on the Clojure one but that's like an entire "campaign" 😐

robert-stuttaford05:02:25

going to be an interesting couple days for planet Clojure πŸ˜–

hindol05:02:08

The last comment: That's because it's not officially supported.

robert-stuttaford05:02:29

neither is gravity, but here we are, stuck to the surface of the earth

seancorfield06:02:05

Latest response @robert-stuttaford

Because we are migrating to openjdk. We want our libraries and code to run with the latest version of java/openjdk if possible.

This is going to break a LOT of people's experiences with Java-based HomeBrew projects.

If anything is broken for you, please open an issue, we will have a look. But since the migration campaign has started, we did not get that many bug reports.

seancorfield06:02:16

So I guess you need to report your breakage πŸ™‚

robert-stuttaford06:02:09

thanks - i'll do so! i doubt they'll do anything with my info though, because the breakage is actually inside cider

seancorfield06:02:47

Then I have very little sympathy πŸ™‚ Sorry, I shouldn't be mean about CIDER but my life has been calmer since I no longer have to deal with nREPL/CIDER at all.

robert-stuttaford07:02:16

you're on a pure socket repl, right? i'm just so used to cider + clj-refactor, it'd be a mega yak shaving contest to ween myself off of it!

seancorfield17:02:38

What do you use in cider/clj-refactor? And, yes, pure socket REPL -- zero dependencies (I don't even bother with Compliment since Atom/Chlorine does auto-complete pretty well on its own -- it will leverage Compliment if it's on the classpath for "better" auto-complete etc)

robert-stuttaford10:02:22

i lean heavily on cider's print-to-buffer and inline printing stuff, and clj-refactor's clean-namespace and a handful of other code munging tools, like introduce-let, expand-let and friends man, a clean dependency-free repl sounds like it must be fast!

seancorfield16:02:38

Interesting. I find paredit and parinfer to be sufficient -- I guess I'm not a fan of tools that try to rewrite my code. And, yes, it's fast with no middleware and no dependencies -- and, best of all, it's the same dev/test experience regardless of whether the process is local or remote (I regularly connect my editor to socket REPL processes not running on my machine).

robert-stuttaford08:02:22

yeah, we basically just put cider and clj-refactor into our production apps πŸ™ˆ

hindol05:02:36

Seems like they are closing any requests to revert back to any existing Java on system.

hindol05:02:34

What a silly reason to waste a lot of (wo)man-hours of unsuspecting developers.

ghadi06:02:19

cask has adoptopenjdk 8,11,13 available

seancorfield06:02:22

Hmm, I'd never heard of JAVA_VERSION before reading that thread. I use JAVA_HOME extensively to switch versions locally tho'...

hindol06:02:59

Seems to me something Apple added. But still, someone's workflow is breaking and they couldn't care less.

vemv06:02:07

> But still, someone's workflow is breaking and they couldn't care less. that observation doesn't seem fair tbh. The homebrew guys are underpaid/understaffed and essentially get routinely DDOSed with lazy requests from developers

seancorfield06:02:23

The change -- from java >= 1.8 to (the latest) openjdk -- seems to be a bit of a knee jerk reaction, given that they've inflicted it on dozens of repos directly...

πŸ‘ 4
hindol06:02:47

I agree that they are doing everyone a huge favor. I love how simple/hassle-free brew is and often wished it was available on Linux/Windows.

seancorfield06:02:09

brew is available on Linux -- I use it all the time.

hindol06:02:51

Huh? That must be new then.

hindol06:02:27

I last checked almost 2 years back when I was using Linux.

hindol06:02:51

But this seems like a co-ordinated effort. I wish they explained their reasoning in a blog post at least.

πŸ‘ 4
seancorfield06:02:33

I will report back on feedback from my comments πŸ™‚

pinkfrog06:02:40

how to define a var as 0-9a-zA-z

pinkfrog06:02:47

instead of manually type it?

hindol06:02:38

Did not quite get that. Can you give an example of what you are trying to do?

seancorfield06:02:16

And the response was swift: "Because we can't test Java updates unless we're the ones shipping them. This has been going for a couple of weeks and no breakage has been reported."

seancorfield06:02:59

(I resisted the temptation to ask "How often do people try to update their Homebrew setup?")

seancorfield06:02:43

@i Yeah, like @hindol.adhya I'm not quite sure what you're asking there... can you elaborate?

pinkfrog06:02:50

in python, type: import string; string.ascii_letters

pinkfrog06:02:04

we get: Out[6]: β€˜abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’

pinkfrog06:02:10

is there any pre-defined literals in clojure?

seancorfield06:02:55

@i sorry, I don't understand what you're saying about Python there...

hindol06:02:28

Seems like Java RegEx character classes.

pinkfrog06:02:13

My scenario is that, I need a string containing all the chars 0-9A-Za-z

pinkfrog06:02:40

I can manually type them. I was just curious to see if clojure already defines such a const value.

seancorfield06:02:14

I'm curious, why do you need that string?

seancorfield06:02:47

(I'm thinking of scenarios where you can verify strings with regex or use test.chuck to generate strings from regexes...)

hindol06:02:22

Do you need each character in a string? If not, you can do (into [] "abc...zABC...Z").

hindol06:02:18

This will be a vector of java.lang.Characters.

pinkfrog06:02:01

Thanks. I see.

pinkfrog06:02:49

Is it possible to enable lazy evaluation of a def? (def val (this-form-is-evaluated-only-on-first-usage))

pinkfrog07:02:35

My closest form is to do this: (defn val (memoize (fn [] some-expr)))

pinkfrog07:02:16

it would be better if I could use the variable form val, instead of invoked the val as a function (val) in the second approach.

p-himik08:02:03

It's not that different from a memoized function with no arguments - you still have to change the calling code.

hindol08:02:33

True. But memoize with a no-arg fn looks a little odd to me. Preference I guess.

noisesmith18:02:40

also delay lets you use realized? to ask if it's been forced yet, and it lets you use force which is identity on non-delay values, but deref on a delay

noisesmith18:02:50

I'm a big fan of delay

noisesmith18:02:22

user=> (def d (delay (doto 42 println)))
#'user/d
user=> (realized? d)
false
user=> (= (force d) (force 42))
42
true

p-himik18:02:02

I guess I'm biased because I work with Reagent a lot. I don't like seeing @ where I don't expect an atom, especially when it's in a view. I immediately start thinking that it's a value that may change and that that change might trigger something, like re-rendering.

noisesmith18:02:06

well, the existence of force helps there too - but @ works on promises too, and futures, and both of those, like delays, only ever have one value (but will block until they have one)

p-himik08:02:43

That raises another question - why is clojure.lang.Var#getRawRoot final? Along with a bunch of other methods.

pinkfrog09:02:23

what’s the usage of ints and int-array.

pinkfrog09:02:39

(ints 3 2) is invalid.

pinkfrog09:02:31

Typewise, what’s the difference between (ints) and (int-array)?

pinkfrog09:02:25

Maybe the use case is, in clojure land, we mainly deal with (int-array [1,2,3]). When interop with java a function which passes in object[](1,2,3), we can use ints to convert it back to int[].

andy.fingerhut20:02:39

I found a few calls to clojure.core/ints in the Clojure code of the core.rrb-vector library. I do not know if it is needed there when it is used, but it appears to be used there when there really is a Java mutable array of type int for the array elements, and perhaps the cast done by clojure.core/ints is useful in producing better Java byte code then. Not sure.

andy.fingerhut20:02:24

I am pretty sure that a Java cast operation cannot change a Java array of long into a Java array of int , for example, and assuming that is true, that cannot be what the purpose of clojure.core/ints is.

andy.fingerhut20:02:12

The only type of argument that I think it makes sense to call clojure.core/ints on is an object that already is a Java array of primitive int elements, but the cast is needed so that the JVM 'knows' it, too.

hindol09:02:22

In Clojure-land, people mostly stick to vector. They are not type-bound, e.g. [1 "two" 3.0] is valid. int-array deals with Java arrays.

andy.fingerhut09:02:51

I have never seen the function ints used before. Not sure why it exists, other than what the doc string says. Not sure what kinds of arguments it accepts and can do something useful with.

thom09:02:21

I thought ints was just a type hint?

hindol09:02:41

Yeah, I have zero idea what ints is useful for.

otwieracz10:02:42

Something I am constantly being affected by is {:pre [(spec/valid? :foo fn-argument)]} failing without any meaningful error messages.

vemv10:02:11

we have a very tiny library consisting of just a helper for that: https://github.com/nedap/utils.spec/blob/master/src/nedap/utils/spec/api.cljc Usage would be {:pre {(check! :foo fn-argument)]} and it gives you a Expound-backed report (https://github.com/bhb/expound) when the precondition fails You also can build your own check! quite trivially

otwieracz11:02:29

Yeah, but this requires me to change every single usage..

otwieracz11:02:03

Can I somehow override valid? globally in my code?

otwieracz11:02:25

I've tried providing my own:

otwieracz11:02:09

And while i am able to load this file in REPL, I am not able to build uberjar (seems like original clojure.spec.alpha is not loaded before I start overriding things with my implementation)

vemv11:02:57

Overriding namespaces, or doing monkey-patching is quite frowned upon in the clj world https://twitter.com/stuarthalloway/status/1229856488560234497

otwieracz11:02:18

I had no luck with bind:

otwieracz11:02:19

=> 
(set! spec/valid? valid?)
Execution error (IllegalStateException) at hermes.debug/eval29194 (form-init4832872063532060265.clj:1).
Can't change/establish root binding of: valid? with set
class java.lang.IllegalStateException

vemv11:02:42

that's a setting not a binding :) It's certainly possible to perform the binding in dev and prod alike

otwieracz11:02:45

OK, I might had a success here..

otwieracz10:02:10

I totally understand why it is like so, it's clear that spec/valid? just returned nil in pre check.

otwieracz10:02:24

It's not throwing any exception on it's own or something like that.

otwieracz10:02:41

But are there any better ways to do this, debug this?

otwieracz10:02:04

Because I've got deployed instance running, it's failing one of pre-checks and I have no way of knowing why it's actually failing.

zilti12:02:31

Well, technically there is s/fdef , but it seems to just get ignored

rickmoynihan14:02:07

I literally just upgraded clojure via brew and was very confused to see it try and install jdk13

Alex Miller (Clojure team)15:02:41

please share your displeasure as needed

βž• 8
devn15:02:19

That was a quick close!

andy.fingerhut20:02:51

I expect this could be the Nth issue related to those changes that they have heard about, and their answers haven't changed on how to handle it -- use JAVA_HOME

p-himik15:02:17

It makes it sound like Homebrew's intended usage is to never leave the Homebrew ecosystem. And if you need to do that, you better extend the ecosystem wide enough with taps.

dmarjenburgh15:02:32

Does this mean clj will be run with the jdk that homebrew installs by default?

Alex Miller (Clojure team)15:02:52

clj will run with any jdk you want (just set JAVA_HOME)

Alex Miller (Clojure team)15:02:08

this is about what gets installed for you by default

Alex Miller (Clojure team)15:02:26

it used to be able to tell you already had a Java 8 installed and just proceed

Alex Miller (Clojure team)15:02:41

now it will forcibly install adoptopenjdk 13

shaun-mahood16:02:00

Looks like they've done it for Maven as well https://github.com/Homebrew/homebrew-core/issues/50531, which somehow seems even more clueless to me.

Alex Miller (Clojure team)16:02:49

in general, I have found that the homebrew maintainers are not too familiar with the java ecosystem, which I'm not slighting them for, they can't know everything

Alex Miller (Clojure team)16:02:05

but it's frustrating sometimes

Setzer2216:02:57

I'm trying to send binary data (audio/wav) using http-kit, but it seems unless I set the content-type the server at the other side will ignore my request. Is there a way to set it?

Setzer2216:02:58

basically I need to do this request in clojure:

curl -X POST "" -H  "accept: application/json" -H  "Content-Type: audio/wav" -d {}

gerred16:02:48

fwiw homebrew users: I've recently been giving asdf a spin for java and graal env management (and other tools now), maven works, clojure seems to work but for some reason is only parsing down to 1.9.0, so I'm going to add an asdf clojure as well real quick (and will post it in a threaded reply to this message here in a few hours).

gerred16:02:48

oh, it looks like @U08JQ8RD0 maintains it! πŸ™‚ wdyt about a PR that takes a bit more of an https://github.com/vic/asdf-clojure/blob/master/bin/list-all approach so other versions are available?

gerred16:02:01

annoying it has to be like this, but Β―\(ツ)/Β―

sparkofreason17:02:22

Is there a way to force java classes to reload in the REPL? I'd like to be able to edit the java source, then compile the class and reload it so the new class definition is bound to the class name symbol.

p-himik17:02:15

> Now, as if by magic, every time the .java files on your :java-source-paths change, they will be recompiled within your REPL and all the namespaces that rely on those files will be reloaded.

sparkofreason18:02:02

Thanks. I may use that, though right now I'm using clj not lein. Maybe I'll look inside virgil and unwrap the magic.

p-himik18:02:06

Yeah, I started doing that some time ago (before I realized I didn't really need Java for my task), and it seemed that hooking it up to whatever you use should be pretty straightforward.

4
sparkofreason19:02:45

Yeah, it's doing (refresh-all) at the core. I don't really want to reload all of the clojure namespaces, just get the new java class defs correctly loaded and bound.

hindol18:02:53

Is there a way in Clojure to simply write some Java code inline? If not, what is the way to do this with minimum fuss? Not talking about calling some existing Java code somewhere else.

andy.fingerhut18:02:30

I know you said that you are not talking about calling some existing Java code somewhere else, but I believe that the minimum fuss way is to create the Java code you want to call as separate files, compile them to JVM byte code, and then use Java interop calls from Clojure.

bfabry18:02:23

I'd be interested to see the java code you want to inline. I think a lot of the time people just aren't aware of the clojure interop version. but yeah as andy said for the few instances where you can't use interop the minimum fuss way is to write a java class

hindol18:02:34

I don't have a very specific thing in mind, but as a hobbyist I do problems from Project Euler and the thumb rule is the solution should run within a second. I can rarely clear the bar if ever. I want to basically right the hottest part in pure mutable Java.

bfabry18:02:25

there are things that are faster in java land than any equivalent in clojure land, but it's unlikely that that is what you're encountering. most likely you can get as fast as you need to writing optimised clojure

robertfw18:02:16

If you are looking to leverage mutability for performance, take a look at transients: https://clojure.org/reference/transients

hindol18:02:38

@UG00LE5TN Yeah, tried that. Not fast enough. The only way it is fast enough is when I can do pure primitive math with absolutely no (un)boxing. There are basically two ways. Use the Java array types or restructure code to be loop/recur with primitives.

hindol18:02:17

Have spent quite a bit of time on this, so I know this much.

hindol18:02:37

@U050MP39D Sometimes I can reach as close as 4x to let's say the Java version. But that's a lot of fuss. At that point I wish I can simply use some Java. But that is also a lot of fuss, πŸ™‚

bfabry19:02:53

fair enough, loop/recur with primitives was the kind of thing I was referring to so if you're down that low it probably is worth dropping to java. I would love to see an example though

hindol19:02:56

On my phone but I will post back later. But I have recently started fiddling with clj-java-decompiler and that's a lot fun too. I am not an expert yet. Maybe I will uncover a few new ways of optimizing the Clojure versions.

hiredman18:02:59

ugh, well, actually

hiredman18:02:27

there is a thing

dchelimsky18:02:44

You can use that to write java programs.

hiredman18:02:04

I am pretty sure it was written as a joke

andy.fingerhut18:02:07

That seems unlikely to be a 'minimum fuss' approach πŸ™‚

andy.fingerhut18:02:49

but I've never tried it myself. Had never seen it before. Thx for the link.

Michael J Dorian18:02:01

That's hilarious, I think (glanced over the code and just read function names) that it's actually compiled the java as text πŸ˜€

hindol18:02:27

And the project is named javastar because java*, πŸ‘Œ

Alex Miller (Clojure team)19:02:17

private maven repos are effectively an authenticated http directory. as such, they don't generically have an api to "search". so I don't think that's actually a possible thing. some repos publish an index, but generally you won't get that with the most common filesystem/s3-based approaches

Alex Miller (Clojure team)19:02:14

they publish both full and incremental updates

sparkofreason19:02:52

Where is clojure.core/import* defined?

noisesmith19:02:35

@dave.dixon it seems it (the symbol, but not var) is created via intern here https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L60 (thanks for the correction from hiredman)

hiredman19:02:48

That is just creating a symbol, not defining the thing

noisesmith19:02:19

oh - that's not a namespace intern, just a symbol intern?

hiredman19:02:02

It is just an old method

hiredman19:02:13

Symbols aren't interned

noisesmith19:02:30

thanks for the clarification

sparkofreason19:02:22

Thanks. As a side note, how did you find that? Github search-foo has eluded me...

sparkofreason19:02:00

Find the import* ...

noisesmith19:02:25

I used $ ag 'import\*' in the cloned repo locally

sparkofreason19:02:50

Ahh, that's my fallback too.

noisesmith19:02:08

I was surprised not to establish it was special via special-symbol? as mentioned further down in the main topic

hiredman19:02:38

The really interesting thing about import* is it may be the only namespaced special form

Alex Miller (Clojure team)19:02:23

I thought there were a few?

noisesmith19:02:31

so that makes sense of this

user=> (special-symbol? 'import*)
false
user=> (special-symbol? 'clojure.core/import*)
true

noisesmith19:02:59

^ that was my first stab at answering @dave.dixon’s question, but I didn't think to try with namespace haha

hiredman19:02:09

Not sure, but I think it may be the one

Alex Miller (Clojure team)19:02:35

user=> (->> Compiler/specials keys (filter qualified-symbol?))
(clojure.core/import*)

sparkofreason19:02:13

Anyway, I'm still trying to find a way to reimport java classes. Just calling import again doesn't pick up the new class definition.

Alex Miller (Clojure team)19:02:30

Compiler/specials should tell you

Alex Miller (Clojure team)19:02:44

you can't reimport Java classes

😒 4
Alex Miller (Clojure team)19:02:03

unless you do something special in the classloader

Alex Miller (Clojure team)19:02:14

Zach Tellman does have a thing for this

noisesmith19:02:25

import is a modification to the current ns, the fact that a class is loaded is a side effect of accessing it (loading is on-demand)

sparkofreason19:02:20

Does refresh-all, which I'd like to avoid because it triggers side-effects.

noisesmith19:02:44

if refresh-all triggers side effects you should fix your namespaces so it doesn't :D

sparkofreason19:02:18

It's just useful for dev. I have a dev namespace I'm working in for triggering various effects that rely on the Java. Not something to be used in production code.

noisesmith19:02:19

you can blacklist a namespace from refresh-all

sparkofreason19:02:14

I'm going to have to hack virgil then, since I don't see that it exposes that. Also using not using lein. Forking...

noisesmith20:02:14

I thought this was exposed via clojure.tools.namespace itself

sparkofreason20:02:21

Yup, that did it. So the trick was in my dev namespace, first call disable-reload! on that namespace, then virgil-watch. Thanks, I think that's going to be a big efficiency boost.

Alex Miller (Clojure team)19:02:28

if you want to use some unholy weirdness, probably excusable in dev-only mode

sparkofreason19:02:28

Yes. I just want the rapid REPL cycle, but including the java classes I'm hacking.

noisesmith19:02:05

that's what virgil is for

noisesmith20:02:17

I forgot - what's the github repo for the clj / clojure command line tools? I have a potential PR for the rlwrap config for clj

seancorfield20:02:55

brew-install

πŸ’― 4
noisesmith20:02:58

haha turns out my feature was already in there

noisesmith20:02:28

-s flag which causes all input and output strings to be added to completion history, plus -b for proper clojure symbol matching

Alex Miller (Clojure team)20:02:22

I endeavored to understand and have good config when I wrote it :) and there have been some mods over time from people. I no longer remember anything about it :)

noprompt23:02:38

Here’s something fun to play around with. πŸ™‚

user=> (extend-type (class +) IMonoidId (-monoid-id [this] 0))
nil
user=> (reduce + (-monoid-id +) [1 2 3])
6

πŸŽ‰ 12
πŸ‘€ 4
seancorfield23:02:57

Given that (+) is 0 already...

noprompt23:02:07

That’s not the point of the example. The point is that you can extend protocols to functions this way. It’s not about the details in the example. I just choose the monoid example cause it was easy.

noprompt23:02:56

It’s just something fun to play around with and I wanted to share it. πŸ˜„

dominicm00:02:17

I think the word monad took the focus the wrong direction.

seancorfield00:02:37

I think putting "fun" and "monoid" in the same sentence was the problem :rolling_on_the_floor_laughing:

noprompt00:02:11

In spite of the fact that we take advantage of monoids in everyday programming all the time?

noprompt00:02:01

Who would have thought the associative and identity properties could be such a lightening rod under the word β€œmonoid”?

noprompt00:02:10

I’d be down for a better example that doesn’t provoke eye rolling at algebra.

noprompt23:02:59

Its funday Friday!

facepalm 4
parrot 4
noprompt23:02:49

You missed the point.

noprompt23:02:20

Here’s some more point.

user=> (defprotocol IInverse (-inverse [this]))
IInverse
user=> (extend-type (class inc) IInverse (-inverse [this] dec))
nil
user=> (defn inverse? [f g]
         (= (-inverse f) g)) 
#'user/inverse?
user=> (inverse? inc dec)
true

πŸ‘€ 4
borkdude23:02:29

I think it's getting too late for me to get any points πŸ˜‰

noprompt23:02:17

The point is you can extend protocols to function classes. πŸ™‚

noprompt23:02:37

For fun and profit!

borkdude23:02:52

ah right, hack Friday πŸ™‚

noprompt23:02:12

I often do this move for singletons like

(def Thing (reify))
(extend-type (class Thing) ,,,)
and then it lol hit me that I could do it in this other devious way.

borkdude23:02:12

reminds me a bit of this code where the function name is recovered from the class name: https://github.com/borkdude/spartan.spec/blob/ff7317d67ec15f188afb856d37090e5c9509374e/src/spartan/spec.clj#L118

noisesmith23:02:28

for the same thing from the opposite direction, you can also extend a deftype / defrecord to IFn so it can be called like a function

noisesmith23:02:49

just implement applyTo for arglist and invoke for each arity

noprompt23:02:04

Yeah, familiar with that (been doing this for a long time).

noprompt23:02:15

But you could imagine tagging functions as Associative or Commutative in this way and win with algebra.

borkdude23:02:29

or SideEffecting πŸ˜›

noprompt23:02:56

Yeah, why not? THIS. IS. SPAHTAH!

andy.fingerhut23:02:08

What would you do with functions tagged Associative or Commutative , out of curiosity? Some kind of run-time checks when those functions are passed as parameters into other reduce-like functions?

andy.fingerhut23:02:47

Same question (and maybe answer) for SideEffecting ?

noprompt23:02:54

I probably wouldn’t do this in serious practice but if I’m experimenting I’d use it to explore a space where those properties are of interest.

noisesmith23:02:24

something like a reducer could automatically decide how to build a pipeline based on those tags

noisesmith23:02:19

it's the sort of auto-optimization of steps that RH explicitly talks about disliking (eg. that talk where he discusses a query planner in the context of justifying how little optimization clojure attempts)

noprompt23:02:19

Algebra is useful. 🀷

noprompt23:02:32

Optimizations and/or designs which leverage algebraic properties can be useful too. But most of this discussion is OT. I only wanted to share this one neat trick cause I thought it was just that. πŸ˜„

ambrosebs23:02:41

lein update-in :pedantic? vector :abort -- update-in :pedantic? second -- test ;; hack Friday

andy.fingerhut23:02:57

I am afraid to type that, even if you explained what it did πŸ™‚

ambrosebs23:02:28

try and implement assoc with update-in

ambrosebs23:02:58

another constraint: the function to update-in must be a resolvable symbol in clojure.core

ambrosebs23:02:15

koan: (-> {:pedantic? :warn} (update-in :pedantic? _ _) (update-in :pedantic? _)) must equal {:pedantic :abort}

andy.fingerhut23:02:08

It seems like a usage of lein that deserves a longer comment than the plugin one would write to make it clear what was happening πŸ™‚

ambrosebs23:02:28

Andy it's been a long week I'll leave it at that.

andy.fingerhut23:02:53

I wish you a shorter next week!

ambrosebs23:02:06

appreciated!

dominicm00:02:47

The obvious answer is that you should make a profile

dominicm00:02:32

I don't understand why lein calls it update-in, but doesn't take a vector.

dominicm00:02:29

Okay. Read the docs. lein update-in : assoc :pedantic? :abort

dominicm00:02:25

That doesn't seem too bad

ambrosebs04:02:59

Who said I was looking for an answer.

ambrosebs04:02:51

Sorry for the snark, I'm only showing the tip of the iceberg of more of a social/human situation. I got a bit frustrated that I can't really communicate where I'm coming from.

dominicm08:02:51

No offence taken :). The social stuff is often the hardest :(. Been there a number of times.

dominicm00:02:29

Okay. Read the docs. lein update-in : assoc :pedantic? :abort