I had the same issue. Then I went back to the roots: Lisp And learned Clojure. You will feel like you know nothing. You will feel handicapped. You will be confused. Then, one day, you will understand what simplicity means and how Clojure's design embraces that more than in any other language I know. By then you will have embraced the flying-by-your-pants-exploratory style of programming at the REPL. And don't want to…
What is the best way to get started with Clojure these days? So much has changed since the early days.
Ask HN: How to rediscover the joy of programming?
301–310 of 337 posts
Re: Ask HN: How to rediscover the joy of programming?
#302I had the same issue. Then I went back to the roots: Lisp And learned Clojure. You will feel like you know nothing. You will feel handicapped. You will be confused. Then, one day, you will understand what simplicity means and how Clojure's design embraces that more than in any other language I know. By then you will have embraced the flying-by-your-pants-exploratory style of programming at the REPL. And don't want to…
Yeah, then you won't be able to get a job anywhere and will puke at the sight of OOP code. Seriously, Clojure is by far my favourite language but with mouths to feed I had to put it down and get serious with JS, Python and Kotlin.
Re: Ask HN: How to rediscover the joy of programming?
#303I had the same issue. Then I went back to the roots: Lisp And learned Clojure. You will feel like you know nothing. You will feel handicapped. You will be confused. Then, one day, you will understand what simplicity means and how Clojure's design embraces that more than in any other language I know. By then you will have embraced the flying-by-your-pants-exploratory style of programming at the REPL. And don't want to…
For anyone who wants to learn Clojure (or any Lisp) from scratch, here's my advice:
Don't try to learn it by reading books. What I mean: don't try to mentally parse and analyze printed code written in Clojure. For uninitiated Clojure code may look like unreadable gibberish. If you try to understand Clojure code by merely staring at it, it may feel very exhausting.
Remember: Unlike most other languages where the code is "dead" until you compile it an run it, Clojure code is a "living thing," analyzing its "static" properties without evaluating that code makes little sense.
Get an editor/IDE that supports "structural editing." Learn basic structural editing commands - slurp, barf, transpose. Learn/set a keybinding that allows you to evaluate the expression at the cursor.
And then eval your expressions and sub-expressions. That would make it much easier to learn. And would bring joy to the experience.
Re: Ask HN: How to rediscover the joy of programming?
#304Re: Ask HN: How to rediscover the joy of programming?
#305Earlier quoted context omitted.
I really like your comment. > switched to a language that built and ran faster Which one did you switch to?
Go, probably.
So I compromised by trying Go, and my productivity has been really great. And productivity seems to me to be the thing that is most important about making me happy.
(actually I suspect most people would say they love productivity, but not everyone seems to know how to achieve it).
Re: Ask HN: How to rediscover the joy of programming?
#306Earlier quoted context omitted.
Yeah, then you won't be able to get a job anywhere and will puke at the sight of OOP code. Seriously, Clojure is by far my favourite language but with mouths to feed I had to put it down and get serious with JS, Python and Kotlin.
Clojure is still massively helpful to learn, even if it is not the primary language of use. It is guaranteed to make a better programmer from anyone who has never done Lisp or FP before. It is my go-to tool for prototyping - whenever I am not allowed to use Clojure, I still first write an initial prototype in it and then translate it to the target language. Even though that sounds counter-intuitive - I am far much fa…
Re: Ask HN: How to rediscover the joy of programming?
#307Earlier quoted context omitted.
That's a fair point about the Perl example, but Scheme and Common Lisp (including both Chicken and SBCL, last I checked) support (if not outright require) full numeric towers with rational number types, so these are indeed exact representations (unless you explicitly request binary floats for e.g. performance reasons) and not just rounding during printing. There are lots of other examples of doing it "right" (using m…
Yeah, in CL the 0.1 is read syntax for a float (IEEE-754ish on most modern implementations.) If you want exactly 0.1, you’d have to say 1/10. The printer is probably cheating and rounding to the output you expect (I think Python 3 may do this now?) Aside from financial applications, there’s very little reason to care about the trailing remainder.
northrup@Topaz:~$ sbcl
This is SBCL 1.5.8, an implementation of ANSI Common Lisp.
More information about SBCL is available at .
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (= (+ 0.1 0.2) 0.3)
T
* (= (- (+ 0.1 0.2) 0.3) 0)
T
> Aside from financial applications"Financial applications" happen to be pretty common reasons for number crunching :)
Re: Ask HN: How to rediscover the joy of programming?
#308Earlier quoted context omitted.
That's a fair point about the Perl example, but Scheme and Common Lisp (including both Chicken and SBCL, last I checked) support (if not outright require) full numeric towers with rational number types, so these are indeed exact representations (unless you explicitly request binary floats for e.g. performance reasons) and not just rounding during printing. There are lots of other examples of doing it "right" (using m…
I am aware of numeric towers and actually checked whether that was going on. sbcl 1.4.16 uses single floats: https://ideone.com/ruw5qi I don't know enough about Scheme to dig under the covers to see how it's being represented internally.
Re: Ask HN: How to rediscover the joy of programming?
#309Earlier quoted context omitted.
Clojure is still massively helpful to learn, even if it is not the primary language of use. It is guaranteed to make a better programmer from anyone who has never done Lisp or FP before. It is my go-to tool for prototyping - whenever I am not allowed to use Clojure, I still first write an initial prototype in it and then translate it to the target language. Even though that sounds counter-intuitive - I am far much fa…
I don't really get this. If you're working in the usual OOP environment (JS, Ruby, Python, Java) what use is it modelling your solution in a functional language based on immutable data structures? Isn't that like running around naked before putting on your straight-jacket ready for work?
Re: Ask HN: How to rediscover the joy of programming?
#310Earlier quoted context omitted.
Yeah, in CL the 0.1 is read syntax for a float (IEEE-754ish on most modern implementations.) If you want exactly 0.1, you’d have to say 1/10. The printer is probably cheating and rounding to the output you expect (I think Python 3 may do this now?) Aside from financial applications, there’s very little reason to care about the trailing remainder.
> The printer is probably cheating and rounding to the output you expect northrup@Topaz:~$ sbcl This is SBCL 1.5.8, an implementation of ANSI Common Lisp. More information about SBCL is available at . SBCL is free software, provided as is, with absolutely no warranty. It is mostly in the public domain; some portions are provided under BSD-style licenses. See the CREDITS and COPYING files in the distribution for more…
Internally, they're probably both 0.30000000000000004 (depending on precision), so an equality check returns true.
It could also be that they're both 3/10 rational numbers, but given other tests in this thread that's likely not the case out the box.