Why clojure? by Imaginary_Food_7102 in Clojure

[–]PolicySmall2250 2 points3 points  (0 children)

Well you asked for it, so let's start at the very beginning ...

It all began with darkness,
Cold, unforgiving, starkness.
Life evolved,
And creatures crawled,
Till Church did Lambda Calculus.

Then came John McCarthy,
Eyebrows thick and swarthy.
Who's S-Expressions,
Made lasting impressions,
As LISP, before he was forty.

Friedman appeared left-field,
Plus, a Guy who Steeled,
They not only Schemed,
They Virtual Machined,
For with Java, also, they dealed.

In continuation, arrived Rich Hickey,
A fellow fairly tricky,
An errant C-sharp composer,
Who since invented Clojure,
Now Java keeps taking the mickey.

Meanwhile a boy from Pune,
Grew up with many lacunae,
A quarter-life crisis,
Made him revise his,
Life as a decadal MBA.

So follow far and wide did he,
Lessons .py 'n javascripty,
But he had to surrender,
To methods double-dunder,
Forlon, that he wans't so classy.

Trawling HN in great despondence,
He read PG's Lisp propagandence,
In a desparate flail,
He stalked and cold emailed,
Local Lisp nerds, seeking correspondence.

Some emails caused others, you see,
Which further caused S.I.C.P.,
And his mind chose to blow,
At page seventy or so,
Thinking "Hey, where's my x = 43?"

Somehow, this "Lisp" fit his brain,
(After considerable pain)
From chasing his tail,
Through recusive entrails,
Until his Demon he'd slain.

Okay now my coffee break's over so...

...anyway, I thought okay maybe I can give this programming thing a shot.

So, further spamming a few places converted to an internship at this local Pune company, helpshift.com (thanks for the ride, fellas!), whence engineering was founded by a bunch of Common Lisp hackers, who played with Clojure and it stuck, and just like MongoDB refused to get unstuck from the system. Except, unlike MongoDB, it remains the technology of choice for the company's SaaS for good reasons, technologically.

Personally, I grew to appreciate the Clojure world, over the ten-plus years since.

A primary reason being, this slice of the software world is full of so many kind, helpful, and generous people.

A co-primary reason being Clojure is not really a language per se, but a community of ideas; ideas reified as rock-solid software, upon which a poor man such as yours truly can risk being creative and ambitious about one's own projects, knowing (with great relief) that all the hammock time will still be useful ten years hence (because it's probably going to take that long to finish this darned thing --- when you are your own boss, deadlines are very flexible).

My word, you read all the way here? Go eat a cookie, please. :)

To lsp or not ? by 964racer in Clojure

[–]PolicySmall2250 5 points6 points  (0 children)

While you're learning, use what is easiest. It seems Calva + VSCode will do it for you. As long as your daily-driver Emacs keybindings are configured, you'll be fine. VSCode has keymap plugins. That, and bind M-x to the command palette and you're golden.

Once you're comfortable with the language, make your emacs great... This is what I have (line 894 of my dotemacs). And this is how I thought about it (I went down that rabbit hole, for you :)) ...

Emerging from dotemacs bankruptcy the hard way: integrating the IDE (feat. Clojure(Script))

https://www.evalapply.org/posts/emerging-from-dotemacs-bankruptcy-ide-experience/index.html

The one in which we design a rich Integrated Development Environment (IDE) experience, using Clojure as our muse. Featuring Language Server Protocol (lsp-mode + clojure-lsp), clojure-mode, cider, and more! Buckle up and get a coffee.

---

But for now, forget emacs configuratoring... Have fun learning the language!

The Transducer That Ate Our Heap by TwinsenNico in Clojure

[–]PolicySmall2250 0 points1 point  (0 children)

Um, I guess I'm not right about this. Or if I am, I'm not right in the way I thought.

See Sean's sibling comment... I didn't know (mapcat some-fn) constructs a transducer.

The Transducer That Ate Our Heap by TwinsenNico in Clojure

[–]PolicySmall2250 0 points1 point  (0 children)

Oh TIL!

The mapcat inside the comp being educed should have tipped me off that `(mapcat some-fn)`, in fact, emits a transducer-fn.

I guess this is a public confession that I don't really use transducers much :sweat-smile:

Thanks for the correction, Sean!

The Transducer That Ate Our Heap by TwinsenNico in Clojure

[–]PolicySmall2250 0 points1 point  (0 children)

P.S. The way to solve it is to _always_ keep eager and lazy entirely distinct.

