Live data from Hacker News

Try Clojure

try-clojure.org

61–63 of 63 posts

Re: Try Clojure

#61
post #32
post #20

A Clojure REPL that works on iPhone and iPad platforms. Will the wonders of web application delivery never cease? :)

Does it? I couldn't get it to execute anything on my iPhone. Or delete anything I'd written for that matter. (Not knocking it. A lot of things don't work quite right on touch-only platforms. Try Haskell doesn't work either IIRC. Just a matter of testing and debugging I'm sure.)

TryHaskell is powered by Chris Done's jquery-console. So is TryClojure. Bugs in TryHaskell transfer to TryClojure by default.

Re: Try Clojure

#62
post #54

Earlier quoted context omitted.

Are you familiar with python? Perhaps this will help: if cnd: return do_big_stuff else: return do_other_big_stuff has different semantics than a hypothetical "if" function call: def a(): return do_big_stuff def b(): return do_other_big_stuff return if(cnd,a(),b()) Note here, both "do_big_stuff" and "do_other_big_stuff" are evaluated, regardless of the value of "cond". A short-circuiting if (only possible if "if" is a…

Yeah okay I got it. I think the funcall/lambda stuff got me confused, it's kind of obvious in hindsight. In which case I agree it's a matter of taste. I guess I just like the taste of Factor/REBOL always passing blocks to if, having to say t [ 0 ] [ 3 ] if instead of simply say t 0 3 if is the trade off I suppose[1]. I'm guessing it works for picolisp because it's purely interpreted? because it certainly doesn't seem…

It works in picolisp because the author foolishly implemented FEXPRs instead of special forms, and rather than fix this problem, spends time trying to convince people that this is actually a feature, and that it offers a certain succinctness that can't be achieved in other ways.

Re: Try Clojure

#63

This isn't really a Clojure specific question but is there any benefit to making 'if' a special form? Meaning you can't do: (map if [true false true] [1 1 1] [2 2 2]) not that I can think of any reason why you'd want to do that (specifically) but Picolisp, Factor, REBOL and I'm sure a couple other languages implement if as a normal function. To take an example from some edition of programming clojure: (defmacro unles…

You could have 'if' as a function, but it would mean you'd have to encase any non-literal condition in a function:

    (if (zero? x)
      0
      #(dec x))
To me, this seems a rather counter-intuitive step with very little benefit. People rarely need to use "if" as a function, so having "if" as a macro optimizes for the common case.
Post reply on HN