Live data from Hacker News

Try Clojure

try-clojure.org

41–50 of 63 posts

Re: Try Clojure

#41
post #23
post #17

Earlier quoted context omitted.

http://tryhaskell.org/

Thanks for that. The missing link here is having the tutorial and the editor together for the maximum user benefit. What would be really cool is if the online copy of RWH had this editor embedded in it. What would be even cooler is if it had some basic menu features that allowed you to save module files, compile them and execute them along with the HUGS/GHCI integration.

Note that try-clojure uses the same jquery-console that tryhaskell.org uses. ;)

Re: Try Clojure

#42
post #21

When hitting the up arrow it should go to the last line, not the first.

That's a problem with Chris Done (tryhaskell.org)'s jquery-console. I believe he's still working on proper history.

Re: Try Clojure

#43

That's cool, only thing left now; in the tutorial, change the color scheme (from black on darkgray) to something a little more legible, and make the examples clickable, so I don't have to retype them in the repl.

Still working on those colors, but I'm not sure about making examples clickable. It's hard to learn if you don't pay attention to examples. :p

Re: Try Clojure

#44
post #39
post #7

Man that teddy bear scares me off, I'd hate to make a typo and crash someones server. What kind of precautions against newbie messes are there ?

Licenser (Heinz) and I have another project called clj-sandbox that provides sandboxing for try-clojure and sexpbot in #clojure. You're safe.

Ok, cool. Especially for newbie clojure coders hitting errm, 'involuntary infinite recursion' is pretty easy.

And I'd hate to cause a melt-down :)

Re: Try Clojure

#45

Without emacs and its plethora of hellspawn requirements for a decent clojure environment, I just don't feel comfortable!! Grats on a nice web-based repl though :)

Yeah, yesterday I decided I wanted to do something with Lisp again, and I figured that Clojure was the hot new kid on the block, so I should use that, and now it's tonight and I still don't have SLIME hooked up to Clojure, presumably because there's no actual guide to anything, and any howto that anybody made is guaranteed to be out of date almost before they post it. Clojure is really appealing otherwise, though, as…

There's a short guide for getting Emacs set up on the Clojure Assembla page:

http://www.assembla.com/wiki/show/clojure/Getting_Started_wi...

The Assembla wiki is a recent attempt at fixing problem of finding up-to-date 'getting started' documentation for Clojure.

Re: Try Clojure

#46
This only halfway works in Opera [10.53 on Linux]. You can type, but then if you fill the output area, only autoscrolls down after you press Enter. But otherwise, you can't see what you're typing while you type it. And then focus goes all out of whack if you scroll the tutorial, or use up arrow and down arrow. Sometimes it accesses the readline history, sometimes it scrolls the screen, and seems somewhat arbitrary. Some of this could be blamed on the betaness of Opera, though.

Re: Try Clojure

#47
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 unless [expr form] (list 'if expr nil form))

in factor:

: unless ( ? quote -- ) swap [ drop ] [ call ] if ; inline

no macro needed to futz with if's.

Does it have any advantages or is it just one of those things that "that's just how it's always been"?

Re: Try Clojure

#48

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…

Well, it's actually impossible to write if as a function in Clojure.

Re: Try Clojure

#49

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…

Making "if" a special form means that it can short-circuit, and I'd rather write

    (if x big_expensive_expression y)
than

    (funcall (if x (lambda () big_expensive_expression) (lambda () y)))

Re: Try Clojure

#50
post #48

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…

Well, it's actually impossible to write if as a function in Clojure.

I think it's impossible to write if as a function in anything, I'm pretty sure that at some point you need a branching primitive, but the if the VM uses and the if exposed to the user don't have to be the same thing. Like I said though, it's not a Clojure specific question, CL and Scheme both use a special form for if as well. Even if it can't be done in a JVM language it can be done. I'm just curious if there's any particular reason it isn't done, like being way easier for a compiler/interpreter to optimize or something or if it's mostly historical.
Post reply on HN