6 ms·
Common Lisp is not secretly Scheme with bad syntax
- zachbeane 16y ago[insert Arc joke here]
- Entlin 16y agoDidn't you mean (insert Arc joke here) ?
- troels 16y agoDoesn't matter. In Racket you can use either bracket-style, as you please.
- kunjaan 16y agoI thought () was used for function applications and [] for those that weren't. For example (let [x 3] ... )
- epochwolf 16y agoNope they are interchangeable.
- kunjaan 16y agoThe compiler may not mind, but isn't that what they are actually used for?
- plorkyeran 16y agoNot quite; in (let ([x 1] [y 2]) (+ x y)) there's a set of parens which aren't used for function (or macro) application.
- Zak 16y agoIn Arc, square brackets are shorthand for an anonymous function. The argument is an underscore. ([+ _ 2] 2) returns 4.
- msutherl 16y agoThis link doesn't work for me. Were you trying to link to the following thread? https://groups.google.com/forum/#!searchin/comp.lang.lisp/comp.lang.lisp$20common$20lisp$20schem|sort:date/comp.lang.lisp/FkHeCSBxWZ0/R7oXXlQEVf4J https://groups.google.com/forum/#!searchin/comp.lang.lisp/co...
- gnosis 16y agoNope. Just search google for: "secretly Scheme with bad syntax" It should be the first hit. It's a comp.lang.lisp post by Kent Pitman. Here's the header: Newsgroups: comp.lang.lisp From: Kent M Pitman <pit...@nhplace.com> Date: 15 Jul 2007 02:19:09 -0400 Local: Sun, Jul 15 2007 1:19 am Subject: Re: New Computer Language Shootout? Here's a copy of the message: http://pastie.org/1461082 http://pastie.org/1461082
- GrooveStomp 16y agoAfter reading the first paragraph, I realized that I mistook "CL" to mean "Clojure." The comment about Common Lisp lacking tail-call-optimization being a factor in not considering it a functional language reflects my only real problem with Clojure so far. Other than that, this writeup reflects what I've learned so far of Common Lisp - it's much more of an imperative style language than it is a functional language.
- swannodette 16y agoYou can get most of the real benefits of TCO (including many mutually recursive functions) in Clojure with lazy-sequences. The harder (and less frequest) use case of TCO'ing CPS style code can be accomplished with trampoline.
- GrooveStomp 16y agoLazy sequences are my favorite new language feature since learning Clojure.
- irahul 16y agoClojure does have TCO, though you have to be explicit about it. I use Clojure's looping constructs and list comprehensions for most of the tasks; explicit TCO using loop/recur for problems which are best expressed recursively.
- GrooveStomp 16y agoInteresting, I didn't realize that loop/recur used TCO. Makes sense. :) As far as usage, I do like a friend told me: Favor map and filter, but use loop/recur if you're stuck.
- ohyes 16y agoSort of. In true TCO, you optimize not only tail calls to the same function, but also tail calls to other functions. (Think of coroutines as an application). One way to think of a TCO is that you are turning a function call (machine code to save your spot in the function, then a jump) into a simple jump (you don't need to save your spot, because there is nothing left in the function anyway). Clojure doesn't support this (because it would be too difficult[inefficient, i think kawa scheme and JRuby do implement it] on the JVM). I assume that the common lisps which do support TCO, have true TCO, as they are using assembly or interpreters. Clojure's TCO can be seen as a special form of a loop (in fact, it is very easy to write a macro that takes a loop-recur form and transforms it into a common lisp style Do* loop).
- Homunculiheaded 16y agoWhenever I introduce people to functional programming, I always list the standard benefits you'll hear and then put emphasis on powerful abstraction being the most important feature that makes fp worth learning. Common Lisp is great because it realizes that abstraction and expressiveness are what make fp powerful, and is smart enough to know when to drop 'purity' in favor of these. After spending a lot of time with Haskell and Scheme, Common Lisp feels very non-functional, however I still feel it is the best language for expressiveness and abstraction. Work with Scheme and Haskell enough and you'll find yourself writing some convoluted things to maintain purity. The problem with purity is that while it makes somethings much easier to express, there are times when you have to stop and ask "how do I express this", I find common lisp always gives you some way to express anything, but leaves you asking "how can I express this better?"
- kunjaan 16y ago>Work with Scheme and Haskell enough and you'll find yourself writing some convoluted things to maintain purity. I don't think you can lump all the Scheme languages into one umbrella and more importantly lump Scheme and Haskell in that context. For example, Racket has really good constructs that lets me "drop 'purity'", control side-effects, build sequences, control the flow, build classes, manage complexity while at the same time giving me the power to build higher levels of abstractions, express my thoughts and reason with my program. Reference: 0. Racket Guide: http://docs.racket-lang.org/guide/index.html http://docs.racket-lang.org/guide/index.html 1. System Programming with Racket : http://docs.racket-lang.org/more/ http://docs.racket-lang.org/more/
- anon_d 16y agoRacket is not a scheme.
- kunjaan 16y agoRacket is a Scheme "Racket is still a dialect of Lisp and a descendant of Scheme. The tools developed by PLT will continue to support R5RS, R6RS, the old mzscheme environment, Typed Scheme, and more. At the same time, instead of having to say “PLT's main variant of Scheme,” programmers can now simply say “Racket” to refer to the specific descendant of Scheme that powers PLT's languages and libraries." Reference : http://racket-lang.org/new-name.html http://racket-lang.org/new-name.html
- CountSessine 16y agoTaken from the same thread, I loved this response, from Stefan Scholl: >There seems to be a great deal of interest >from the functional programming community >in benchmarking. Is there enough interest >to create a new computer language shootout >that showcases more relevant/suitable tasks >for FP? Does this sell books? Should I write one?
- deleted 16y ago[deleted]