Fork me on GitHub
#clojure-uk
<
2019-01-05
>
mccraigmccraig00:01:23

it was a classic use-case though - to partition a manifold stream

mccraigmccraig00:01:59

but I had to upgrade manifold to an alpha, because there was a bug preventing stateful transducers from completing correctly

mccraigmccraig00:01:30

which also made me think that not so many people were using transducers

alexlynham00:01:13

I had two cases in a python code base where I was like "oh, I need a transducer!" & was gutted

alexlynham00:01:41

I wrote one in a tech test a while back as well b/c the test had to mock the side effect of a data pipeline and it was a clean way to just smash together a bunch of ops on like a tiny test fixture to demonstrate that the pipeline would eval to the same thing as a known result

alexlynham00:01:05

but that was a very contrived example, just happened the transducer was a neat one liner

dominicm06:01:44

Why are you all owls?

seancorfield06:01:24

(and "morning!")

dominicm07:01:12

Up in the middle of the night!

seancorfield07:01:42

Ah, yes, some of them were up very late... and you're up pretty darn early for a Saturday... big plans?

dominicm09:01:39

I have to medicate an animal, and I try to keep to my work wake up time so that Monday morning doesn't suck šŸ˜

mccraigmccraig08:01:31

@dominicm no idea why, I've always been so though

folcon11:01:39

Morning :)ā€¦

folcon11:01:21

@alex.lynham I thought I saw a python transducers lib, 1 sec

alexlynham12:01:14

I typically go to bed at 1-2am and sleep in until 8-9 when it's my choice. Feel more alert if I keep that rhythm

dominicm12:01:18

7 hours makes me sleepy

alexlynham12:01:47

@folcon thanks for the link, will have a look. Ended up jury rigging something with a comp function and then having list operations that delegated to granular ops to get a similar result. It was a lot less terse than a transducer, but still much much terser than the standard 'pythonic' solution would have been. Handed over that project to a team of java contractors muddling their way through python so given the absolute brick wall I had explaining the code design in that style (&why it was different from normal python approach) I suspect a transducer would have been a second bridge too far. I have nightmares of the whole thing being rewritten in for loops with classes all over the place already.

alexlynham12:01:51

Well at least the other day a permie colleague - who had told me that my rambling about lisp had encouraged her to look up her uni fp module (scheme, I think?) - told me she was moving over to that work stream for a bit. She's hella smart so maybe she's the hero that codebase needs

folcon12:01:55

oh, good luck =)ā€¦

alexlynham12:01:13

Well, code is ephemeral really

alexlynham12:01:39

Given the constraints (python, legacy systems surrounding the edges, big org, lack of engineer hours) it's probably the most elegant thing I've ever designed/built (with some help on the build - a brilliant colleague who now does python but had done some haskell was so much fun to pair with), but unless you're in charge and have people all at a certain level of understanding/a certain mindset, you can't be too precious about what happens when you hand something over

alexlynham12:01:55

We're just trying to ship things useful to the business after all

alexlynham12:01:12

Although it is nice when solutions are elegant and scale šŸ™‚

dominicm12:01:32

Various versions of scheme seem popular in University. A colleague mentioned PLT Scheme (racket) from University.

rickmoynihan11:01:05

Racket is really awesome as an ecosystem - they have so many super interesting toys. I do get the impression itā€™s not the fastest scheme implementation; but thatā€™s entirely subjective as I havenā€™t measured anything.

dominicm12:01:07

Dr rackets memory usage indicator is usually quite high

rickmoynihan14:01:36

Yeah Iā€™ve noticed that too but I donā€™t know how indicative that is of anything given that Dr Racket is also an IDE

folcon12:01:11

Good attitude :)ā€¦

folcon12:01:10

I remember Thing geom creator Karsten Schmidt did a lot of his lib and coding work using literate programming, has anyone found any resources about how he setup his environment or has done it for a while themselves?

otfrom12:01:45

I think he's got a lein template to help and a fair bit written up there.

folcon12:01:30

Oh? Got a link?

otfrom18:01:05

Can't find the other atm

folcon18:01:15

@otfrom Cheers šŸ˜ƒ

malcolmsparks23:01:33

I've begun to add an .adoc file next its corresponding .clj file, to discuss what the namespace is doing and why. Somehow docstrings aren't enough, and my current gut feel is to leave documentation around for future readers. The XP tendency to avoid comments just feels wrong nowadays, in Clojure at least.

dotemacs08:01:53

Not against comments, but whatā€™s wrong with just adding the explanation in git commits? Anytime you can just (magit-)blame and you can see the logic that led to that particular line of code. Also it allows you to use ā€œgit pickaxeā€ effectively. This way youā€™re documenting that particular change as you go rather than writing the code and then writing your reasoning somewhere else (which I guess is the most often brought up argument against documentation). And what do you write in the commits with .adoc approach ? ā€œFor what, see the .adoc Iā€™m committing nowā€ ? Thanks

rickmoynihan11:01:07

@U3SG7RX7A: Youā€™re spot on about commits being the place to describe the changeā€¦ Iā€™ve often done this to include various benchmarks etc describing the motivation for the change before/after etcā€¦ but theyā€™re not always the best place to describe the wider approach as that often doesnā€™t correspond to a single commit in my experience.

rickmoynihan11:01:30

I thought somewhere someone mentioned that Karsten was rewriting http://thi.ng to stop using literate programmingā€¦ as it was a barrier to others contributing/using the codeā€¦ could be wrong.

otfrom13:01:07

yeah, he has been doing that. The latest http://thi.ng/geom stuff has moved away from literate programming (sadly)

folcon14:01:43

@U050CTFRT How do you ensure things stay in sync? Or is this handled by your editor?

malcolmsparks15:01:40

Asciidoctor has this nice feature of tagged includes where you can include code snippets. Call-outs can be embedded too.

malcolmsparks15:01:37

It's not perfect and requires frequent maintenance, but that's sort of the point.

alexlynham12:01:16

Using org mode or something else?

otfrom12:01:08

Hmm... I pretty much use transducers anywhere I'd use ->>. If there is no reduce step at the end of my thread last, then I use into, if there is then I use transduce.

otfrom12:01:42

I think most people get hung up on how they are implemented rather than how easy they are to use.

folcon12:01:26

Yes, that could work, I just donā€™t really use emacs much these days, cursive works at the moment :)ā€¦

folcon12:01:56

Thatā€™s interesting @otfrom, I should give that a go as I donā€™t use them all that much at the moment =)ā€¦

alexlynham13:01:48

Hmmm indeed, that's actually a pretty good heuristic... might have to take that for a spin.

alexlynham13:01:56

And this post seems to answer my follow up thought of "besides day to day stuff, which has the best performance in what scenario" https://www.reddit.com/r/Clojure/comments/5lhz7q/seq_functions_reducers_transducers_when_do_i_use/

malcolmsparks23:01:33

I've begun to add an .adoc file next its corresponding .clj file, to discuss what the namespace is doing and why. Somehow docstrings aren't enough, and my current gut feel is to leave documentation around for future readers. The XP tendency to avoid comments just feels wrong nowadays, in Clojure at least.