Hacker News new | past | comments | ask | show | jobs | submit login

It's a matter of habit. Once you get used to it, you quickly know how or why it happens and where (especially when you follow the correct workflow, see below). Modern editors/IDEs help a lot with the typos and wrong number of args.

Some advice I would give myself when I started learning Clojure:

Think not in types, but in data. It's a different model that requires an 'aha' moment, but it's revelatory when you do get it.

If you come from an OO language, think not in objects (Elephant), but in information about objects (elephant's record, a map).

Clojure is best served REPL driven.

You can technically compile and execute, but this is not how the language shows its power. Here's how I use it:

I evaluate code in the REPL as I write it, reload definition on every change. Inside a `comment` block, I call the function I'm writing with the required arguments. I can quickly test how my function behaves in corner-cases. You then construct another function, which calls the first. You evaluate/execute the function as you write it.

So your program keeps growing, while you keep running/changing individual parts of it.

Once you get the hang of immutability and working with maps/collections, this process becomes very engaging because of the short feedback loop between thought and result.




yeah REPL driven development is pure joy. Even back when i was a JS developer i was developing a lot of my algos in devtools and then copying them to code.

It’s like having a conversation with your program while you are developing it.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: