Talk:Scheme (programming language)

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Former good article nominee Scheme (programming language) was a Engineering and technology good articles nominee, but did not meet the good article criteria at the time. There are suggestions below for improving the article. Once these issues have been addressed, the article can be renominated. Editors may also seek a reassessment of the decision if they believe there was a mistake.
WikiProject Computing / CompSci (Rated B-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
B-Class article B  This article has been rated as B-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Computer science (marked as Mid-importance).
 

Tail-recursion example is not tail-recursive[edit]

I think the example shown under ‘proper tail recursion’ does not actually use tail recursion because the call to the loop function is not directly returned from the function. The return value is instead passed to a call to ‘cons’ which would mean it has to maintain the call stack and can't optimise away the call. I think it would have to be something like this to use tail-call recursion:

(define (list-of-squares n)
  (let loop ((i n) (res '()))
    (if (< i 0)
        res
        (loop (- i 1) (cons (* i i) res)))))

Bpeel (talk) 16:04, 27 November 2012 (UTC)

As there was no response to my message I've just gone ahead and replaced the sample with the one above. Bpeel (talk) 17:46, 20 December 2012 (UTC)

Comments[edit]

"Each comment is preceded by a semicolon (;) and extends for the rest of the line. Some implementations allow comments to span multiple lines by wrapping them with a #|...|# (possibly nested). Other implementations allow an entire s-expression to be commented out by prepending it with #;.[7] These two comment forms are included in the R6RS."

Three kinds of comments are described, but the last sentence mention only two forms. I don't know which form are referenced. Could anybody make it clearer please ? Halladba (talk) 22:22, 1 December 2008 (UTC)

the last two must be the new ones from R6RS because R5RS only has the (;) whole-line comments. --MarSch (talk) 16:30, 20 July 2009 (UTC)


Rscheme should be mentioned or linked to as a child/variant/descendent or whatever. --Clf99 (talk) 22:20, 24 September 2010 (UTC)

Rscheme is a really notable scheme system. It has a well implemented garb. I'll see if I can add it in a proper place. Rursus dixit. (mbork3!) 21:00, 23 May 2011 (UTC)

Used on Mars rover[edit]

I believe I heard at MIT that Scheme was used on one of the Mars rovers. Ten points to anyone who can find a reliable reference. 8) -- Beland (talk) 00:43, 18 July 2009 (UTC)

Expansion needed[edit]

This article has been a mess for some time, and I'm planning an expansion, with possibly a rewrite of much of the article.

Some recent developments in Scheme standardization should be covered (see http://scheme-reports.org/). R6RS has divided Schemers more than any other event in the history of the language, and the Scheme Steering Committee has proposed that two Scheme versions should be specified: a small language more akin to R5RS, and a larger language closer to R6RS.

Meanwhile the coverage of key concepts is poorly handled. The following key language features need to be covered correctly:

  • Continuations
  • Hygienic macros
  • Multiple values
  • Numeric tower
  • Proper tail calls

The article should integrate with lisp (programming language) so that basic lisp concepts covered adequately in that article (lists, consing, etc) are not dwelt on here.

The SRFI process should be covered in more depth.

The Steering Committee recently remarked that "Scheme has the unhappy distinction of being the world's most unportable programming language" [1], and this undeniable fact isn't really covered here at all. Their point is that if you want to write in Scheme, you have to choose a particular implementation, and having done that you will find that most of the software you write for that implementation will not run unaltered on other implementations. --TS 03:42, 13 October 2009 (UTC)

Language elements[edit]

It's hard to avoid the temptation to turn an encyclopedia article on a programming language into a miniature tutorial for the language. The "Language elements" section is messy and some parts of it need to be rewritten and other parts need to be incorporated elsewhere--as I have already done with some sections. --TS 16:09, 14 October 2009 (UTC)

Disney World[edit]

I've removed the following for now:

Chez Scheme has been used at Disney World in Florida for controlling virtual rides.

The citation given for this was "Kent Dybvig, invited to talk at the International Conference on Functional Programming, 2006." We need better sourcing than that. --TS 19:06, 20 October 2009 (UTC)

Stuff removed from Boolean data type article[edit]

The following section was removed from the article Boolean data type:
begin removed text



Scheme has two special symbols #t and #f which represent the logical values of true and false respectively. However, any non-#f value is interpreted as true. Note that unlike Lisp, nil or '(), the empty list, is separate from #f in Scheme, and therefore is considered true.



end removed text
Is there a place for this text in the Scheme-related articles? Perhaps in the Wikibook? Thanks, and all the best, --Jorge Stolfi (talk) 00:08, 31 December 2009 (UTC)

Thanks for this. I think we already cover it all in the present article, but it might be useful for the book (which was rather moribund last time I checked). --TS 00:10, 31 December 2009 (UTC)

Forth[edit]

I've reverted this edit which was based on an opinion stated in the edit summary: "Forth is even easier to implement, and has as much power from further readily available extensions."

This isn't because I want to engage in a debate on the relative power of Forth and Scheme (that isn't what we do here at Wikipedia) but because I think it's bad form to insert personal opinion into articles. For more on what is meant by "power" in the context of Scheme and other Lisps, read the "Fundamental design features" section. Any language may be augmented to contain these features, but every standard-conforming implementation of Scheme provides them without the need for augmentation. --TS 17:57, 1 April 2010 (UTC)

I've changed the word "power" to the wikilinked phrase expressive power, This refers to the readiness with which complex data and control structures can be expressed in Scheme. --TS 18:07, 1 April 2010 (UTC)

"Review of language syntax" is not about syntax[edit]

"Review of language syntax" section lists standard forms and procedures, not the lexical or syntactic structure of the textual form. So it seems to be a misnomer. Can anyone think of a better title, so it would match the content of that section? MagV (talk) 12:08, 9 April 2010 (UTC)

Yes, there frankly isn't a lot of "syntax" in Lisp! Perhaps "Review of standard forms and procedures" would be better. I might also become convinced that the entire section could be removed or rewritten--I think I need to spend some time examining the structure of articles on similar subjects such as Common Lisp.
There is also the problem that this article is heavily slanted towards the still-dominant R5RS standard, and this may well change over time. For now I'm happy to continue describing R5RS and noting R6RS differences (which we don't really do a very good job of yet). If R6RS implementations, and uses of R6RS, become more popular, that will have to change. In some ways R6RS defines such a different kind of language that it may merit an entire separate article, which may or may not in time become the default article for "Scheme (programming language)". R6RS aims to be far more than the "minimalist" language described here. --TS 13:44, 10 April 2010 (UTC)
I'm down with "Review of standard forms and procedures". A rewrite is also good, since a list of standard bindings is not that useful by itself.
For the actual syntax, a pointer to s-expression with a description of differences (e.g. vectors) would be good.
For R5RS-ness, "Distinguishing features" should list features common among all standards/implementations, and then note differences. R5RS is the base for many common features, so it's OK to describe them from R5RS point of view. But then there are common features which R5RS does not have (e.g. a module system): those should be described as well, but not from R5RS point of view (obviously).
Finally, I don't think we need a separate R6RS article (too many common themes), but a section devoted to each standard would be good. Such section can say something about how and when it was accepted, and then list everything that does not fit "Distinguishing features". As a bonus, we'll be able to wikify all the "R5RS" across the Wikipedia to point to the relevant section, not the generic Scheme article.
-- MagV (talk) 15:17, 10 April 2010 (UTC)

Easiest to implement[edit]

Theres a statement in the wording that SCHEME is the easiest language of comparable power to implement. Is this REALLY true? I've seen some DAMN slim versions of Forth, and although it was never as fashionable for its stack-y ways, it was always a pretty expressive language and surprisingly capable for the kind of metaprogramming the lisps where known for. 121.45.251.215 (talk) 12:07, 9 October 2011 (UTC)

"Popular with programmers, implementors and hobbyists"[edit]

This sentence in the first paragraph seems completely meaningless: "Its compactness and elegance have made it popular with educators, language designers, programmers, implementors, and hobbyists."

Wouldn't it make sense to either simply state that "It is popular for its compactness", or to remove the overly broad and ambiguous "programmers, implementors, and hobbyists"? 174.1.213.234 (talk) 17:02, 20 May 2013 (UTC)

Changing that. QVVERTYVS (hm?) 07:19, 19 July 2013 (UTC)

The Hofstaedter example[edit]

IMHO the Hofstaedter example looks a bit ugly and seems not to be very scheme-like (besides letrec of course). It evaluates to #f and depends mostly on the side effects of display. Wouldn’t it be more appropiate if it evaluated e. g. to a list of pairs (female male) like this:

(define (hofstaedter-male-female n)
  (letrec ((female (lambda (n)
		     (if (= n 0)
			 1
			 (- n (male (female (- n 1)))))))
	   (male (lambda (n)
		   (if (= n 0)
		       0
		       (- n (female (male (- n 1))))))))
    (let loop ((i 0))
      (if (> i n)
	  '()
	  (cons (cons (female i)
		      (male i))
		(loop (+ i 1)))))))
 
(hofstaedter-male-female 8)
==> ((1 0) (1 0) (2 1) (2 2) (3 2) (3 3) (4 4) (5 4) (5 5))

It is of course a matter of taste and style, but functional parts of a program should be separated from imperative parts (cf. e. g. Conrad Barski, Land of Lisp, San Francisco 2011, p. 302). Displaying the results could be done with for-each, which according to R5RS is explicitly to be called because of its side-effects:

(for-each (lambda (item)
	    (begin
	      (display (car item))
	      (display " ")
	      (display (cdr item))
	      (display "\n")))
	  (hofstaedter-male-female 8))
 
===> #<unspecified>
 
1 0
1 0
2 1
2 2
3 2
3 3
4 4
5 4
5 5

Sokleidas (talk) 22:30, 7 November 2012 (UTC)

R7RS[edit]

What's up with that? The article seems out-of-date on that. Far as I can tell it's been delayed quite a bit, but then I don't follow Scheme news at all. --82.128.250.221 (talk) 10:19, 31 March 2014 (UTC)