Fork me on GitHub
#off-topic
<
2022-03-25
>
adi14:03:37

Well, a rude network outage challenged my demo at virtual FnConf today, but at least the definitions made it through :) https://twitter.com/BagmarAnand/status/1507274854550192132?s=20 and https://twitter.com/BagmarAnand/status/1507275279198306306?s=20

adi14:03:38

Although, it was good because the true subject of the talk revealed itself to me, after I finished giving the talk. I believed I had N ways to FizzBuzz in Clojure, but I think I have N ways to decomplect FizzBuzz in Clojure. šŸ™ƒ

Adam Kalisz15:03:50

You might want to have a look at: https://orgpad.com/s/iByMMbKLBnq for a comparison of lazy seq fizzbuzz approach and some other playful ideas :-)

adi09:03:59

@U01BXSTEB2S Thanks for the pointer. I noticed two implementations of FizzBuzz, but am unable to find more. I noticed both those versions use println, which I consider to be a deeply problematic choice in Clojure FizzBuzz. https://www.evalapply.org/posts/n-ways-to-fizzbuzz-in-clojure/#le-fizzbuzz-classique attempts to illustrate the trouble with println-infused fizzbuzzes.

Adam Kalisz09:03:59

It just illustrates two approaches. One "traditional" and the other with lazy seqs which for many novices seems rather less intuitive. The whole OrgPage is suitable as an interactive introduction to Clojure thanks to @U0L91U7A8 and @UFHE11C83.

adi09:03:09

Aaaaah ok!!! Since it was in reply to my oddball tour through Clojureland using FizzBuzz as a device, I thought that it was some sort of deep dive into FizzBuzzery! :) --- Aside: personally, I stay away from println when introducing Clojure to novices, for reasons noted in the post above.

Ben Sless15:03:35

Stray thought, how much did we lose out on with Onyx not taking off?

borkdude15:03:41

Sometimes these kinds of projects are vehicles for other things to take off even more.

borkdude15:03:56

The author went on to work for the Kafka people and does other cool stuff there

Ben Sless15:03:34

Did he join confluent in a dev position?

borkdude15:03:16

A similar thing happened to Storm, which started in Clojure but lead to an Apache Java project. And the learnings from those projects are still applied in other forms.

craftybones15:03:07

Has anyone written a MIDI sequencer with Javascript? If so, have you hooked it up to a DAW of some sort? What has the experience been?

craftybones15:03:26

Iā€™m not looking for these šŸ˜„

craftybones15:03:46

Iā€™ve done some overtone

borkdude15:03:52

oh sorry, I misread JavaScript for Clojure...

šŸ„² 1
craftybones15:03:44

I am curious about the MIDI API thatā€™s available.

borkdude15:03:25

Well JavaScript isn't a platform, it's a language. Node.js or browser, etc are platforms and the APIs they have might differ per platform.

craftybones15:03:28

If it works off JS, then Scittle and nbb are of course available

craftybones15:03:48

Node does have some MIDI stuff

borkdude15:03:55

True... I bet there's midi libs for Node.js you could use from #nbb

craftybones15:03:59

the browser is the one I am curious about

craftybones03:03:06

I ended up reading about WebMIDI in some detail and found that what I wanted to do was dead simple. You get complete access to MIDI devices and I was able to successfully send a bunch of notes from my browser console to my DAW.

dpsutton16:03:32

the live version is fun to play with: https://porkostomus.github.io/mecca/

craftybones03:03:08

Cool! Thanks.

adi16:03:28

paging @dave ā˜ļø

seancorfield16:03:38

I just got back from two weeks' vacation (in England) so I haven't been on Slack for a while. If you've asked questions about any of my projects and haven't gotten a useful answer, I may well have missed it at this point -- feel free to @-me in the relevant channel to draw my attention to things I've missed šŸ™‚

šŸ’œ 2
dpsutton16:03:45

hope youā€™re relaxed and refreshed!

seancorfield16:03:39

Yeah, it was a great trip! Now I have two weeks of backlog to wade through to catch up, of course šŸ™‚

seancorfield16:03:12

We put 920 miles on a brand new rental car (and only did the south of England part!).

šŸš™ 2
dgb2317:03:09