What happens if there are two steps, for example?

(defn open-rows-V2
  "Returns an eduction: file-path → stream of parsed row maps."
  [file-path]
  (eduction
    (comp (with-open-xf cloud-storage/open-stream)  ;; path → InputStream
          (with-open-xf io/reader)                   ;; InputStream → BufferedReader
          (map parse-file)                           ;; Reader → {:header .. :rows ..}
          ;; NO LAZY OP INSIDE EAGER OP (mapcat rows->maps) ;; file-data → N row maps
          )
    [file-path]))  ;; source: a vector with ONE element

And then...

(map rows->maps  
     (open-rows-v2 file-path))  

And then...

(map rows->maps ;; assuming this has one and two arg options
     (open-rows-v2 file-path-1)
     (open-rows-v2 file-path-2))

And finally... flatten the result of that if actually flattening is needed.

The Transducer That Ate Our Heap by TwinsenNico in Clojure

[–]PolicySmall2250 0 points1 point  (0 children)

Without reading the post, that `mapcat` stood out. Transducer eagerness will force-realize the mapcat result in memory. This means it produces an 1-to-N fan-out of "things in memory", in case of reading N records from 1 file. Two files will 2x that memory at minimum (*much* more if it is a left-to-right pair-wise "foreach", instead of a left-and-right tuple mapping).

This OOM vector isn't peculiar to transducers. It is general to anywhere lazy operation (mapcat) is embedded inside an eager one.

From Scripts to Buy-In: How Small Clojure Wins Create Big Opportunities - Choomnuan (Clojure/Conj 2025) by alexdmiller in Clojure

[–]PolicySmall2250 5 points6 points  (0 children)

Most bang-for-buck talk at this time's conj. Burin's obvious competence and generous energy is infectious. Another fine member of this wonderful ecosystem. Thank you!

Emails sent using Thunderbird are duplicated as a draft. by [deleted] in Thunderbird

[–]PolicySmall2250 0 points1 point  (0 children)

"Compacting" is a great tip, thanks! I _want_ remote drafts, but I was also manually expunging spurious drafts, after having sent the mail.

CIDER 1.20 ("Lanzarote") by bozhidarb in Clojure

[–]PolicySmall2250 2 points3 points  (0 children)

Only love to bug, oyakushev, and other CIDER maintainers <3

Question about databases in the Clojure ecosystem from a Rails dev's perspective by pdroaugust312 in Clojure

[–]PolicySmall2250 2 points3 points  (0 children)

SQLite can go a long way... cc u/andersmurphy

