Talk:Scheme (programming language): Difference between revisions

Content deleted Content added
rv 2023 test edit
 
(37 intermediate revisions by 23 users not shown)
Line 1:
{{Talk header}}
{{GAR/link|01:11, 20 October 2009 (UTC)|page=2|GARpage=1|status= }}
{{ArticleHistory|action1=PR
{{WikiProject Computing
|class=B
|importance=
|science=yes
|science-importance=mid
}}
{{ArticleHistory
|action1=PR
|action1date=10:48, 20 June 2006
|action1link=Wikipedia:Peer review/Scheme programming language/archive1
Line 23 ⟶ 16:
|action3result=delisted
|action3oldid=254278791
 
|action4=GAN
|action4date=20:16, 11 May 2010 (UTC)
|action4link=Talk:Scheme (programming language)/GA2
|action4result=failed
|action4oldid=361456475
 
|topic=Engtech
|currentstatus=DGAfailedGA
}}
{{WikiProject banner shell|class=B|
{{WikiProject Computing|importance=low
|science=yes
|science-importance=mid
}}
}}
{{archives
Line 31 ⟶ 36:
| list=<center>[[/Archive 1|2003–2007]]</center>
}}
 
== Tail-recursion example is not tail-recursive ==
 
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:
 
<syntaxhighlight lang="scheme">
(define (list-of-squares n)
(let loop ((i n) (res '()))
(if (< i 0)
res
(loop (- i 1) (cons (* i i) res)))))
</syntaxhighlight>
[[User:Bpeel|Bpeel]] ([[User talk: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.
[[User:Bpeel|Bpeel]] ([[User talk:Bpeel|talk]]) 17:46, 20 December 2012 (UTC)
 
== Comments ==
Line 38 ⟶ 59:
 
:the last two must be the new ones from R6RS because R5RS only has the (;) whole-line comments. --[[User:MarSch|MarSch]] ([[User talk:MarSch|talk]]) 16:30, 20 July 2009 (UTC)
 
 
[[Rscheme]] should be mentioned or linked to as a child/variant/descendent or whatever. --[[User:Clf99|Clf99]] ([[User talk: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. [[User:Rursus|Rursus]] dixit. ([[User talk:Rursus|<span style="color: red; background: #FFFF80"><sup>m</sup><u>bork<sup>3</sup></u></span>]]!) 21:00, 23 May 2011 (UTC)
 
== Used on Mars rover ==
Line 84 ⟶ 110:
This isn't because I want to engage in a debate on the relative power of [[Forth (programming language)|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. --[[User talk:Tony Sidaway|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. --[[User talk:Tony Sidaway|TS]] 18:07, 1 April 2010 (UTC)
 
== "Review of language syntax" is not about syntax ==
 
"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? [[User:MagV|MagV]] ([[User talk: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. --[[User talk:Tony Sidaway|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.
:: -- [[User:MagV|MagV]] ([[User talk:MagV|talk]]) 15:17, 10 April 2010 (UTC)
 
== Easiest to implement ==
 
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. [[Special:Contributions/121.45.251.215|121.45.251.215]] ([[User talk:121.45.251.215|talk]]) 12:07, 9 October 2011 (UTC)
 
== "Popular with programmers, implementors and hobbyists" ==
 
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"? [[Special:Contributions/174.1.213.234|174.1.213.234]] ([[User talk:174.1.213.234|talk]]) 17:02, 20 May 2013 (UTC)
 
:Changing that. [[User:Qwertyus|Q<small>VVERTYVS</small>]] <small>([[User talk:Qwertyus|hm?]])</small> 07:19, 19 July 2013 (UTC)
 
== The Hofstaedter example ==
 
IMHO the Hofstaedter example looks a bit ugly and seems not to be very scheme-like (besides <code>letrec</code> of course). It evaluates to #f and depends mostly on the side effects of <code>display</code>. Wouldn’t it be more appropiate if it evaluated e. g. to a list of pairs <code>(female male)</code> like this:
 
<syntaxhighlight lang="Scheme">
(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))
</syntaxhighlight>
 
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 <code>for-each</code>, which according to R5RS is explicitly to be called because of its side-effects:
 
<syntaxhighlight lang="Scheme">
(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
</syntaxhighlight>
[[User:Sokleidas|Sokleidas]] ([[User talk:Sokleidas|talk]]) 22:30, 7 November 2012 (UTC)
 
== R7RS ==
 
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. --[[Special:Contributions/82.128.250.221|82.128.250.221]] ([[User talk:82.128.250.221|talk]]) 10:19, 31 March 2014 (UTC)
 
:I've updated the panel on the right, as R7RS has been officially ratified. But we should also state that in the introduction, where R6RS is mentioned as the new standard. [[User:Csl77|cslarsen]] ([[User talk:Csl77|talk]]) 11:30, 29 December 2014 (UTC)
 
== The first paragraph should not mention Common Lisp ==
 
The header needs to focus more on Scheme exclusively. [[Special:Contributions/137.124.161.12|137.124.161.12]] ([[User talk:137.124.161.12|talk]]) 02:30, 29 January 2016 (UTC)
 
:I think it's quite natural that the first paragraph does mention Common Lisp, if only to emphasize the minimalist philosophy behind Scheme's design and contrast it with the "everything and the kitchen sink" philosophy underlying the design of Common Lisp (which explicity tried to merge the features of the various dialects of (Mac)Lisp). However, I agree that the concrete wording of the first paragraph seems uneven.
:The first paragraph {{oldid|Scheme (programming language)|701085086|currently has this to say}}:
::'''Scheme''' and [[Common Lisp]] are the two principal [[Programming language dialect|dialect]]s of the [[Programming language|computer programming language]] [[Lisp (programming language)|Lisp]]. Unlike Common Lisp, Scheme follows a [[Minimalism (computing)|minimalist]] design philosophy that specifies a small standard core accompanied by powerful tools for language extension.
:It used to read {{oldid|Scheme (programming language)|637554029|like this}}:
::'''Scheme''' is a [[functional programming]] language and one of the two main [[programming language dialect|dialects]] of the programming language [[Lisp programming language|Lisp]]. Unlike [[Common Lisp]], the other main dialect, Scheme follows a [[Minimalism (computing)|minimalist]] design philosophy specifying a small standard core with powerful tools for language extension.
:Even though both versions offer the same content, I think I prefer the older version. —[[User:Tobias Bergemann|Tobias Bergemann]] ([[User talk:Tobias Bergemann|talk]]) 08:40, 29 January 2016 (UTC)
 
::I have restored the first paragraph to the version of 2014-12-11. —[[User:Tobias Bergemann|Tobias Bergemann]] ([[User talk:Tobias Bergemann|talk]]) 07:39, 5 February 2016 (UTC)