Fork me on GitHub
#off-topic
<
2021-02-11
>
dpsutton00:02:58

i just checked the prospectus for stange loop. surprisingly affordable tiers to sponsor and support strange loop. worth highlighting to people at your jobs as I just did

👍 4
dpsutton04:02:16

does anyone remember a zach tellman library that use de Bruijn numbers? I remember it from about 5 years ago but don't have it locally at the moment

Brennan C11:02:12

He worked on an integer map representation that got adopted into contrib as int-map: https://github.com/clojure/data.int-map/blob/9dc6659ed26f0523d62448b0766b9bf746afa754/src/main/java/clojure/data/int_map/Nodes.java#L49 (there may, of course be something else too).

dpsutton14:02:30

That’s the one! I found it late last night by writing a script to download all the clojure and ztellman repos and grepping for it. Thanks

👍 4
Vincent Cantin11:02:41

I made 2 small macros for -> and ->> threadings which let you plug a let in the middle. Please let me know what you think about them in a thread here in Slack. https://twitter.com/VincentCantin/status/1359828282519130114

Vincent Cantin12:02:08

I am thinking to add them to an utility library at some point, and I would be interested in critics to improve them.

Alex Miller (Clojure team)13:02:50

And the problem you’re trying to solve is ...

Vincent Cantin13:02:07

Staying in the flow of the parent -> or ->>

Vincent Cantin13:02:27

It can be useful for ad hoc data transformation, e.g.

(-> ...
    (->let [{a :a, b :b} _] {:a b, :b a})
    ...)

Alex Miller (Clojure team)14:02:11

have you ever considered ..... not being in an -> form? :)

Vincent Cantin14:02:50

yes, it is possible 🙂

Alex Miller (Clojure team)14:02:33

as-> is probably shorter than what you're doing too

Vincent Cantin14:02:43

I had the context of “writing fast” in mind, for situations like the Advent of Code where the time to a solution is very important.

Vincent Cantin14:02:24

as-> works only for a single binding and single body. In the heat of time-pressured coding, having a multiple binding and multiple body is helpful.

Vincent Cantin14:02:14

->let also maintain a better code readability, and it is also very important for speed.

Alex Miller (Clojure team)14:02:11

I guess I find writing fast usually means spending twice as long debugging later :)

😁 8
Vincent Cantin14:02:05

Yes, that’s exactly why it has to also stay readable, from my experience in the AoC 2020.

Alex Miller (Clojure team)14:02:28

bespoke flow control is rarely more readable imo

seancorfield17:02:40

I agree with Alex here -- I see a lot of people inventing their own threading macros and they are nearly all weird and, unless you know the macro's semantics well, they make the code much less readable for other people (and also for your future self).

👍 4
seancorfield17:02:29

That said, at work we have condp-> and condp->> which are like cond-> and cond->> but also thread the value through the predicate. We use them very rarely and I wouldn't use them in public OSS (although we've open-sourced them so others can "hang themselves" if they wish 🙂 ).

seancorfield17:02:18

An example of this hard-to-read macro-based code is the Tupelo libraries, IMO: I see one of their users (one of the authors, I believe) answering questions from beginners on Stack Overflow and their answers are always based on some Tupelo code that is going to be much less useful to beginners than answering using just plain old Clojure code.

💯 4
seancorfield17:02:52

(and they also always link to their own curated "Clojure resources" page instead of the official pages!)

Vincent Cantin17:02:32

The custom threading macro which I used the most was comp-> , it uses comp but with the arguments in the reverse order. Do you think that this one be more easily accepted and/or understood?

seancorfield17:02:51

I think that would make code much less readable for other people.

Vincent Cantin17:02:38

I will write those wise words in the Readme file of the library, if one day I create it: “do not use in team-based projects”

seancorfield17:02:08

Especially given the core comp function already seems to behave in two completely different ways: plain comp as a wrapper and comp-in-transducers.

seancorfield17:02:37

(comp f g h) means (f (g (h %))) so it's h, then g, then f but when you see (into #{} (comp (map inc) (filter even?)) data) then it is "as-if" it was map inc first, then filter even?, when applied to the data.

3
Vincent Cantin17:02:13

Originally, I wade comp-> with AoC in mind. The goal was to be able to write the code in the order of thoughts without having to move the cursor backward. I still believe that in this very particular context (AoC), it is a good usage.

Vincent Cantin17:02:02

In AoC, it is faster for the programmer to combine functions via -> or ->> compared to transducers because: • sometimes we don’t fully know what we are writing in advance • we may need to add a sort step in the middle of a ->> at any time, which can’t be in a transducer

Vincent Cantin17:02:28

But yes, I agree that comp is already confusing without comp-> 🙂

seancorfield17:02:26

I think that just suggests that programmers aren't yet familiar enough with transducers to reach for them as the natural "first step" -- and that's no sleight: transducers are "relatively new" and a lot of people definitely struggle with them. Even with a decade of Clojure under my belt, I still don't always reach for transducers -- when they would be the "best" choice for the solution at hand. I'm slowly getting better about that 🙂

