6 ms·
I think this is a neat project and a nice demonstration of how Lisp-influenced Ruby is. However, whenever people post "Lisp in Ruby" stories, I always hope tha
by bitops 14y ago
I think this is a neat project and a nice demonstration of how Lisp-influenced Ruby is.
However, whenever people post "Lisp in Ruby" stories, I always hope that it'll be a "Clojure in Ruby" implementation. I am surprised no-one has done it yet.
- pekk 14y agoApart from using the JVM, what is the advantage of Clojure over other Lisp dialects?
- nine_k 14y agoJavascript as a possible compile target (https://github.com/clojure/clojurescript https://github.com/clojure/clojurescript)? Optional static typing (a la Qi) is being implemented, too.
- mtrimpe 14y agoIt's default usage of purely functional data structures and a rich concurrency model (STM, actors and more.)
- glogla 14y agoI'm not sure about objective advantages (and note that I'm familiar only with Clojure, Common List and as much Scheme as there is in SICP), but Clojure feel kind of tight to me. In CL, array, hashmap, set and list have completely different interfaces, while in Clojure the interface is not only very similar (and nice, for example vector is also method to access itself), but allow you to use the same code to access different storage types. Clojure also felt more functional than CL. Clojure also felt more comfortable in ways such as distributing code, getting libraries and things like that, it's visible that the world of development tools have moved on since the CL of 1985.
- wonderzombie 14y agoI am mostly familiar with Clojure as opposed to CL (have read a bit of Practical Common Lisp) or Scheme (have read a decent chunk of SICP), but there are some pieces here and there. Clojure is immutable by default, which is a pretty big difference AIUI. It also has a pretty strong emphasis on concurrency, including a bunch of primitives for such. It uses STM. A bunch of data structures are first class, like vectors, maps, and sets. There are literals for each of them, and you can use maps and sets as functions. You can also use keywords as functions against maps to e.g. retrieve the :name value from a list of maps: user=> (map :name [{:name "foo"} {:name "bar"}]) ("foo" "bar") Lambda literals are nice: user=> (map #(* 2 (inc %)) [1 2 3]) (4 6 8) They can take multiple args (e.g. %1 %2) instead of just %. Threading macros are somewhat closer to Haskell's syntactically straightforward function composition: user=> (->> [1 2 3] ;; this'll be the last arg passed to each fn below #_=> (map #(* 2 %)) #_=> (map inc)) (3 5 7) I'm sure there's more. Maybe a more experienced Lisper can chime in.
- dschiptsov 14y agoClojure is immutable by default what does this sentence mean? How Scheme is less immutable by default? Which data-structures are not first class "objects" in Scheme?
- tubes 14y agoScheme has set-car!, vector-set!, hash-set! etc to modify its standard containers. In clojure those containers are immutable. However, you could create equivalent immutable containers in Scheme, perhaps that's why he said "by default".
- deleted 14y ago[deleted]
- wonderzombie 14y agoAgain, I don't have much experience with Scheme; I've read about half of SICP. So that's a huge caveat here. It may have been misleading to say that Clojure was immutable by default. It is immutable; it does not have set! or the moral equivalent. You can use concurrency primitives to update in place (sort of? AFAICT you're mutating the var itself, not the data it contains) but each primitive comes with its own semantics. As far as first-class is concerned: in Clojure, maps, sets, and vectors are functions. They're functions of their data as well as being data, and there are literal representations for each. Examples: user=> ({:foo 1} :foo) ;; maps are functions 1 user=> (:foo {:foo 1}) ;; keywords are functions, too 1 user=> (filter :name [{:name "foo"} {:surname "baz"}]) ;; filter by key ({:name "foo"}) user=> ([\a \b \c] 2) ;; access vector by index \c user=> (#{1 2 3} 4) ;; test set membership nil user=> user=> (filter #{2 4 6} (range 1 10)) ;; filter by set membership (2 4 6) To what extent is any of that true of Scheme? I am reasonably certain that these data types can't operate as functions in Scheme. Glancing at such as the Racket docs, my impression is that generally you use a specific set of functions to interact with each type (e.g. hash-map-get, hash-has-key?, set-member?).
- takikawa 14y ago
- asimjalis 14y agoClojure has cleaner syntax and matches the expectations of people used to languages that assume an underlying POSIX-like operating system.
- dschiptsov 14y agoCould you, please, provide us an examples of syntax and expectations?
- jjtheblunt 14y agoWhy would anyone? Clojure runs on the JVM which supports native os threads, concurrent garbage collection, etc, for one thing. Different tools for different purposes.
- jshen 14y agoThe JVM also takes 100MB to startup a Web server. Maybe I want to use less ram?
- deleted 14y ago[deleted]
- martinced 14y agoIf you want to host a webserver on an old 386 or on a credit-card sized Java smartcard, I understand your concern. Taking 100 MB to startup may be a problem. But not exactly for a webserver.
- jshen 14y agoIt certainly can. I like to create a lot of small hobby sites for fun. I pay $20 for a VM with ~700MB of ram. How many JVM web apps can I fit on it vs node web apps? Or, I run a few hundred servers at work, also on VMs. I want to create a process that needs to run on all of them in addition to what the server is actually used for. Maybe for monitoring, maybe for server management, etc. and I want it to have a REST API. Suddenly using 100MB matters to me.
- bentoner 14y agoI always hope that it'll be a "Clojure in Ruby" implementation. I am surprised no-one has done it yet. They have: http://rouge.io/ http://rouge.io/ https://github.com/rouge-lang/rouge https://github.com/rouge-lang/rouge