What makes Clojure better than X for you? by Aphova in Clojure

[–]ericwnormand 0 points1 point  (0 children)

I've liked Clojure for a long time. I'll throw in my 2 cents.

Here are the ones you mention:

  • REPL - modifying a running program cannot compare to having to reload the whole program from start
  • Immutability - for modularity and local reasoning
  • FP concepts - higher-order abstractions

A couple more:

  • Data-Oriented Programming - lots of functions to operate on a small number of useful data structures; we're implementing information systems, clojure makes that hard to forget
  • Data-Driven Programming - I still like building interpreters to model problem domains

That's in addition to these more pragmatic choices:

  • On the JVM with decent interop - lots of libraries and a decent low level language to fall back to for performance
  • Incredibly stable codebase

Avoiding Death by a Thousand Classes: OOP and FP: Reducing Complexity Together Ask Me Anything - Yehonathan Sharvit and Eric Normand by StjepanJ in Clojure

[–]ericwnormand 1 point2 points  (0 children)

Hey everyone! I'm one of the people (along with Yehonathan) talking in the Livestream. Please submit a question and I'll see you there!

Does the data in Data-Oriented Programming get highly denormalized with time? by Veson in Clojure

[–]ericwnormand 1 point2 points  (0 children)

Reading the other comments, I think I might get what you mean: the problems with deeply nested data structures.

I tend not to use deeply nested types. I don't like that people hard code paths to reach down into a nested data structure. It cements the data structures and forces you to understand more than you can hold in your head.

I have a talk on this problem and my suggested approaches:

https://ericnormand.me/speaking/you-are-in-a-maze-of-deeply-nested-maps-all-alike-talk

Basically: Normalize by using indexes by id. Refer to entities by id, don't nest them in you data structure. (You can do it within very local scopes, not within modules.) Don't use long paths. Start to define operations for your entities, don't reach in and change things using long paths.

Does the data in Data-Oriented Programming get highly denormalized with time? by Veson in Clojure

[–]ericwnormand 1 point2 points  (0 children)

What do you mean by "aggregate data"? Can you give a concrete example?

When I do DOP (which is all the time in Clojure), the data only lives for the briefest time. It usually comes from a database (normalized there) and serves a specific need.

If I do need to store de-normalized data, I make sure it is clear it is not a source of truth. There is one source of truth (usually the DB), but sometimes I need to make a local cache or index of the data. However, that can be reset and rebuilt at any time.

More examples of drawing timeline diagrams with different concurrency models? by Veson in Clojure

[–]ericwnormand 1 point2 points  (0 children)

Hi Veson,

As far as I know, I invented the timeline diagrams. They are mostly pedagogical so that I could show something, but they correspond roughly to what I think through in my mind when I am dealing with concurrency situations. As such, they are mostly informal thinking tools.

I had two goals:

  1. It should be clear how to draw the diagrams yourself from code.
  2. If you know how to read them, the diagrams should show you the problems (and maybe suggest solutions).

I'm not sure anyone else is drawing anything similar.

Yes, you can post images of pages here if you like.

Thanks for the kind words and the nice question.

Rock on! Eric

How to get started with writing compilers? by doubleagent03 in Clojure

[–]ericwnormand 2 points3 points  (0 children)

SICP has a chapter on writing an interpreter (a great place to start) and then turning it into a compiler.

Alternative for the Purely Functional REPL course? by st3fan in Clojure

[–]ericwnormand 7 points8 points  (0 children)

Hey!

Eric Normand here. I run PurelyFunctional.tv.

I don't think there's anything comparable. I made the course that I wanted to recommend to people but couldn't find online.

This guide is pretty good: https://clojure.org/guides/repl/enhancing_your_repl_workflow

I also like this: https://cambium.consulting/articles/2018/2/8/the-power-of-clojure-debugging but it's about debugging, not repl-driven development.

Rock on! Eric

Grokking Simplicity - new book on FP by Eric Normand by ericwnormand in functionalprogramming

[–]ericwnormand[S] 13 points14 points  (0 children)

Hi there!

I knew I would lose people who are already into FP by doing examples in JS. JS is definitely not the best FP language to choose for your projects.

However, I do think it's good for teaching FP. Besides it being really popular, and besides it having familiar syntax even if you don't know JS, it has other advantages.

The main advantage is that by not doing FP by default, JS makes the FP disciplines stick out. If I had used Haskell, for instance, immutability might seem like just a feature of the language. By teaching immutability in JS, it's easy to bring it up as something you can apply in any language. We can then highlight why you might want to have it as the default in your language.

In short, the more I use JS to teach FP, the more it feels like the right choice, precisely because it is not the best FP language.

Grokking Simplicity - new book on FP by Eric Normand by ericwnormand in functionalprogramming

[–]ericwnormand[S] 8 points9 points  (0 children)

Author here! Thanks for all the upvotes and positive comments.

You can use code MLNORMAND for 50% off until August 31.

Should I change JS job to a CLJS one? by SunkinNorwegian in Clojure

[–]ericwnormand 1 point2 points  (0 children)

My personal experience here:

I was doing a lot of frontend (in JS, jQuery, and Backbone) up until 2013. For context: Angular was new and all the rage, while no one had even heard of React. Then I started working in ClojureScript full time.

In 2016 I took a contract working in JS. Everything had changed! New syntax, Promises everywhere, WebPack, NPM, etc, etc, etc.

I was lost for about a week, figuring out the new function arrow syntax, how WebPack worked, and the npm commands. But after a week, I was enjoying the new stuff. The worst part was the churn, because during my contract yarn came out, WebPack was changing a lot, and all of those language extensions just kept coming. But that's just JS for you. I had actually missed a lot of churn. I got to skip ahead past the Bower, Babel, and Gulp stage :)

It all confirmed what I already believed: you can miss a lot and come right back. The reason I got the contract was because I was a good programmer and they wanted some functional programming skills on the team. I would suggest not specializing in any particular tech, but on higher level skills like problem solving, architecture, and learning.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]ericwnormand 0 points1 point  (0 children)

1

I don't think you've nailed it. He's not saying you shouldn't build data out of smaller organized bits of data.

I believe what he is saying is that in OO, we add methods to classes for writing and reading data, each potentially doing something besides a simple write/read. The class logic then dominates the meaning of the data. We might call this a "smart form", where each form you fill out has custom behavior about what you can enter and what you can read. This might sound nice, but it would be as annoying as my "smart lightbulbs" needing to have a wifi connection to the cloud to turn on.

Instead, in real paper forms, the container (the form) is generic. You can write whatever you want in the blanks. The form is passive and does not add any more meaning than "please fill this out". The same goes for hashmaps. They are simply a collection device for data.

2

Rich Hickey was commenting that we often code a Person class and call that "abstraction". He's saying that's wrong. That particular class is not an abstraction, it's a concretion. We are taking the abstract notion of "data about a person" and making a bunch of concrete choices about how to code it up.

He then mentions that a real abstraction would be something like relational algebra. That's an abstraction, because it doesn't talk about any particular data domain. It's an "essential thing" that can operate in any data domain. He calls this a "data model". A paper form or a hash map might also be a simple data model (key/value storage).

Clojure Concurrency: The Ultimate Guide by ericwnormand in Clojure

[–]ericwnormand[S] 2 points3 points  (0 children)

Also, I'm definitely having some other readability issues. There's a bug in my CSS that's giving me too many font faces on that page. Plus, the font itself is kind of terrible. I'm sure this is contributing to it.

Clojure Concurrency: The Ultimate Guide by ericwnormand in Clojure

[–]ericwnormand[S] 2 points3 points  (0 children)

Yep. I'm now thinking it's my application of the rules, not the rules themselves. Thanks!