Iā€™m also a little bit of a video game enthusiast and watched some of his lectures. I think there is quite some interesting overlap between what he says and the Clojure philosophy. There is a recent one discussing Conwayā€™s Law and some of its implications. It then goes further and expands it with evolution of code over time. Worth a watch!

Ben Sless17:03:56

Definitely. One thought I had throughout the video was a lot of this optimization is similar to stuff I've done, in clj-fast for example. What he did was just compile it in his head. Fetching and calculating data in advance, eliding access patterns, could a smart enough rewriting inlining compiler do the same?

dgb2318:03:40

I donā€™t think a compiler typically has enough context

dgb2318:03:24

maybe if one would provide more meta data / annotations or something. JITs however do some really crazy things. Though I never had time to dive into this topic unfortunately.

Ben Sless18:03:33

I think something like the Haskell compiler could figure out at least everything until getting the triangles out directly

dgb2318:03:58

Is this the one where he talks about the map editor tool in The Witness?

Ben Sless18:03:57

specifically the grass placement algorithm and how he improved it from 10s to near real time

dgb2318:03:24

Ah right. Much of it was basically destroying unnecessary indirection. Ironically I think macros can be a tool for that as they are somewhat of a mini-compiler.

Ben Sless19:03:59

Exactly. But what I really want is "polymorphic" macros, sort of like the inline meta but more aggressive and flexible

Ben Sless19:03:25

polymorphic on the ability to evaluate the code

Noah Bogart19:03:20

@U01EFUL1A8M are you talking about his ā€œKilling the Walking Monsterā€ talk? I just watched that

Noah Bogart19:03:30

Speaking of Casey muratori talks, are there any equivalent talks focused on ā€œdo the simple fast thing firstā€ but in clojure? I've seen all of the rich hickey talks, so I don't need those

Ben Sless03:03:08

If you boil what he did to "prefetch, precompute, reduce dimensionality", I think I touched on it in my talk in reClojure. The code can end up less straightforward unless you just use arrays or something

dgb2318:03:48

If youā€™re an orange site reader there seems to be a theme or divide amongst comments about Clojure code bases, especially larger ones. Itā€™s either ā€œworking with Clojure is totally awesomeā€ or ā€œall the Clojure code bases I worked with were horrible - also dynamic typing etc.ā€ I only have been using Clojure for side projects and little tools. But this still seems interesting. Iā€™m almost 100% sure both voices are valid in some aspects or contexts. I may have asked something similar in the past. Is Clojure polarising in the sense of that you can create a huge mess with it quite easily but it also provides more/better tools to do the exact opposite? Is there a lack of public framework/guidelines/ā€œarchitectureā€ stuff related to Cojure that people can lean on? Are there different groups of programmers who are either very__ comfortable with static typing or with dynamic typing to a very high degree and very__ much not with the other? (Iā€™m more in the middle myself) Is it kind of the same with all programming language discussions and Iā€™m just a bit more sensitive to my favorite one?

Ben Sless18:03:25

have to take into account there might be a sampling bias, too. Some people really don't take to Clojure. If you don't work with the REPL, you're going to hate Clojure's guts, spit and curse. The very fact of a large code base is suspicious. What state was it in? Was it written in a large company which recruited developers by the bushel and trained them poorly, resulting in a poor experience for everyone?

šŸ‘ 1
dpsutton18:03:03

i feel like if you take a large codebase in any language thereā€™s a decent chance that is well tended or not well tended. Perhaps language has a tendency to push it one way or another but i would bet that that is by far not the largest driver of that

šŸ‘ 2
dgb2318:03:13

There is maybe something to be said about uniformity right? I can express more things in Clojure than in Go (in a practical sense), so there is a bigger chance that Iā€™m writing something that you will find repulsive.

dgb2318:03:32

(or myself after 6 months)

seancorfield18:03:33

For us, we started with Clojure back in 2010-ish and we were learning Clojure on the job. Plus, there wasn't a lot of guidance back then for structuring (large) Clojure projects. So with our now 130K lines of Clojure code, there are definitely parts of it that are less than ideal and the code organization overall could be improved (to say the least). We've made a couple of attempts to restructure/reorganize so there are probably, at this point, four very distinct styles of approach in our codebase.

seancorfield18:03:36

