Fork me on GitHub
#clojure-europe
<
2020-11-06
>
dharrigan06:11:31

Good Morning!

otfrom09:11:18

anyone here using or have good examples of using tap> ?

slipset09:11:33

Not using it, waiting for tap->

otfrom09:11:59

I had a look at that before and made it hang with some large values. I'll have another look

otfrom09:11:17

I think I also want to keep the data around for later processing

otfrom09:11:31

(which makes me wonder if I should be looking at doing something else entirely)

otfrom09:11:07

the process that is running some times blows up in the middle tho, so storing it all in memory and dumping it at the end doesn't work

borkdude09:11:58

fwiw, I haven't used tap> besides portal. btw portal works with babashka :)

ordnungswidrig10:11:56

I've used tap in some local dev situations, e.g. where I would send a message in prod, i tap out during development

ordnungswidrig10:11:44

With some machinery around it I can even selectively filter. Like logging but for a different purpose. And structured.

otfrom10:11:07

I think it is that "other machinery" I've not seen good examples for yet

otfrom10:11:24

other than something fancy like portal

plexus11:11:20

Nextjournal integrates tap>, and you can use their data viewer then to browse through your data. quite nifty.

plexus11:11:04

I hadn't seen Portal yet. I've used Punk but it also has no protection for dealing with big values. And it uses EDN over the wire which I find questionable.

plexus11:11:27

but at least we're getting some open source REBL-alikes

3
plexus11:11:18

today was the first time I thought about using some with not-empty, they combine well, even works with strings

(some not-empty ["" nil "foo"])
;; => "foo"

๐Ÿ‘ 3
borkdude11:11:23

@plexus portal is quite cool, he did a talk at the Apropos podcast/videocast thing

borkdude11:11:39

Alex once frowned upon my use of non-empty for strings, he recommended using str/blank? which I have been doing since :)

borkdude11:11:35

I'm not familiar with punk myself

borkdude11:11:35

Here's an example of invoking portal with babashka to view EDN files (and YAML, etc): https://github.com/borkdude/babashka/tree/master/examples#portal

plexus11:11:47

str/blank? also checks for whitespace which may or may not be the intention

plexus11:11:48

I will say one nice thing about str/blank?, it's one of the only (perhaps the only?) function in clojure.string that doesn't just explode when it sees a nil

plexus11:11:08

do you know if portal has any mechanism for incrementally fetching nested values or parts of long sequences? Unrepl had that and it's seems shadow's object inspector thingy as well, but Punk doesn't which makes its usefulness limited

djblue18:11:35

I think you might find https://github.com/djblue/portal/pull/18 interesting. Still working on it but it should address your concerns around long sequences.

plexus07:11:40

that sounds good! how about big maps or deeply nested maps?

djblue02:11:29

How big are we talking? Portal lazily renders all data structures so the bottle neck tends to be in transit which is fast enough.

djblue02:11:10

As a measure, all the analyzer data emitted by cljs works just fine in portal

plexus06:11:16

Ok that's a great benchmark. That's how I immediately locked up punk the first time I tried it ๐Ÿ˜ƒ

borkdude11:11:16

I recommend posting that as a question in #portal

borkdude11:11:46

The author is quite active so if it's not supported, maybe he will soon

genRaiy12:11:06

Itโ€™s cold out. Good morning, not to some but every

genRaiy12:11:40

What is the best way to implement inc2 and dec2 (add or subtract 2 rather than 1)? Itโ€™s obviously easy just wondering what are the craziest options!

genRaiy12:11:38

(defn inc2 [n] (reduce + (dec n) (range 3)))

dominicm12:11:26

Let the code golf begin

dominicm12:11:52

(partial + 2) and (comp inc inc) and #(+ 2 %)

dominicm12:11:08

I feel like aphyr still strike like lightning

otfrom13:11:57

I like that you can sing (comp inc inc) to oom pah pah!

๐ŸŽบ 3
mpenet13:11:44

what about a macro that creates inc incc inccc incccc inccccc, CL style

genRaiy13:11:45

don't be sorry

genRaiy13:11:32

@dominicm your suggestions are way too acceptable

dominicm13:11:09

I wanted to get them out so only bad ones would be left

dominicm14:11:41

(second (range n Long/MAX_VALUE 2))

๐Ÿ˜‚ 6
otfrom14:11:53

(first (butlast (reverse (range Long/MAX_VALUE))))

๐Ÿ˜ 3
otfrom14:11:17

wow, that does amazing things to my cores

otfrom14:11:55

no, wait, I've fallen asleep again, that's completely wrong

otfrom14:11:02

(it has been a long week)

mpenet14:11:41

(nth (iterate inc 0) 2)

mpenet14:11:50

one of the rare occasions to mess with iterate

๐Ÿ˜ 3
RAMart15:11:49

(defn inc2
  [n]
  (->> (repeatedly #(rand-int Integer/MAX_VALUE))
       (map (juxt #(- % n) identity))
       (drop-while (comp (partial not= 2) first))
       (first)
       (second)))

โณ 3
๐Ÿ˜œ 3
val_waeselynck15:11:44

Uses juxt, comp and partial, therefore is quality code.

โœ”๏ธ 6
RAMart15:11:41

Damn! I hoped that the beautiful execution time would outweighed it...

borkdude15:11:16

clojure pro bingo?

borkdude15:11:10

although I would have expected some transducer usage in there as well

val_waeselynck16:11:26

Could stick a little into in there

genRaiy16:11:43

yes, this is now the eduction channel

otfrom16:11:34

I am in this photo and do not like it

๐Ÿ˜ 3
val_waeselynck16:11:51

With luck, it might terminate before we reach a Brexit agreement. The future will tell my grandchildren.

๐Ÿ˜† 3
๐Ÿ˜ญ 3
borkdude16:11:01

I just read an article by a Dutch philosopher who thinks that it would be better if Trump won again, so we got rid of him in 4 years, instead of giving him 4 years to run again and destroy everything with more impact.

borkdude16:11:14

Now I'm confused.

val_waeselynck16:11:54

Well, he's not that young you know

borkdude16:11:19

Let's hope for the best Val ;)

genRaiy16:11:36

no way he will run again - Melania needs her divorce and he wants a talk show ... all attention no work

borkdude16:11:05

TIL that this works:

mv resources/clj_kondo.config/clj_kondo/fulcro/{README.md,src} fulcro
I tried it without reading any docs, just hoping it would work, and it did!

val_waeselynck16:11:05

If only the American voting system were that simple and predictable ;)

val_waeselynck16:11:33

Let's put clj-condo in the constitution

otfrom16:11:34

I am in this photo and do not like it

๐Ÿ˜ 3
borkdude17:11:43

@val_waeselynck btw, after reading your article on _ I now use :tag_uuid instead of :tag/uuid at work in our backend and front-end :P. Saves me quite some hassle with converting back and forth.

๐Ÿ˜‡ 3
val_waeselynck20:11:54

Somewhat predictably, underscores are underrated.