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
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
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).
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
Just want to bring this to everyone's attention: https://www.theverge.com/2021/2/10/22277054/slack-android-psa-password-reset-email-plaintext
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
I am thinking to add them to an utility library at some point, and I would be interested in critics to improve them.
And the problem you’re trying to solve is ...
Staying in the flow of the parent ->
or ->>
It can be useful for ad hoc data transformation, e.g.
(-> ...
(->let [{a :a, b :b} _] {:a b, :b a})
...)
Can I please vent about the traumatic lunch break I've just endured?
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.
revenge is only you can do 😞
have you ever considered ..... not being in an -> form? :)
yes, it is possible 🙂
or using as->
as-> is probably shorter than what you're doing too
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.
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.
->let also maintain a better code readability, and it is also very important for speed.
I guess I find writing fast usually means spending twice as long debugging later :)
Yes, that’s exactly why it has to also stay readable, from my experience in the AoC 2020.
bespoke flow control is rarely more readable imo
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. :)
ive had a couple of beers, and got cleaned up. Feeling a bit better now.
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.
That sounds awful, I’m sorry it happened to you.
I think the link to differences between Clojure and ClojureScript is out of context here: https://www.lihaoyi.com/post/FromFirstPrinciplesWhyScala.html
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).
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.
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 🙂 ).
@qmstuart you said you had a couple of beers to calm your self down. You should have some more and update us with the state...
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.
(and they also always link to their own curated "Clojure resources" page instead of the official pages!)
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?
I think that would make code much less readable for other people.
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”
Especially given the core comp
function already seems to behave in two completely different ways: plain comp
as a wrapper and comp
-in-transducers.
(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.
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.
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).
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
But yes, I agree that comp is already confusing without comp-> 🙂
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 🙂
This makes my eyes bleed
@ implicit def ExampleTuple[T: Example, V: Example]: Example[(T, V)] = new Example[(T, V)]{
def value = (implicitly[Example[T]].value, implicitly[Example[V]].value)
}
That sort of thing is why I switched from Scala to Clojure a decade ago! 👀
people complain about parens too 🙂. I've had great success with both C# and F# (particularly F#) in a past job.
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.
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.
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. 🙂
> It was nice to think back to the “good old days” of inetd tho. :hugging_face:
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.
inetd (and /etc/inittab or /etc/inetd.conf)
I'm sure there's some systemd replacement for it now, although I don't know what that is
The missing header suggests something below the level of http, so maybe a firewall is redirecting traffic from one port to another
inetd! That was it, thanks!
you can use a socket unit for systemd as well
xinetd is another incarnation
https://gist.github.com/kylemanna/d193aaa6b33a89f649524ad27ce47c4b
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.
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?
@jayzawrotny 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.
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.
there's a org-roam too, if you're using emacs
it doesn't interface with roam AFAICT, it's just an implementation of some of the core ideas in emacs
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
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
Wow interesting. Never heard about the Zeigarnik effect before.
Freaking awesome, @jayzawrotny!
Feature request: an IDE that shuts itself off automatically after x hours of activity
</rant>
yeah I definitely do that
Used to a lot more, but now I reckon my boss isn't running a charity and neither am I
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.
Cool stuff, guys!
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.
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.
Ooh could probably combine manutter51's technique with zettelkastens. I’ll have to try that!
Can someone explain to me what zettelkastens is in one or two sentences? I keep hearing about it
Great summary, thanks