I think I'd expect a lot of large Clojure codebases to be in a similar boat at this point, since it is a relatively new language, and a lot of the current "best practices" have had to be discovered over time...?

dgb2318:03:27

Oh this sounds exactly like my experience, code is like a garden that needs tending.

Alex Miller (Clojure team)18:03:22

I would contend that all large code bases are bad once they cannot be comprehended by a single person. So yes, large Clojure code bases are bad as a subset of that. But Clojure has more tools than most languages to keep code bases smaller with better abstractions.

3
šŸ‘ 4
šŸ™ 1
Ben Sless19:03:56

Large code base -> too much code. Writing less code and having a "system oriented" language can help

Alex Miller (Clojure team)18:03:31

Whether and how well you can take advantage of that is up to the technical and (more importantly) organizational skills of the owners

adi18:03:23

> and (more importantly) organizational skills of the owners +1 Perniciously underrated and undervalued trait.

seancorfield18:03:01

I'm finding that migrating our old code to Polylith is providing structure and consistency that was missing, so that's a win.

p-himik18:03:51

Would you be able to estimate a lower boundary of loc when introducing Polylith would be worth it?

seancorfield18:03:08

I'd say it's worth it pretty much as soon as you have a monorepo that builds more than two distinct uberjar artifacts from a set of subprojects šŸ™‚

šŸ‘ 1
p-himik19:03:55

Huh, then I'll never have to use it. :D

šŸ˜ 1
dgb2318:03:50

I had a look at it and also read some of your articles. It seems very attractive.

dgb2318:03:24

On the other hand the stuff I do is very front-end heavy which isnā€™t a particular focus of the tool

ahungry18:03:30