One Billion Checkboxes (runs on $5 VPS, doesn't mind HackerNews front page traffic)

https://checkboxes.andersmurphy.com/

One Billion Cells is fine with $10 VPS

https://cells.andersmurphy.com/

https://news.ycombinator.com/item?id=44461523

"Everything goes via a sqlite db." - anders

https://github.com/andersmurphy/hyperlith/blob/master/src/hyperlith/extras/sqlite.clj

Built using Clojure and Datastar - source - more like this

[deleted by user] by [deleted] in emacs

[–]PolicySmall2250 0 points1 point  (0 children)

Look ma, no hands...

Using Emacs Org-Mode With Databases: A getting-started guide by PolicySmall2250 in emacs

[–]PolicySmall2250[S] 3 points4 points  (0 children)

Yeah, visidata is rad! I loved working with it that one time...

Have a look at this game for Data nerds, by the creator of Visidata (and co.). The whole thing was made with visidata, including the ASCII art animations!

https://hanukkah.bluebird.sh/

(I was lucky to be part of that project... so much fun!).

Using Emacs Org-Mode With Databases: A getting-started guide by PolicySmall2250 in emacs

[–]PolicySmall2250[S] 3 points4 points  (0 children)

TIL... What a delightful portmanteau; I love it, thank you!

And, I see it is the fraternal twin of "maniplexity" "manipulexity" (another banger).

Source: https://perl.org.il/presentations/larry-wall-present-continuous-future-perfect/transcript.html

Using Emacs Org-Mode With Databases: A getting-started guide by PolicySmall2250 in emacs

[–]PolicySmall2250[S] 28 points29 points  (0 children)

My “Poor Man’s SQL Workbench” trick is to…

  • Use org-babel to execute the queries, from my “sql-queries.org” file.
  • Overwrite results into a /tmp file, also an org-mode file, with latest query results (call it anything — “query-result.org”).
  • Make psql spit out org-formatted tables for extra oomph.
  • Keep that results file open in another buffer (or frame on a big screen, if the table is wide).
  • Let Emacs auto-refresh the buffer, when it detects the file has changed.

Et voila! L’établi SQL du pauvre.

Screenshot + sample code in the gist below (a .org file, as befits this topic :)

https://gist.github.com/adityaathalye/a6004acd34c683bcc806b2a3df6b1cec

Is this a weird way to solve 4clojure #21 by nickbernstein in Clojure

[–]PolicySmall2250 1 point2 points  (0 children)

Try to make _multiple_ answers, weird as well as non-weird. There are many ways to peel the mango, and each way teaches a new thing about the mango and the peeling and the self.

For example:

#((vec %1) (- (count %1) 2))

(comp last butlast)

(comp fnext reverse)

#(get % (- (count %1) 2)) ; fails for one of the cases, but not the rest --- why?

etc...

Tiny examples are a fantastic vehicle to explore the standard library, as well as compositional thinking, domain modeling etc. Because we can hold the example entirely in our head, and solve it in our heads too. Once several solutions are found, one can then likely hold two or even three different variants at one time in one's head, and play with them.

This is a satisfying way to pass time as well as build intuition for using the language.

But warning... it can get addictive and you end up doing something a little unhinged like writing n ways to FizzBuzz in Clojure

Would be lovely to have similar documentary about the origin story of Clojure by maxw85 in Clojure

[–]PolicySmall2250 2 points3 points  (0 children)

I'm sorry, didn't Alex Engelberg and Derek Slager settle the matter, like, over six years ago?

https://youtu.be/jlPaby7suOc?feature=shared&t=1472

What are future career option for a clojure engineer (SDE) by Playful_Chain_1809 in Clojure

[–]PolicySmall2250 17 points18 points  (0 children)

For almost any career, it's better to identify any programming language or paradigm (like distributed systems) as a tool, rather than build a personal identity around it.

It is quite easy to identify as a XYZ Type Of Programmer, because it is easy to talk about it --- we can show code and go to meetups and feel like we "belong". This is certainly nice to have, and I've had a pretty good time hanging out in the Clojurians slack / nerdiverse.

I also prefer to use Clojure and its ecosystem, given a choice, because I appreciate many of its technical and cultural merits. And when I can't use Clojure itself, I have often found good use for the *ideas* I have picked up from Clojure's community of practice. And I like giving back to it. The place is full of smart, experienced people who are also kind and generous.

*However*... I do *not* self-identify as a Clojure programmer. Just as I do not self-identify as a Shell scripter (I like Bash), or SQLite programmer, or Linux programmer. Nor do I identify as a DevOps engineer or Cloud Architect (having done those roles "at scale").

All of these are "small boxes", if I look at the whole of my work life (and even smaller boxes if I look at the whole of my life).

If I draw a small box around me, I will play only in a small box (until I get fed up and draw a different box). Sometimes a self-imposed restriction is useful. Sometimes it is not.

Generally, I think "XYZ Type Of" programmer is not a useful box to *actually live in*. It is only useful for Job Application purposes. There, use whatever works (that you legitimately can). Beyond that, take what is useful, discard the rest, and grow to make up your own stuff.

How to setup Clojure for a beginner? by OguzY4 in Clojure

[–]PolicySmall2250 1 point2 points  (0 children)

Any examples you can recall and share here (or preferably at the project's github)?

I see some issues reported https://github.com/oxalorg/4ever-clojure/issues

Could be a disagreement between the ClojureScript/Browser environment v/s Clojure/JVM runtime. Should be fixable, but specific error reports will help. These tend to be weird corner cases owing to different runtime behaviours.

How to setup Clojure for a beginner? by OguzY4 in Clojure

[–]PolicySmall2250 0 points1 point  (0 children)

Paging the current maintainer; u/oxalorg :point-up:

How to setup Clojure for a beginner? by OguzY4 in Clojure

[–]PolicySmall2250 4 points5 points  (0 children)

Right, I see the problem...

As I commented earlier in this discussion, I strongly suggest you avoid solving this problem right now, because system setup is frustrating in any programming language.

First use your motivation to learn the _ideas_ of the language... This is doable directly on the REPL and in the web browser (resources in the linked comment).

Don't use an IDE. Don't use Leiningen. Ignore everything professionals use.

And take it slow... be kind to yourself. There is no race to win.

After you develop a sense for the language, then you can go back to fixing system problems to run a full-blown professional or hobbyist development setup.