Talk:cons

Latest comment: 6 months ago by 212.17.78.158 in topic Misleading image


Misleading image

edit

The image at the start of the section "List" is (somewhat) misleading. The cdr of the last cons pair is not a pointer to NIL, but the value NIL. 212.17.78.158 (talk) 13:01, 7 May 2024 (UTC)Reply

Not fundamental

edit

Could somebody check those definitions? They don't look right and they don't seem to work. 84.191.247.10 (talk) 23:26, 19 August 2008 (UTC)Reply

They look fine to me. Tried them out under guile and they worked as expected. (Named them mycons, mycar, and mycdr because I didn’t want to clobber the built-in functions.) --Malirath (talk) 17:40, 31 March 2009 (UTC)Reply
I'm not clear on how you could think they aren't right or how they might "seem" not to work, unless you simply don't understand the notation or the subject matter -- in which case you should just say so. cons returns a closure that applies a function to the two values. car invokes the closure with a function that returns the first value, and cdr invokes the closure with a function that returns the second value -- it couldn't be much simpler or more straightforward. -- 98.108.225.155 (talk) 07:25, 19 November 2010 (UTC)Reply
I'm new to scheme, but just trying the cons definition in common music (a scheme) did not do the same thing as cons. specifically:
(define (mycons x y)
(lambda (m) (m x y)))
and then (mycons 3 5) returns #<lambda (m)>. How is this returned function supposed to be called?
this is not the same as (cons 3 5), which returns the dotted pair (3 . 5). At any rate some clarification or reference would be helpful to those new to thinking functionally such as myself — Preceding unsigned comment added by Sebfumaster (talkcontribs) 05:42, 16 September 2014 (UTC)Reply

snoc

edit

I'm tempted to remove the recent addition of Cons#Snoc. Cons is a primitve operation, but snoc is not. (snoc a b) is a cute name for what Lisp would refer to as (with args reversed) (append b (list a)) or (nconc b (cons a NIL)). It is not a common operation and seems to have little merit. Append is a clearer name, and real code might use a trailing pointer. If snoc needs to be explained, then it can be explained there instead of redirecting here. Glrx (talk) 00:46, 16 January 2014 (UTC)Reply


Why does that mean you should remove it? This article is not bloated. Crasshopper (talk) 11:52, 20 April 2015 (UTC)Reply
Anon here, Am working on a research language, and the need for a snoc-like function came up because it would eliminate a copy. I don't think I should have had to come to the Talk section to see the idea discussed. — Preceding unsigned comment added by 173.19.237.184 (talk) 23:24, 14 May 2015 (UTC)Reply
snoc is a common term in functional programing and it should have a subsection in this article. In general it would be good to write the article such that it abstracts away from Lisp, since Nil/Cons representation of lists is a functional programing concept not restricted to Lisp. --Tobias (Talk) 13:24, 14 May 2019 (UTC)Reply

"ordered pairs of simplex data"

edit

Which of the many definitions does simplex (disambiguation) mean in this article? Crasshopper (talk) 11:47, 20 April 2015 (UTC)Reply

edit

Hello fellow Wikipedians,

I have just modified one external link on Cons. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

This message was posted before February 2018. After February 2018, "External links modified" talk page sections are no longer generated or monitored by InternetArchiveBot. No special action is required regarding these talk page notices, other than regular verification using the archive tool instructions below. Editors have permission to delete these "External links modified" talk page sections if they want to de-clutter talk pages, but see the RfC before doing mass systematic removals. This message is updated dynamically through the template {{source check}} (last update: 5 June 2024).

  • If you have discovered URLs which were erroneously considered dead by the bot, you can report them with this tool.
  • If you found an error with any archives or the URLs themselves, you can fix them with this tool.

Cheers.—InternetArchiveBot (Report bug) 08:15, 12 August 2017 (UTC)Reply