7 ms·
Clojure to die for
- brentshields 13y agoNice writeup. There's an error in one of the examples though: (map :name people) evaluates to a lazy sequence, not a vector.
- vog 13y agoSmall typo: The link to Clojure points to "http://cjohansen.no/clojure.org" http://cjohansen.no/clojure.org" instead of "http://clojure.org" http://clojure.org".
- nardi 13y agoIn which the author gets really excited about idioms in Clojure that don't seem that exciting.
- Ygg2 13y agoAgreed. This did nothing to make me really excited about Clojure or Lisp. A demonstration of differential was a better example than this.
- cjohansen 13y agoIt's not really intended as an "evangelist" post. It's just describing some details that makes a big difference to me in my day-to-day work. I guess it's more of a "hey, fellow Clojure programmer, don't you agree that these details really put the icing on the cake?" kind of post. Maybe the other post I posted the same day would give newcomers a better impression of what using Clojure is like in practice (lots more code, more in-depth): http://cjohansen.no/building-static-sites-in-clojure-with-stasis http://cjohansen.no/building-static-sites-in-clojure-with-st...
- agumonkey 13y agoThe 'to die for' is too strong. ps: what is the min* function ? can't find anything on google
- cjohansen 13y agoIt's an expression of enthusiasm, don't take it so seriously. min* is like min but takes a list, it's not built in. Yes, I know about apply, I still prefer min* to (apply min) in certain cases.
- agumonkey 13y agoThanks, I was just affraid I'd missed some kind of builtin macro or convention. At one point I thought that -> would rewrite function #"\*$" to decorate them with apply ... paranoid noobies you know. ps: you're a very enthusiastic person ;)
- wging 13y agoOne thing that will help a lot: type (source f) to see the source code for a function or macro. Also (doc f) for documentation.
- jnazario 13y agothanks for writing it. i have yet to grok or embrace Lisp-family languages, but your post was still fun to read.
- thom 13y agoI think the article is overly focused on small, pragmatic syntax issues without explaining how the underlying language and runtime have _enabled_ them. It might be interesting to discuss _why_ keywords or maps or sets can work as functions, by implementing the IFn interface. Perhaps explain why homoiconicity and macros enable things like thread-first and -last, and talk about how we can implement our own reader literals.
- worldsayshi 13y agoI've thought about learning Clojure but already knowing Haskell I feel that in comparison I wouldn't gain much and then loose some.
- nnq 13y ago"loosing some" is the whole point :) That's the beauty of lisps, they make "the simplest possible way of doing something" just pop out, and once you see it, you just have to do it this way! You then show the middle finger to both 'powerful type systemy abstractions' and forget you ever learned them, and then the other middle finger to 'powerfully optimized down to metal programming', and you go hunting for real world problems that you can solve using 'the simplest possible ways' thinking ...until you realize that using simple and elegant tools, you ended up building a ...type system :) (http://typedclojure.org/ http://typedclojure.org/)
- Ygg2 13y agoEvery sufficiently advanced Lisp implementation contains an ad-hoc, badly-specified, bug-ridden implementation of half of Haskell's type system.
- nix1 13y agoThis one has a dissertation[1] behind it. Though unread (yet), I think it's well specified. [1]: https://github.com/downloads/frenchy64/papers/ambrose-honours.pdf https://github.com/downloads/frenchy64/papers/ambrose-honour...
- levosmetalo 13y agoUntil you encounter a real Lisp implementation that contains an actual thorough, well specified and bug free implementation of type system more powerful than the one Haskel has. Interested? Then take a look at the Shen[1] and enjoy having both the benefit of types and other powerful Lisp constructs in one language. [1] http://shenlanguage.org/ http://shenlanguage.org/
- 13y ago
- cjohansen 13y agoI spent 10 or more hours writing "Building static sites in Clojure with Stasis" (http://cjohansen.no/building-static-sites-in-clojure-with-stasis http://cjohansen.no/building-static-sites-in-clojure-with-st... / https://news.ycombinator.com/item?id=7375425 https://news.ycombinator.com/item?id=7375425). It was written so people could enjoy it even with little Clojure experience. As a piece of supportive material, I pulled together this post about some (to me) exciting idioms in about 40 minutes. Results after one day: the afterthought is #4 on hacker news, and has 10k views. The "real" post has a mere 3k views, and is long gone from hacker news. Who says hard work pays off?
- jimbokun 13y agoI suspect this is like the executive who said "I know over half of my advertising dollars are wasted, I just don't know which half!" (pre-AdWords). I don't think you could have predicted ahead of time which of those would be more popular before writing them. Having said that, the Stasis post is much longer, so it's less conducive to reading at work and quickly dashing off a comment or two on Hacker News without your boss noticing you goofing off. Hypothetically speaking, of course. :)
- dcotter 13y agoPerhaps an HN article analyzing which HN articles sink and which swim sometime in the future?
- vdm 13y agoI learned plenty from both posts. This one made me look at the other threading operators and the new some? functions in 1.5. Consider dropping "with Stasis" from that title. Well done, keep up the good work.
- cjohansen 13y agoThanks! I don't have any problems with the skewed "readers per effort" metrics, it was just a fun observation. If my only goal was internet fame, I would not write huge long-ass posts :)