Stuart13:02:36

Can I please vent about the traumatic lunch break I've just endured?

Stuart13:02:37

I've just had the most traumatic lunch break... I was making dinner and went to put some bits of onions and stuff down the garbage chute. But it was blocked. There was a bag half down the chute and half in the chute. My neighbour had overfilled a bag and it got stuck. I tried to yank it to free it, but it wasn't budging. Finally I yanked hard enough that half the bag and its contents came flying out at me and all over the communal area floor... My neighbour has a small child, barely a toddler. Still in nappies. Rotten food and nappies everywhere. Everywhere I just stood for a few minutes in complete disbelief that this had just happened. There's no way I can be surrounded by rotten food and dirty nappies, just no way. This doesn't happen. I don't have a child, there's no way I could ever have to deal with multiple nappies and all the shit that goes down a garbage chute. I just couldn't process it. My neighbour wasn't home, probably for the best, honestly. Thank god I have surgical gloves. I got it all picked up and re-bagged into bags that fit down the chute and then had to get a basin of water and bleach and scrub the floor. All this while my lunch was cooking, it ended up completely ruined. Then I hear my neighbour coming home. OK. Count to ten, breathe, stay calm... I'm a rational adult. It was a mistake. It's dealt with. My neighbour doesn't speak great english, I think he was well aware I was pissed at him. And I think he grasped that the cause of my displeasure was something in the direction of the rubbish chute, but I'm not convinced he fully grasped the hell I had just been through because of him. Or how much I wanted to kill him. I need a shower, a beer, and I'm still hungry.

4
Audrius14:02:18

revenge is only you can do 😞

😈 4
p-himik15:02:00

I doubt revenge would be beneficial for either party given that the neighbor haven't done anything deliberately and likely still has no idea what have happened. A shower, a beer, and some food would be much better. And knowing the tensile strength of the garbage bags your neighbor uses. :)

🍻 4
🍺 4
Stuart15:02:53

ive had a couple of beers, and got cleaned up. Feeling a bit better now.

Stuart15:02:39

It's just I have a massive stressor in my life right now. And little things like this I don't need right now! It makes me feel like the universe is just piling it on.

Dane Filipczak16:02:17

That sounds awful, I’m sorry it happened to you.

andy.fingerhut17:02:24

Yeah, that is a bad day. Hopefully you can find good ways to reduce your stress level on average, long term, but I know that is generic and thus perhaps frustrating advice.

4
Audrius17:02:40

@U013YN3T4DA you said you had a couple of beers to calm your self down. You should have some more and update us with the state...

borkdude16:02:05

I think the link to differences between Clojure and ClojureScript is out of context here: https://www.lihaoyi.com/post/FromFirstPrinciplesWhyScala.html

👍 4
John Conti17:02:14

IMO https://mortoray.com/2013/08/13/we-dont-need-a-string-type/ is why traditional “type-safe” programming languages are unsafe to use for business long term. This is a forrest of decisions that cannot be made “better” for all contexts and are very hard to change. Without an optimum answer the choice cannot produce value. And they make work, so they detract from product velocity. In the days of shrink-wrap software they did provide product quality assurance that produced value. Obviously this generalization does not apply to the Haskell/ML world, that has other issues in most contexts, or “hosted languages like Typescript/Clojure(script).

dharrigan17:02:50

This makes my eyes bleed

dharrigan17:02:52

@ implicit def ExampleTuple[T: Example, V: Example]: Example[(T, V)] = new Example[(T, V)]{
    def value = (implicitly[Example[T]].value, implicitly[Example[V]].value)
  }

😂 39
seancorfield17:02:12

That sort of thing is why I switched from Scala to Clojure a decade ago! 👀

11
dpsutton17:02:34

people complain about parens too 🙂. I've had great success with both C# and F# (particularly F#) in a past job.

manutter5117:02:00

Any linux gurus around? I’m trying to remember the name of a thing I used to use. The idea was I have a program named “foo” that handles incoming requests on port 1234, but I don’t want to leave it running all the time. There was a linux thingy that would fire up “foo” for me whenever it detected an incoming request on port 1234. Does that ring any bells? Might be old/obsolete.

tvaughan17:02:14

inetd (and /etc/inittab or /etc/inetd.conf)

tvaughan17:02:11

I'm sure there's some systemd replacement for it now, although I don't know what that is

manutter5118:02:32

inetd! That was it, thanks!

👍 4
Brett Snyder18:02:29

you can use a socket unit for systemd as well

rwstauner18:02:49

xinetd is another incarnation

rwstauner20:02:46

also, i built a standalone utility to do this with tcp servers a few years back: https://github.com/rwstauner/ynetd mostly so that a really complicated docker-compose setup could hold off on running some things until they are actually used, also can be configured to shut them down again, etc.

manutter5121:02:32

Cool stuff, guys!

chepprey00:02:51

There's another technique, may be somewhere between "interesting" and "ridiculous security through obscurity", but have you heard of "port knocking"?

manutter5114:02:37

That sounds interesting. I wouldn’t call it security through obscurity, I’d call it “shared secret.” It’s no less secure than entering a pin, and pins only have 10 digits.

manutter5114:02:00

By the way, as a follow-up to my original question, our overworked sysadmin guy finally had time to sit down (virtually) and talk to me, and it turns out we’re not even using nginx for the proxy, it’s all on a load balancer on a completely different machine. It fooled me because I ssh in over vpn to an internal numeric IP, but my browser connects over a public .com address. It was nice to think back to the “good old days” of inetd tho. 🙂

tvaughan14:02:29

> It was nice to think back to the “good old days” of inetd tho. :hugging_face:

manutter5117:02:28

Backstory is my Clojure web app isn’t getting the X-Forwarded-For header from nginx, and I accidentally discovered that my app works just fine even when nginx is completely shut down, so I’m trying to discover what service or process or whatever is forwarding web requests to my app.

hiredman17:02:02

The missing header suggests something below the level of http, so maybe a firewall is redirecting traffic from one port to another

Thomas Moerman21:02:14

Hey guys, do you sometimes experience reluctance of "calling it a day" out of fear of losing your mental context while working on some stuff?

Kelsey Sorrels21:02:37

Used to a lot more, but now I reckon my boss isn't running a charity and neither am I

☝️ 15
manutter5121:02:06

It usually hits me late Friday afternoons. I’ve been dealing with it by opening up a document called “Monday ToDo” and brain-dumping my mental state with instructions on how to resume work.

👍 10
eccentric J22:02:40

Yeah… I stayed up until 5 AM getting the Clojure on Shared Hosts via CGI article, repo, and example site all prepared for the announcement. The next day was not pleasant but at the same time it would have been another 20 hours before I could return to the project if I went according to schedule.

🍻 3
eccentric J22:02:44

Granted, it was because I was enjoying the project and was excited to share it. As for work that hasn’t been an issue lately since I started using the zettelkasten technique for note-taking\organizing knowledge.

👍 3
eccentric J22:02:58

Ooh could probably combine manutter51's technique with zettelkastens. I’ll have to try that!

borkdude22:02:12

Can someone explain to me what zettelkastens is in one or two sentences? I keep hearing about it

eccentric J22:02:31

It’s still a rough draft, needs elaboration on process and digital solutions, and you’ll need to forgive my handwriting but hopefully this helps explain it concisely.

nice 18
borkdude22:02:46

Great summary, thanks

👍 3
vemv01:02:35

> Hey guys, do you sometimes experience reluctance of "calling it a day" out of fear of losing your mental context while working on some stuff? Just did today! I went on bit of a coding rampage, as I knew that if I wasn't done with it, the whole initiative would lose momentum. my boss isn't running a charity is a great point. But maybe in covid times I'm more willing to borrow hours from my non-work life - I can 'return' them later without having missed any concert or football game ;p

oxalorg (Mitesh)07:02:51

> Just did today! I went on bit of a coding rampage, as I knew that if I wasn't done with it, the whole initiative would lose momentum. Exact same thing happened with me yesterday and I ended up working for around 11 hours, luckily I have the freedom to choose my own times. So if I work a bit more today, I can work less tomorrow 🙂

Thomas Moerman08:02:56

@U8WFYMFRU a while ago I switched to Roam Research (fun fact: powered by Clojure) for note taking in the vein of Zettelkasten, that definitely helps to "let go" of something for a while. I do get stuck sometimes when trying to explain something abstract/complicated in prose to my future self, clarity takes practice.

danieroux09:02:58

Also a fun fact, that I just discovered about Roam: If you export your database as EDN, the file starts with #datascript/DB! … a self-described, schema-in-band dump of my whole Roam DB, with Datalog as my query language. All lock-in concerns I had just vanished.

euccastro10:02:33

there's a org-roam too, if you're using emacs

euccastro10:02:05

it doesn't interface with roam AFAICT, it's just an implementation of some of the core ideas in emacs

Thomas Moerman11:02:10

https://youtu.be/RCCigccBzIU?t=392 "For myself, the most important thing has been the daily discipline of neatly writing down your thoughts and what to do" -- E. Dijkstra

eccentric J15:02:12

In how to Take Smart Notes by Sönke Ahrens which covers more about zettelkastens. One particularly applicable quote: > The brain doesn’t distinguish between an actual finished task and one that is postponed by taking a note. By writing something down, we literally get it out of our heads. This was in response to the findings now known as the Zeigarnik effect: > Open tasks tend to occupy our short-term memory - until they are done

Thomas Moerman08:02:30

Wow interesting. Never heard about the Zeigarnik effect before.

genekim21:02:05

Freaking awesome, @U8WFYMFRU!

Thomas Moerman21:02:41

Feature request: an IDE that shuts itself off automatically after x hours of activity

jjttjj21:02:54

yeah I definitely do that

eccentric J22:02:31

It’s still a rough draft, needs elaboration on process and digital solutions, and you’ll need to forgive my handwriting but hopefully this helps explain it concisely.

nice 18