6 ms·
Clojure: 1, Common Lisp: 0
- dimitar 18y agoWould the same Clojure advantages apply to Armed Bear CL which also runs on the JVM?
- jefffoster 18y agoNot in my opinion. Using Java libraries from Clojure is very simple e.g. (.substring "abcd" 2 3) ==> "c". Armed Bear on the other hand requires a lot more scaffolding code to make a Java call (you have to get the class, find the method and then call it).
- jwilliams 18y agoThis might be a good experiment, but the examples seem a bit flimsy to me. For example - Whilst it may well be better from his experience, Timestamp has always been an anomaly in Java (it doesn't necessarily play nicely with Date).... Equally I've never found browsing the filesystem that superb in Java - in fact the whole FileFilter, FilenameFilter thing can be quite clunky to use... It's one area where I've never felt more than a smidgen away from C (even moreso now with the NIO library). So - maybe better, certainly not perfect - Either way they didn't on the weight of it seem killer arguments.
- tlrobinson 18y agoBeing on top of the JVM is also one of the really nice things about Rhino (Mozilla's JVM based JavaScript interpreter: http://www.mozilla.org/rhino/ http://www.mozilla.org/rhino/). You have access to a zillion Java libraries. Taking two of their examples: MySQL: var conn = java.sql.DriverManager.getConnection("jdbc:mysql://"+host+"/"+db+"?user="+user+"&password="+password), statement = conn.createStatement(), resultset = statement.executeQuery("SELECT * FROM test"); // do stuff! Jetty also works from Rhino: var server = new Packages.org.mortbay.jetty.Server(8080); server.setHandler(new Packages.org.mortbay.jetty.handler.AbstractHandler({ handle: function(target, request, response, dispatch){ // do stuff! request.setHandled(true); } })); server.start(); Obviously these could be wrapped up in more JavaScripty libraries, but all the hard work is done for you.
- Avshalom 18y agofor more javascripty DB/server stuff http://dev.helma.org/ http://dev.helma.org/ is (though relatively unknown) the premier (kinda) server side javascript library/framework,
- tlrobinson 18y agoThere's a lot of monolithic server side JavaScript packages like Helma, but I want something more modular. Also, Helma is written in mostly Java I believe, rather than JavaScript, which is ok if you don't want to hack on Helma itself (or if you know and like Java), but I'd rather have an all (or at least mostly) JavaScript solution. Anyway, I started working on part of a solution for this: Jack (http://github.com/tlrobinson/jack http://github.com/tlrobinson/jack), which is like Rack (http://rack.rubyforge.org http://rack.rubyforge.org) but for JavaScript. If you don't know, Rack/Jack are like bridges between webservers and Ruby/JavaScript web apps/frameworks, so framework/app devs don't need to worry about what server they're using, they just write to the Rack API. It also includes "middleware" which lets you pre and post process requests, which allows for neat things like intercepting some requests and serving static files, or gzipping responses, etc (in a server agnostic way) Right now it only works with Rhino+Jetty but ideally it will work with a number of JavaScript interpreters and webservers. It also includes a Sinatra-like routing framework (called Roundabout), which lets you define routes like GET("/user/{username}", function() { var user = this.wildcards["username"]; // do stuff! return resulting_html; } Jack and Roundabout, combined with your other frameworks of choice, like ActiveRecord.js (http://activerecordjs.org/ http://activerecordjs.org/) make a pretty good solution, I think.
- habibur 18y agoIn Lisp one has the freedom to code in Structured Programming, OOP, AOP, FP, meta programming, or create his own DSL. Does the same stand true for Clojure? I am thinking about switching. Only risk is that if it doesn't work, I can't port the code anywhere else, because it's so different from CL.
- weavejester 18y agoClojure is a Lisp, so you get all the usual things like first class functions and macros. Clojure leans toward FP philosophically, so all the built in data structures are immutable. Concurrency support is generally very good, and it has some useful syntax sugar for vectors and maps. I prefer Clojure over all the other Lisps I've tried, but YMMV.
- habibur 18y agoGood. Only thing missing in Clojure seems OOP. But I can live without that. Hope Clojure doesn't push the FP thing too far. Pure functional languages are evil. In broad sense, pure anything in evil. Look what Java turned into trying to be a pure (or too much of an) object oriented language. It’s multi paradigm that wins. Giving programmers freedom on how he wants to code any specific set of problem.
- brl 18y agoNot sure what your point about Java is since it doesn't seem to be either very evil or a very pure OO language.
- ramchip 18y agoEverything is in a class. Everything. Even poor little printf or the main function.
- weavejester 18y agoAlthough Java puts everything in an class, not everything in Java is an object. For instance, you can't write: Package p = java.lang; Class x = p.String; x y = "Hello"; Method z = y.substring; w = z(0, 5);
- mcxx 18y agoThis guy is just rambling about CL and writing about his inability. I never had problems with SBCL on any machine, runs on my VPS, with threading, like a charm. Also, noone forced him to learn and use Emacs. There are Vim modes or CUPS for Eclipse. Destructive functions are the language's feature. If not sure, just use non-destructive. It's also not CL's fault he doesn't understand macros and can't use CL-WHO. I like Clojure, but I like CL better. One guy's incompetence learning CL doesn't mean Clojure wins.
- jimbokun 18y ago"I never had problems with SBCL on any machine" I did, and so did this author. So who's anecdote wins?
- mcxx 18y agoNoone's. The point is it's not a valid argument. The sameway the author had problems deploying SBCL on his machine, I could have problems deploying JVM on mine.
- icey 18y agoI'm going to have to disagree with you here. You rarely hear about people having issues getting the JVM set up on a random machine. On the other hand, deployment of SBCL is a complaint you hear somewhat regularly from people using shared hosting. It's not necessarily a fault of SBCL, as much as it is a function of Java's popularity. But to say they equally share deployment problems seems a bit misguided to me.
- mcxx 18y agoYeah, you are probably right. Because of Java's popularity and high demand, hosting providers have to be Java-ready and nowadays, it's not a problem. However, it seems I've been living in a cave. Besides the Reddit case, I haven't heard (or at least can't remember) about problems running a CL environment. Can people who had this problem please reply - what disto, what implementation, what was the issue?
- rw 18y agoSomeone please compare Clojure to PLT Scheme.
- hapless 18y agoPLT scheme is primarily used for education. Pedagogy is (or at least was) the project's central goal. Clojure is a general purpose project. It is not specifically competing for that space. I'm sure that the average student can get up and running with DrScheme/PLT faster than with Clojure, but I doubt anyone is going to write an angry article about that.
- apgwoz 18y agoSee, that's the common misconception with PLT. While it was built for education, it's really a nice full featured system for any use. Just use something other than the "Beginning Student" language.
- rw 18y agoIt's also very elegant.
- WeYu 18y agoI have to agree. I know CL quite well, and decided to have a look at scheme last week. I wrote a small (but useful) program with PLT and was rather impressed by the amount of library code available. Distributing the program as a small stand-alone executable to a friend was also incredibly simple. Also, I particularly liked the module system and wish CL had something similar.
- deleted 18y ago[deleted]
- jncraton 18y agoHis shiny new Clojure powered site is down for me... "The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later." http://origamigallery.net/ http://origamigallery.net/
- icey 18y agoBetween being posted here and on reddit, I'm sure he's getting much more traffic than his host is accustomed to.
- weavejester 18y agoCuriously, the server appears to be Apache rather than Jetty.
- twism 18y agoIt is common to have Apache as your static web server to serve images/css/js files and use modules such as mod_rewrite or mod_jk to route to your dynamic context. It seems like his dynamic content server is down (could be the jetty server he was referring to), hence the 503 error code.
- newt0311 18y agoFrom: http://news.ycombinator.com/item?id=395951 http://news.ycombinator.com/item?id=395951 "Yes it [Common Lisp] does [look bloated]. It has at least 4 different ways to loop, 4 different types of arguments to functions, 5 or 6 different lets (functions, macros, let* , normal let, ...), 3 or 4 different kinds of variables (with no unifying underlying theme), and at least 3 different flow models (the nested lists, tagbodies, loops with returns, etc...). That is exactly the same problem with C++. Instead of finding unifying abstractions which give the same functionality with 1 idea, they have chosen to add in multiple specific quick fixes to the language. They have chosen to amend the language with a thousand small changes, each suited to its own little use case, and have ended up with a monster of a standard that takes up 15 megabytes in 2300 files with 110,000 hyperlinks. Thats 15 mega bytes mostly of text. Scheme is a lot better but its going the way of CL, slowly but surely." Thats exactly what we are seeing here.
- sunkencity 18y agoIn a trivial setup it's pretty easy to get the jvm up and running, but making a good cached deploy of apache httpd fronting tomcat and a database server isn't very easy. It's not very easy to set up a server with rails either (easier these days but still a pain if you're a noob). I'm not sure how easy something deploys is critical for the value of a platform. Developers should understand how stuff are deployed but it's not necessary that they know how to do it correctly, nor should every developer deploy their own applications. (I mean, it doesn't hurt if they know how to do it, but it's better that developers spend their main time developing not minding the server farms).
- critic 18y agoIn one of the video lectures the author of Clojure seemed to claim that Clojure is as fast as Java. IME though that's not quite the case.
- Zak 18y agoClojure can be as fast as Java on benchmark-type code using type hints, Java interop and unchecked math. Idiomatic Clojure code will be slower on benchmarks. Operations on persistent data structures are slower than mutation. Reflection takes time. Back in the real world, Clojure actually does pretty well for itself. As an example, it seems to be fairly common to generate collections of various types and then only use part of them. In Clojure, most of the time those collections would be lazy, saving computations every time the whole thing isn't needed. Also, using clojure.parallel, many operations can be parallelized trivially. I got a 50% speedup running a genetic algorithm on a dual-core machine just by changing a sort to psort. Of course, hand-optimized Java may still be faster, but Clojure makes it easier.
- vikram 18y agoI'm going to make a different kind of statement here. Something that I've learnt from my CL experience. When I think about solving a problem by writing new software, I ask myself, is a run of a mill problem like a website which serves data, or making use of a bunch of libraries to do something. Then use rails/django, I use django/python. If I don't know what the solution will look like and I don't think I'm going to need existing libraries. I'll use CL everytime. Horses for courses. Nails and hammmers.