Fork me on GitHub
#clojure
<
2020-02-01
>
stand00:02:30

I don't think so @christian.gonzalez because the datafied version of the object depends on the needs or capabilities of caller. I want something that works sort of like HTTP's content negotiation where a client specifies via an Accept header what the response should look like.

emccue00:02:56

Lein scalac is fairly old at this point, but i can't tell if its old "it works don't worry about it" or its old "no longer works and not maintained"

emccue00:02:27

I am leaning toward the second one because scala 2.9 is depended upon directly

andy.fingerhut00:02:31

I have no idea, but perhaps it is "works for whatever versions of Scala are compatible enough for your purposes with 2.9?"

andy.fingerhut00:02:14

which might be no purposes at all, if Scala changed too much between the version you want to write, and 2.9

emccue00:02:44

im potentially moving some scala 2.12

emccue00:02:54

and it did change enough that it wont compile

andy.fingerhut00:02:38

The README mentions "if you need runtime support". Not sure what that means, precisely, but have you tried without adding that dependency?

emccue00:02:20

yeah, seems like its not going to happen

emccue00:02:29

hello maven i guess

emccue00:02:17

can sbt build clojure?

andy.fingerhut01:02:52

Not that I know of. Keeping Scala and Clojure source in separate projects is one option, but maybe not what you prefer

emccue01:02:28

yeah - I am going the rewrite it route right now

seancorfield01:02:59

After the extremely painful 2.7 -> 2.8 migration, we decided not to migrate to 2.9 and then we rewrote our Scala code to Clojure instead.

👏 8
emccue00:02:52

but I want that to not be true since I want to add a few scala files to my project without a rewrite

emccue01:02:04

Unrelated, is there a way to make reify dispatch on overloaded method names differently

emccue01:02:26

I have a Visitor interface with a bunch of visit declarations in this library

emccue01:02:07

nevermind it wont even compile if i dont

emccue01:02:01

I am the dumb

lvh02:02:46

Does anyone have any suggestions for exploratory data visualization in a large-ish (~40MB with nippy) tree-like data structure? I'm thinking data-frisk-reagent maybe? cider-inspect mostly works, but I'm looking for something I can customize more easily (for example, I know the tree is highly unbalanced and different trees are similar but unbalanced in different ways -- so being able to e.g. show some keys with a bigger font or different color or whatever based on the weight of the data behind them is valuable)

lvh02:02:09

unfortunately most treemap search results appear to be about treemap the data structure not treemap the viz technique 🙂

vemv14:02:58

REBL, while not tremendously graphical might be suitable given its laziness

orestis07:02:49

Try your hand at Oz/Vega perhaps? Not sure about practical performance limits.

lvh15:02:14

yep, messing with oz next, just not obvious how to get event streams working (and it feels like I'd mostly want the event management happening in clojure)

lvh15:02:16

but I'll give it a shot

ro605:02:15

I have a LazySeq (generated by spec-provider) and I'm trying to transform all the namespaces for symbols in the generated code (`clojure.alpha.spec` -> clojure.spec.alpha, for Spec2). For some reason postwalk-replace works, but postwalk doesn't.

jumpnbrownweasel15:02:51

@U8LN9KT2N I think nobody has replied because you didn't include any code showing what you're doing in each case, so there is no way to know why it isn't working. If you look at the code for postwalk-replace you can see it is just calling postwalk.

(defn postwalk-replace
  [smap form]
  (postwalk (fn [x] (if (contains? smap x) (smap x) x)) form))

ro622:02:47

I'm confused by the difference in behavior here.

ro622:02:12

@UBRMX7MT7 Yeah, sorry. I got pulled away the other day before I could post the code. Thanks for responding.

jumpnbrownweasel22:02:35

I see what you mean. It looks like the str is consuming the outer sequence while converting it to a string. converting the outer seq to a string.

(walk/postwalk str (seq [1 2 3]))
=> "clojure.lang.LazySeq@13291"
(walk/postwalk #(if (int? %) (str %) %) (seq [1 2 3]))
=> ("1" "2" "3")

jumpnbrownweasel22:02:47

Or maybe it's not consuming it, it's just that it is converted to a string and therefore no longer has any children to traverse.

ro622:02:25

Interesting. My actual case though will be a function that splits apart a namespaced symbol and changes the namespace. I think I can figure out that inner function on my own, but I'm surprised the inner fn affects how poswalk navigates the sequence.

ro622:02:17

Also, postwalk-demo shows that the first element visited isn't the whole collection, it's the first symbol in the first collection, so it's starting at the leaves.

jumpnbrownweasel22:02:56

Yes, so it converts the leaves to strings, then converts the sequence of strings to a string.

ro622:02:18

I just looked at the impl. I think I get it now

jumpnbrownweasel22:02:27

The fn you're passing isn't an inner fn, it's used for both inner and outer forms.

ro622:02:41

My inner fn needs to return the argument unchanged in cases where I'm not trying to replace.

ro622:02:02

Right, it's not like map, it controls the recursion too

jumpnbrownweasel22:02:03

It lets you convert the parent forms as well as the children.

jumpnbrownweasel22:02:33

Plain walk gives you control over the recursion, in fact you have to recurse yourself.

ro623:02:03

For future reference, this worked the way I wanted.

ro623:02:33

Yep, thanks for your help.