Hacker News new | past | comments | ask | show | jobs | submit login
Try Clojure in your browser (tryclj.com)
90 points by llambda on Dec 18, 2011 | hide | past | favorite | 26 comments



To get help, you can type tutorial. I think it would be better to type (tutorial), or at least have both options available.


Awesome, but please highlight matching parenthesis.


Linux + Opera here: After one has inputted a fifth line, the window will scroll to the top whenever one presses a key to type a statement.

I appreciate the effort by people creating repls for various languages. It was a similar repl for Haskell that was my entry point into Haskell and the wonderful world of functional programming.


Try Common Lisp in your browser: http://nostoc.stanford.edu/Doc/demointro.html


It's cool, but the REPL could let you do multiline stuff by detecting whether you've closed all the parentheses and quotes yet.


I have always been frustrated by tutorial REPLs that make me copy and paste example codes. I simply don't write them manually to CLI and I believe many people do so. Therefore maybe a link to directly paste and execute code on tutorial steps would be quite useful. Like "run this".


If you click some of the code examples in the tutorials, it will paste them into the REPL. You have to hit enter to run them though.


I appreciate that it works very nicely on my iPad, as far as writing lisp on a touch keyboard goes.


Is there a Java Applet version available? Why run it remotely when you don't need to?


Why Java, if JavaScript is so fast nowadays?

But I agree, no point to run it remotely.


Presumably because Clojure runs on the JVM.


Java also runs on the JVM and there's GWT


The GWT compiler doesn't ship with the Java standard library though. You're not gonna be able to compile most Java code with the GWT compiler.


Nice to see this submission getting traction, especially given that the first submission got none at all. Clever of llambda to use the trailing question mark on the URL to confound PG's duplicate detection mechanism.


Ummm....

Following the first thing in the tutorial:

Clojure> (+3 3)

java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn

http://gyazo.com/22c613f5bb4ebda5a36d0fbc0a85b83d

What have I missed?


So just to give you some background. In any Lisp, when you evaluate a list, the first element is treated as an operator, and the remaining items are treated as arguments. Moreover, there is no distinction between graphic characters or alphabetic characters for the purposes of defining variable names. So '+' is a valid name for a variable (which is bound to the addition function), and so is '+3'. So without the space, it thinks you are trying to call the function '+3' with the argument '3'.


You need a space between the + and the first 3 (+ is the function you want to call).


Thanks. The tutorial didn't show that:

http://gyazo.com/9d330e8bdb0537f9179c34ad2924928c

And when I click the tutorial's "(+3 3)" grey box, it inserts what looks like no space between the + and 3, and lo and behold, it works (6). And when I type it in now with no space (+3 3) it works too. :/


oops - sorry - I'm totally misreading it. :/


I found it fun to see division results returned as fractions. Has anyone here switched from Python to Clojure for data analysis? What has been their experience?


I haven't used it, but Incanter is a Clojure statistics and data analysis thing... http://incanter.org/


Not recommended. Matrix multiplication is really slow, even with Incanter. I doubt you'll get very far with data analysis without multiplying a few matrices so avoid.


Slow compared to what? Numpy (or equivalent) or optimized fortran?


You know what? I realized that I didn't read the whole question. I switched from Octave, not Python. Oops.


I'm in the process right now. I didn't want to use Incanter since I don't like the kitchen sink reinvent R style, but there aren't any Clojure-esque matrix libraries around.

You, flatly, gain the language advantages of Clojure but have absolutely none of the Numpy/Matlab/R-like environments.


That is because Lisp has fractions as a native datatype. You would get the same result in Common Lisp.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: