4 ms·
If you are really in a hurry and can't commit to learning the hundreds of forms in Common Lisp, Scheme is a minimalist alternative. The entire language has only
by daliwali 10y ago
If you are really in a hurry and can't commit to learning the hundreds of forms in Common Lisp, Scheme is a minimalist alternative. The entire language has only a few forms on which make up everything else.
- fao_ 10y agoSpecifically, chicken scheme, which has a lot of nice complete add-ons and a few other features that schemes normally lack.
- brudgers 10y agoDisclaimer: I like Scheme and love Racket but have an ongoing exercise in Common Lisp. [1] Common Lisp has the advantage of having done a pretty good job at the hard problem of naming things and so ordinary activities have names with regular semantics like |remove| and |remove-if| -- generally |some-name| tests against a value and |some-name-if| tests against a predicate. Functions on sequences have keywords as supporting parts of speech that make it possible to state intent rather than write an implementation -- Common Lisp contains several domain specific languages that have proven to be useful. One way to learn them is to read Steele's, Common Lisp: the language. It's not that a programmer can't write their own version of |copy-tree| and a naive implementation is fairly easy. It's not but nominally more difficult or verbose than writing it in a Scheme or Clojure. The difference is that Common Lisp's built in |copy-tree| is probably sophisticated for performance and robustness reasons. Schemes come out of a pedagogical context and there not having a built-in |copy-tree| can be a feature because of what people may learn by its absence. Racket's Student Languages push this toward the limit. To put it another way, Assembly Code has fewer constructs than Python, but often there is an advantage that comes with Python's higher level abstractions. [1] Why the hurry: http://norvig.com/21-days.html http://norvig.com/21-days.html
- jlarocco 10y agoStrongly agree. There's more stuff in Common Lisp, but once I learned the concepts behind how the naming worked, a lot of them didn't need to be learned as much as I just assumed they were there. The "standard library" is large, but really well thought out. Writing in Scheme, I'd often need to implement functions that I knew were already in CL, so Scheme ends up being more work in the long run. And it's not like a person needs to memorize all of the language constructs before using it. The REPL in Slime is incredibly helpful in discovering functions and verifying how they work, and Stack Overflow or web search can be really helpful finding out if a particular function is built-in or not.
- deleted 10y ago[deleted]
- derrida 10y agoBonus: it's also really really sexy once the logic of why there are parens become apparent... (post understanding a bit about functions that return functions, the meaning of REPL and a bit about the implementation of macros).
- chrismealy 10y agoIs scheme a suitable replacement for perl or ruby for everyday small-scale programming?
- moron4hire 10y agoScheme in general, probably not, but definitely Racket. That was part of the reasoning for the rename, to set it apart from Scheme.
- rmk2 10y agoThis probably depends on your implementation of choice and what counts as "everyday" programming. Racket has a minor language for shell mix-ins[1] and Racket itself has some nice ways of dealing with command-line arguments[2]. However, all command-line arguments are passed as strings, which means extra steps in converting them to native types (numbers etc.). I find it very pleasant and Racket in particular has both a good standard library and a whole bunch of libraries that probably cover a majority of what one might need for smaller tasks. But again, it depends on what you consider "small-scale programming" [1]: http://docs.racket-lang.org/rash/index.html http://docs.racket-lang.org/rash/index.html [2]: http://docs.racket-lang.org/reference/Command-Line_Parsing.html?q=command-line#%28form._%28%28lib._racket%2Fcmdline..rkt%29._command-line%29%29 http://docs.racket-lang.org/reference/Command-Line_Parsing.h...
- klibertp 10y agoFirst, there are many different Scheme implementations and they differ significantly. The standard is small and SRFIs not always sufficient, so implementations invent their own extensions. There is some review of available options here: https://wingolog.org/archives/2013/01/07/an-opinionated-guide-to-scheme-implementations https://wingolog.org/archives/2013/01/07/an-opinionated-guid... Personally, I use Chicken Scheme for command-line utils (thanks to AOT compilation Chicken Scheme programs start-up time is much shorter) and Racket for GUI programs. Both implementations offer stability, ongoing development and a package ecosystem which has most of the things I need. They also provide extensive tooling, with Racket going as far as providing an IDE and visual debugger. Most of the problems you'd have when replacing PERL or Ruby with a Scheme would have to do with library/package availability. If your use-case doesn't require a library which your Scheme lacks it may be a suitable replacement for PERL, Ruby, Python or JavaScript (node).
- lispm 10y agoThis is misleading. Scheme of 1975 was minimalist and it lacked a lot of things you need, like error handling. Since then Scheme went through various rounds of standardisation - currently Scheme R7RS large is in the works. Plus there are many quasi-standard extensions, based on SRFI: https://srfi.schemers.org https://srfi.schemers.org. If you add the usual stuff to Scheme then it is as large as Common Lisp. Also Scheme is not generally simpler than Common Lisp. Macro programming or control flow in Scheme is not simpler than Common Lisp. What is simpler than Common Lisp, is the core language used in education to teach programming concepts. For example in SICP a simple Scheme subset is used without any macro programming. But any practical variant of Scheme will quickly approach and sometimes even surpass Common Lisp. Scheme R6RS Standard: http://www.r6rs.org http://www.r6rs.org -> Standard + standard libs + appendices Guile Manual: https://www.gnu.org/software/guile/manual/html_node/index.html#SEC_Contents https://www.gnu.org/software/guile/manual/html_node/index.ht... Chez Scheme User's guide: http://cisco.github.io/ChezScheme/csug9.4/csug.html http://cisco.github.io/ChezScheme/csug9.4/csug.html Racket Core Language: https://docs.racket-lang.org/reference/index.html https://docs.racket-lang.org/reference/index.html
- wtbob 10y ago> If you are really in a hurry and can't commit to learning the hundreds of forms in Common Lisp, Scheme is a minimalist alternative. There are 25 special forms in Lisp, and the standard forbids the creation of more: http://www.lispworks.com/documentation/HyperSpec/Body/03_ababa.htm http://www.lispworks.com/documentation/HyperSpec/Body/03_aba... MIT Scheme has 30 special forms: https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Special-Forms.html https://www.gnu.org/software/mit-scheme/documentation/mit-sc... R7RS doesn't seem to define special forms per se; it considers anything other than define-syntax, literals, variables, calls, lambda, if & set! to be derived expression types; I think quote & quasiquote probably have to be considered special forms in at least some senses. Scheme itself is a minimalist language, but a practical Scheme must add in plenty of functionality not specified in the standard. A truly useful Scheme will thus be roughly as big as Common Lisp, or bigger — only much less of that bulk will necessarily be standardised & portable.