6 ms·
Try Clojure
- ikitat 16y agoWhat! No Paredit?
- swannodette 16y agoLooking better and better. Someone with design chops should fork the repo and give them a good logo and a color treatment.
- inanedrivel 16y agoWithout 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 :)
- ecuzzillo 16y agoYeah, 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 lisps go. Edit (2x): I had a statement here of my particular problem at the moment, but then it changed, so I deleted it.
- waterlesscloud 16y agoYou're going about it differently than I did (haven't gotten around to leiningen yet), but I found the top google results for linking emacs to clojure were woefully out of date. I'm a newbie to both emacs and clojure, so I couldn't figure out what I needed to do to correct for the old info. I gave up on that route and installed elpa on emacs, which I then used to install slime, swank, and clojure. Works great!
- jdminhbg 16y agoI had a similar problem, and by far the easiest thing for me has been: 1) Add lein-swank to the dev-dependencies of the project I'm working on (i.e., add this - :dev-dependencies [[leiningen/lein-swank "1.1.0"]] - to your project.clj file 2) lein deps 3) lein swank 4) M-x slime-connect in emacs, then accept the default host/port edit: Blogged it http://increasinglyfunctional.com/2010/05/18/my-swank-clojure-setup/ http://increasinglyfunctional.com/2010/05/18/my-swank-clojur...
- ecuzzillo 16y agoI'm about to try that (in the middle of trying another thing at the moment), and this isn't to you in particular, but as a general complaint, why do I have to have a project.clj file to get a nice repl in emacs?
- mcav 16y agoif you have slime installed, you should just be able to "M-x slime" to open a clojure REPL. At least that's how it works in my emacs.
- ecuzzillo 16y agoHeh. If you have a procedure that's that simple, please blog about it. Here's what I had to do: - Download the lein script and put it in my PATH - Download package.el and put it in my .emacs load-path - lein self-install - make a project directory, and 'lein new projname .' inside it - modify the resulting project.clj to add :dev-dependencies [[leiningen/lein-swank "1.1.0"] [swank-clojure "1.2.1"]] - lein deps in said directory - Install package.el, and then install slime, clojure-mode, slime-repl, and swank-clojure with it (and fight with it and get confused about why it didn't know about slime-repl until I installed it several times but then noticed it when I restarted Aquamacs) - lein swank in said directory - M-x slime-connect from Aquamacs Am I doin it rong?
- jluxenberg 16y agoNeat! FYI, the editor is fairly busted on FF 3.6.3. Key repeat for arrow keys does not work, and paste is broken. Not sure what they're using, but it would also be nice if it supported readline-style navigation (i.e. M-f, M-b, C-e, C-a, etc).
- Rayne 16y agoIt uses the same thing that tryhaskell.org uses. I was wondering about paste myself, but I suppose it's better for learning, just not for practicality. The console works fine on my FF 3.6.3.
- jacquesm 16y agoMan 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 ?
- tlrobinson 16y agoLooks like it uses this for sandboxing: http://github.com/Licenser/clj-sandbox http://github.com/Licenser/clj-sandbox
- Rayne 16y agoLicenser (Heinz) and I have another project called clj-sandbox that provides sandboxing for try-clojure and sexpbot in #clojure. You're safe.
- jacquesm 16y agoOk, cool. Especially for newbie clojure coders hitting errm, 'involuntary infinite recursion' is pretty easy. And I'd hate to cause a melt-down :)
- braindead_in 16y agoCan't navigate with arrows. Frustrating.
- icefox 16y agoWhen hitting the up arrow it should go to the last line, not the first.
- Rayne 16y agoThat's a problem with Chris Done (tryhaskell.org)'s jquery-console. I believe he's still working on proper history.
- stuntmouse 16y agoGreat work. Please hook this up to ymacs! Also, the highlighting in the tutorials makes the code difficult to read.
- ggruschow 16y agoNice work. Assuming you're trying to advocate Clojure, I'd recommend changing your tutorial to make things look easy (as opposed to highlighting gotchas). I recommend doing math examples first. Show how it makes a good calculator, but avoid discussion of ratios. That's (unnecessarily) confusing.. just like everything in the hello world example starting from the nil output on. By the time I got to the sequence page, I just hit next to see if there was anything else of interest. I'd already gotten the strong impression this new language would just make my life harder. Worst of all though was when I flubbed up and typed (/4 3) rather than (/ 4 3).
- jf 16y agoThe person who submitted this link isn't the author of TryClojure. http://tryclj.licenser.net/ http://tryclj.licenser.net/ and http://www.try-clojure.org/ http://www.try-clojure.org/ both point to the same IP. And both domains are registered to Heinz Gies - who I assume is the original author of TryClojure.
- devin 16y agoRaynes and Licenser (Heinz) have both worked on their own version of tryclojure but are collaborating on this version if I understand correctly. I'm not sure how they'll feel about this being posted early, but either way, pretty neat.
- Rayne 16y agoActually, I'm mostly the author of try-clojure. Heinz hosts it for me and collaborates, but I'm the majority author.
- Rayne 16y agoI don't know if you noticed, but I tried to be very explicit about the fact that the tutorial is nowhere near finished. I wrote that up in 1 hour yesterday. I'm well aware that it needs filling in with less difficult stuff. I intend to start serious work on it today. Also, I'm trying to get Michael Fogus (author of Joy of Clojure) to write the tutorial. If he decides to do so, I can almost promise you quality. ;)
- zenocon 16y agoNicely done. Would be nice to support copy/paste into the editor. Get rid of the dark grey background on code snippets in the tutorial -- very difficult to read. Having REPL inline with the tutorial is great...wish someone would build something similar for Haskell.
- lgas 16y agohttp://tryhaskell.org/ http://tryhaskell.org/
- zenocon 16y agoThanks 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.
- Rayne 16y agoNote that try-clojure uses the same jquery-console that tryhaskell.org uses. ;)
- jf 16y agoI'm keeping a list of REPs and REPLs: http://joel.franusic.com/Online-REPs-and-REPLs http://joel.franusic.com/Online-REPs-and-REPLs - looks like there are 4 for Haskell.
- Rayne 16y agoI'm still experimenting with code snippet colors.
- jared314 16y agoIs anyone embedding Bespin for idea's similar to this?
- jf 16y agoideone.com has an API. Would be cool to see those two together.
- gcv 16y agoA Clojure REPL that works on iPhone and iPad platforms. Will the wonders of web application delivery never cease? :)
- chc 16y agoDoes 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.)
- Rayne 16y agoTryHaskell is powered by Chris Done's jquery-console. So is TryClojure. Bugs in TryHaskell transfer to TryClojure by default.
- zephjc 16y agoAwesome! Also noticed that it retains your session (at least for a while) even if you close the browser windown. It seems however to give up when trying to write code on multiple lines.
- DenisM 16y agocopy-paste broken in ff36 on snow leopard.
- peropaal 16y agoThat'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.
- Rayne 16y agoStill 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
- Pistos2 16y agoThis 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.
- Avshalom 16y agoThis 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"?
- Rayne 16y agoWell, it's actually impossible to write if as a function in Clojure.
- Avshalom 16y agoI 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.
- stonemetal 16y agoThe first problem you run into is call by value. As a function the args to if would be evaluated before the function call. You could force the user to quote the branches to the if call to get around it but the special form is less error prone.
- geocar 16y agoMaking "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)))