Better HN
topnewbestaskshowjobs
Log inSign up

oskarkv

28 karma · joined May 4, 2010 (16y ago) · 42 submissions

Submissions

comment 8y ago · link · parent

True, but I am convinced that meditation can lead to awakening, which, apparently, involves the cessation of suffering and feeling one with the universe. It's not so far fetched, since our experience is generated by our brains, and similar things can happen on drugs.

comment 11y ago · link · parent

Is thinking obsolete too?

comment 12y ago · link · parent

It really is readable, to me at least. I just wanted to say that because some people will perhaps read your comment and take it as true, because they too struggle with it at the moment, and then discard Clojure. But I'm just in love with it---yes, the syntax.

comment 12y ago · link · parent

I was interested until I noticed it was pay-to-win. Instantly closed the tab.

comment 12y ago · link · parent

No. I love it. It's so simple. Even if Haskell has pretty nice syntax, I found myself resenting it because I needed to remember operator precedence.

comment 12y ago · link · parent

For very simple cases there are the threading macros, `->` et al., that you can use like this:

  (-> state 
      (assoc :a val) 
      (update-in [:b :c] f args) 
      (dissoc :d)
      (some-other-fn args))
where :a - :d are keys.

Or you could use monads in much the same way as you would in Haskell; there are libs for that.

Or you could write a new macro (or maybe even function) that does exactly what you want. I did that for a game. It looked like this:

  (call-update-fns game-state hook
    (update-monster-positions)
    (update-monster-ai)
    (let-characters-attack)
    (some-other-stuff))
It would thread the game-state (immutable) through all the functions, and call hook (a function) in between all the functions to send network messages and stuff (to minimize latency), and also collect and return new events that the functions created that I needed to handle (e.g. someone died when the characters attacked). It's almost like the state monad but not quite.

comment 12y ago · link · parent

Yeah, only Lisp is beautiful. ;)

comment 12y ago · link · parent

Big O is not necessarily about execution time. Also, why is it ridiculous to describe execution time as "time complexity"? From http://en.wikipedia.org/wiki/Analysis_of_algorithms "Usually, the efficiency or running time of an algorithm is stated as a function relating the input length to the number of steps (time complexity) or storage locations (space complexity)."

comment 13y ago · link · parent

Branching factor 32 is great for lookups, but isn't it slower for modification? At least, one has to create more array cells in total (31 copies in each node), no?

comment 13y ago · link · parent

First of all, O(g(n)) is a set. It is the set of functions f(n) such that there exists positive constants n0 and C, and C*g(n) > f(n) when n > n0.

Second, talking about O(g(n)) does not imply that the time complexity being discussed is the worst-case (or any other case) time complexity. One could for example say that the algorithm A's best-case time complexity is in O(n), and it's worst-case time complexity is in O(n^2).

comment 13y ago · link · parent

Of course O(n) is not equal to O(n^2). O(n) is a set, and O(n^2) is a different set.

comment 13y ago · link · parent

He says he understood the power of Lisp, yet he made a non-Lisp language. :P I don't get people who make non-Lisp languages.

comment 13y ago · link · parent

That's your biggest concern?

comment 13y ago · link · parent

Does Chicken have immutable data structures? How about typeclasses/protocols? How about literal syntax for hash maps, sets, vectors/arrays?

I'm coming from Clojure, and I'm interested in Chicken. I really like the things mentioned above about Clojure and I am just interested in how Chicken compares when it comes to these things.

comment 13y ago · link · parent

`for` is a macro, not a special form. Special forms are these: http://clojure.org/special_forms

comment 13y ago · link · parent

I don't know what you mean by widespread. But work on it does not seem to be slowing down, and it is a really good language, so I think it will only grow.

comment 13y ago · link · parent

There is a lot of stuff in Clojure that can be done in more than one way. I know that Python focuses on "only one way to do it", but Clojure's focus is on simplicity, as defined by Rich Hickey in Simple Made Easy [1], and that is a much better focus. I find that, as Rich says (and I'm paraphrasing), simplicity is by far the most important concern when programming. It dominates all other concerns in terms of importance and payoff. I believe I have become a much better programmer since I learned Clojure and listened to Rich's talks.

[1] http://www.infoq.com/presentations/Simple-Made-Easy

comment 14y ago · link · parent

Yeah, I know about it, but it's an additional dependency, right? [org.clojure/core.logic "0.7.5"] Whatever, Clojure is clean and simple is what I wanted to say. :)

comment 14y ago · link · parent

Your comment gives the impression that Clojure is a big multiparadigm mess. But it is not. Clojure's design is clean and simple. Clojure is mostly functional. Sure, since it's a Lisp one can kind of incorporate other paradigms with macros. But out of the box Clojure does not do Java-style OOP (except for interop) or Prolog-style logic.

comment 14y ago · link · parent

The correct statement about lower bounds is this: "In the worst case, any comparison based sorting algorithm must make Ω(n log(n)) comparisons."

You are making the same mistake that people that have Misconception 1 make. "The algorithm must make <a set of functions> comparisons." is a nonsensical statement.

comment 14y ago · link · parent

As far as I have understood, this is just regular memoization. I mean, often in functional languages one just turns a regular function into a memoized version by calling memoize(function). Sometimes that works to create a function that does what your code does, and sometimes it does not. When it does not I think that's a shortcoming of the language/implementation.

comment 14y ago · link · parent

If you found this interesting and have not tried Clojure yet, you should really give it a go. Learning Clojure teaches a lot about programming just because it is very well-designed.

23.

Ask HN: Examples of Complecting

1 points · by oskarkv · 14y ago · discuss

comment 14y ago · link · parent

I have heard many people complain about the documentation (in fact I've seen you do it before ;)). But I think the documentation is great; concise and informative. I learned more from the docs (the reference) on clojure.org than any book.

comment 14y ago · link · parent

I think this book is very good. Lots of exercises and very clear. http://www.amazon.com/Discrete-Mathematics-Norman-L-Biggs/dp...

comment 14y ago · link · parent

I particularly like this page: http://clojuredocs.org/quickref/varsonly/Clojure%20Core

comment 14y ago · link · parent

A couple of questions about Vundle.

What about plugins that are not in a git repo (but a hg repo)?

What if I don't want the lastest version of a plugin?

comment 15y ago · link · parent

From the article: "I was trying to memorize equations..."

That's doing it wrong. I agree with you that math education is probably broken. I imagine that math is very boring if memorizing equations is what you are doing.

comment 15y ago · link · parent

I will say that the online documentation IS atrocious and basically impenetrable...

Maybe it's just me, but I find the documentation to be very good. Everything on clojure.org is relevant, clear and concise. I read two books too, but I learned the most from clojure.org.

comment 15y ago · link · parent

This is kind of interesting. Where does your thoughts come from? If I asked you to think of a famous person, and say the first person that comes to your mind, what determines whom you will think of? Presumably you were not thinking of a person before I asked. Did you have any choice in what person you started thinking about?
12