I think in any codebase, sticking with the UNIX Philosophy is a safe bet - as Alex said, once a codebase can't be comprehended by a single person it's bad - if you keep each system in the realm of comprehension (in particular, with well defined inputs and output contracts that don't change/break) the internals of the system are more pliable at that point - after that, its just combining these smaller parts

dgb2318:03:46

Can anyone suggest a (reasonably) instructive open source project so a mediocre programmer can absorb a bit? The core library reads more like a story that builds up Clojure so Iā€™m not sure if it fits that purpose.

dgb2318:03:09

(I donā€™t mean ā€œmediocreā€ in a condescending sense talking about me here šŸ™‚)

ahungry18:03:48

instructive in what way? like a literate programming project? or something written in clojure in a tutorial fashion? or just a cleanly written/easy to understand clojure code base? (lib? developer productivity software? software for the masses?)

dgb2318:03:40

I mean in the sense of ā€œthis is a readable and consistent way of structuring a somewhat large codebaseā€

adi18:03:21

I have generally similar sentiments re: comprehension... ref: "https://confengine.com/conferences/functional-conf-2022/speaker/interview/aditya-athalye-1" > Groups cannot maintain what groups cannot understand. So, how, in a team setting, should I restrain myself to abstracting at the level of understanding of the group? This requires discipline, taste, and a teacher's mindset --- abstract the code at the rate at which one is able to abstract the people, but no faster.

šŸ™ 2
2
p-himik21:03:30

From the same page: > cowboy type astronautics Feels like a good premise for a webcomic. :D

āœ… 1
truestory 1
p-himik20:03:52

A very well-written article on the shortcomings of SQL, along with some suggestions: https://www.scattered-thoughts.net/writing/against-sql/

šŸ‘ 5
ahungry21:03:02

I'm reminded of the Bjarne S. quote - "two languages - ones everyone complains about, and ones no one uses" (clojure exempted of course šŸ˜‚ ) - the link was an interesting read, although personally I like how easy it is to do some data digging via SQL - I had a small project I did on my own of pulling records (API entries) from the nintendo e-shop - however, instead of worrying about how to write in code the things I wanted to check and display (best deal by sale etc.) I just imported all the API records into a sqlite3 database and wrote a couple small SQL queries to do it for me (https://github.com/ahungry/ahungry-eshop) - I don't think even clojure could express the record selection by criteria/sorting in a more concise manner

p-himik21:03:40

SQL is in that particular area where it's easy to do simple things, but much, much harder to do anything non-trivial. Even with a layer of e.g. HoneySQL on top. Your repo is a good showcase of that "simple things" part. But notice how you yourself had to use WHERE 1=1. :D The article I linked mentions e.g. Pandas - similar things there are just as simple. Somewhat related - % and _ in a search query in your project would lead to potentially unexpected results, but maybe it's not that important there.

ahungry21:03:12

hah very true šŸ™‚ (and thanks for the heads up about the lack of useful sanitation on the params part of the query - probably not ideal) - I think what you say also applies to a lot of frameworks in other languages that do 99% of the hand-holding for you (contrasted to clojure luminus, where it's more of a pick-and-choose) - very easy to go from 0 to 60 when staying in the predefined guard-rails - but swimming upstream when you need to deviate outside those rails

p-himik21:03:00

Right, this analogy can definitely be made. But SQL is even worse here, because the swimming becomes upstream even within the guardrails. :) For years, I've been very conservative when it comes to SQL. This article has helped me realize that my conservatism was towards relational data and not SQL itself.

ā˜ļø 2
dgb2321:03:35

This felt cathartic. I have encountered almost every of the issues discussed at some point and then begrudgingly wrote some workaround (some of them Iā€™m not particularly proud of). Good to read these from such an expert. And I agree, itā€™s such a nice tool if everything is ā€œschoolbookā€ SQL. Ad-hoc queries especially. But beyond that I had my fair share of ā€œthis cannot be the way to do thisā€ and ā€œI wish it would allow me to pass this as a parameterā€ and so on.

ā¤ļø 1
ā˜ļø 1
dgb2321:03:25

A couple of other things: migrations (even with a nice tool) always feel much more dangerous than they should. Nesting in SQL feels much more mentally taxing (per level) than in a general purpose language. And views have more restrictions than I like.

ā˜ļø 1
Drew Verlee14:03:57

Wow. Thanks for sharing this. I'm going to have to chew over the whole thing. > The success of GraphQL shows that these pains are real and that people really do want to issue rich queries directly from the client. Compared to SQL, GraphQL is substantially easier to implement, easier to cache, has a much smaller attack surface, has various mechanisms for compressing common patterns, makes it easy to follow foreign keys and return nested results, has first-class mechanisms for interacting with foreign code and with the outside world, has a rich type system (with union types!), and is easy to embed in other languages.. > It has a smaller attack surface sure, but that's comparaing apples to oranges right? Graphql has to be backed by an actual database language. I feel it wouldn't be hard to create a restricted interface to sql that clients could use. White list queries then validate args and all same things we do on the backend. Basically use macros to make it look like your thing m writing browser code but then put the query on the server.

p-himik14:03:40

> but that's comparaing apples to oranges right? No, because they are both QL - query languages. It's oranges to oranges. > Graphql has to be backed by an actual database language It has to be backed by a database. Whether interaction with the database is done via a different QL is another question. Apart from that, such an abstraction would be able to prevent common security issues with the underlying QL. > I feel it wouldn't be hard to create a restricted interface to sql that clients could use. White list queries then validate args and all same things we do on the backend. Basically use macros to make it look like your thing m writing browser code but then put the query on the server. And now you're embarking on a process of creating a new QL. :) Superficially, it seems easy. In the end, if you want to have something as expressive and useful as GraphQL or SQL, you will invariably end with something just as complex.

ā˜ļø 1
Drew Verlee15:03:23

I should avoid metaphors. Apples and oranges have a lot in common....

p-himik15:03:19

Well, it's a common saying. Comparing GraphQL to REST is apples to oranges. :) But GraphQL to SQL is definitely oranges to oranges in the context of comparing query languages at large.

Drew Verlee15:03:12

Ah, i see the distinction you're making. I was bundling sql with the database. I should have said postgres. I suppose i would be interested to hear why people used graphql when it wrapped only one ql+database. I was saying the browser ql would ideally be the db ql, only secured. I don't think the goal of graphql is to unify the fe and be, but to provide a uniform interface across multiple services and dbs.

p-himik15:03:37

I'm not sure the last part is correct.

p-himik15:03:53

It might be used in such scenario - just like SQL (depends on the backend)! - but it's not the goal.

Noah Bogart19:03:30

Speaking of Casey muratori talks, are there any equivalent talks focused on ā€œdo the simple fast thing firstā€ but in clojure? I've seen all of the rich hickey talks, so I don't need those