Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Page 61: the example with the member function. This statement in the book is actually not true: "...the member function still gives the correct answer, even when we search for nil as the member!"
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Shafique  
View profile  
 More options Aug 24 2012, 9:31 am
From: Shafique <shafique.ja...@gmail.com>
Date: Fri, 24 Aug 2012 06:31:42 -0700 (PDT)
Local: Fri, Aug 24 2012 9:31 am
Subject: Page 61: the example with the member function. This statement in the book is actually not true: "...the member function still gives the correct answer, even when we search for nil as the member!"

This seems to be true for the example given, but not universally true. Try
the following:

(if (member nil '(3 4 1 nil)))
    'nil-is-in-the-list
    'nil-is-not-in-the-list)

The member function will return nil even though nil is in the list (I
tested this).

Any thoughts?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Archie Maskill  
View profile   Translate to Translated (View Original)
 More options Aug 24 2012, 9:45 am
From: Archie Maskill <archie.mask...@gmail.com>
Date: Fri, 24 Aug 2012 14:45:21 +0100
Local: Fri, Aug 24 2012 9:45 am
Subject: Re: Page 61: the example with the member function. This statement in the book is actually not true: "...the member function still gives the correct answer, even when we search for nil as the member!"

On Fri, Aug 24, 2012 at 2:31 PM, Shafique <shafique.ja...@gmail.com> wrote:
> (if (member nil '(3 4 1 nil)))
>     'nil-is-in-the-list
>     'nil-is-not-in-the-list)

> The member function will return nil even though nil is in the list (I tested
> this).

Are you sure that member is returning nil?
For me, in the example you gave, member returns '(nil), which is
different from nil.

Archie


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shafique  
View profile  
 More options Aug 24 2012, 12:47 pm
From: Shafique <shafique.ja...@gmail.com>
Date: Fri, 24 Aug 2012 09:47:41 -0700 (PDT)
Local: Fri, Aug 24 2012 12:47 pm
Subject: Re: Page 61: the example with the member function. This statement in the book is actually not true: "...the member function still gives the correct answer, even when we search for nil as the member!"

Hello Archie,

Many thanks for responding. I don't know what I'm doing wrong. When I
entered that line, the output was the second of the options, and it prints
FALSE (so I guess it is returning FALSE instead of '(nil) ).

I have attached a screenshot (see attached)... am I missing something
simple?

  Screen shot 2012-08-24 at 9.43.51 PM.png
170K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Archie Maskill  
View profile   Translate to Translated (View Original)
 More options Aug 24 2012, 5:02 pm
From: Archie Maskill <archie.mask...@gmail.com>
Date: Fri, 24 Aug 2012 22:02:00 +0100
Subject: Re: Page 61: the example with the member function. This statement in the book is actually not true: "...the member function still gives the correct answer, even when we search for nil as the member!"
Hi Shafique,

In your screenshot, towards the top, you have made a typo.  You wrote
"nul" instead of "nil":

(if (member nil '(3 4 1 nul))
    'nil-is-in-the-list
    'nil-is-not-in-the-list)

Therefore, nil is not found in the list, and the second of the options
is printed.

In your second example:
   (if (member nil '(3 4 1 nil))
       'false
       'true)

nil is found in '(3 4 1 nil), so member returns the tail, which is
'(nil).  This evaluates to true (because it is not nil), and therefore
the first option is returned, which you've specified to be the symbol
'false (which might be what is confusing you!)

Archie


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Shafique  
View profile   Translate to Translated (View Original)
 More options Aug 25 2012, 2:31 am
From: Shafique <shafique.ja...@gmail.com>
Date: Fri, 24 Aug 2012 23:31:11 -0700 (PDT)
Local: Sat, Aug 25 2012 2:31 am
Subject: Re: Page 61: the example with the member function. This statement in the book is actually not true: "...the member function still gives the correct answer, even when we search for nil as the member!"

Aha- got it now! Many thanks again, Archie, for taking the time to look
through the screenshot and catching the typo. I very much appreciate it!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »