From: Henry Lebowzki
Subject: Please help newbie with function from Wilensky's CommonLISPcraft
Date: 
Message-ID: <3cbb9a65.874755@news.uni-stuttgart.de>
Hello-


	Can you help me out here? I don't understand this function
(nevrmind the nonsense, I mean the lisp syntax):

	(defun interpret-step (step)
		(cond ((equal (car step) 'stir-bowl)
			(get 'mixer)))

	What does the second line do?
	What's the meaning of "(car step) 'stir-bowl)" ?

	Thanks
	Regs
	H

From: Kent M Pitman
Subject: Re: Please help newbie with function from Wilensky's CommonLISPcraft
Date: 
Message-ID: <sfwhemcdw2p.fsf@shell01.TheWorld.com>
···@uol.com.br (Henry Lebowzki) writes:

> Hello-
> 
> 
> 	Can you help me out here? I don't understand this function
> (nevrmind the nonsense, I mean the lisp syntax):
> 
> 	(defun interpret-step (step)
> 		(cond ((equal (car step) 'stir-bowl)
> 			(get 'mixer)))
> 
> 	What does the second line do?
> 	What's the meaning of "(car step) 'stir-bowl)" ?

The EQUAL form you show has two arguments to be compared.

The first argument is the result of (car step).  CAR is an accessor that
returns the left half of a CONS.   STEP presumably contains a CONS.

The second argument is the result of 'stir-bowl.  This is a quoted form
so will just return the quoted item, that is, it will return the
symbol STIR-BOWL.

You should probably get used to looking up operators in CLHS, the Common
Lisp HyperSpec, which describes in detail what these operators do.

 http://www.xanalys.com/software_tools/reference/HyperSpec/Front/index.htm

Look up COND, EQUAL, CAR, and QUOTE in the symbol index of CLHS, for example.
From: synthespian
Subject: Re: Please help newbie with function from Wilensky's CommonLISPcraft
Date: 
Message-ID: <pan.2002.04.16.21.00.02.309486.2584@uol.com.br>
On Tue, 16 Apr 2002 02:57:50 -0300, Kent M Pitman wrote:

> ···@uol.com.br (Henry Lebowzki) writes:
> 
>> Hello-
>> 
>> 
>> 	Can you help me out here? I don't understand this function
>> (nevrmind the nonsense, I mean the lisp syntax):
>> 
>> 	(defun interpret-step (step)
>> 		(cond ((equal (car step) 'stir-bowl)
>> 			(get 'mixer)))
>> 
>> 	What does the second line do?
>> 	What's the meaning of "(car step) 'stir-bowl)" ?
> 
> The EQUAL form you show has two arguments to be compared.
> 
> The first argument is the result of (car step).  CAR is an accessor that
> returns the left half of a CONS.   STEP presumably contains a CONS.
> 
> The second argument is the result of 'stir-bowl.  This is a quoted form
> so will just return the quoted item, that is, it will return the symbol
> STIR-BOWL.

Hi-	
	How would one write so that we replace "step" with "time", so that as
time gets smaller, than you stir bowl and get the mixer more and more
(I'm thinking recursion)?

	Thank you
	Regs
	S
From: [Invalid-From-Line]
Subject: Re: Please help newbie with function from Wilensky's CommonLISPcraft
Date: 
Message-ID: <slrnabojqk.sg0.cj@bird.hoax.qwest.net>
On Tue, 16 Apr 2002 03:43:14 GMT, Henry Lebowzki <···@uol.com.br> wrote:
>Hello-
>
>
>	Can you help me out here? I don't understand this function
>(nevrmind the nonsense, I mean the lisp syntax):
>

i find lisp to be easy to understand. maybe you will too with some good 
pointers. first off, begin your analysis in the middle. second take a look
at things which are atoms, lists, and functions. what is the operation and
what is the data? from there, you can get into some really fun stuff. 

>	(defun interpret-step (step)
>		(cond ((equal (car step) 'stir-bowl)
>			(get 'mixer)))
>

in my LISP implementation, i can type "(help 'car)" and i get help on that 
function. maybe you're lisp implementation has a different online help 
facility.

hope that gives you a little bit of a pointer.

cj
From: Brian P Templeton
Subject: Re: Please help newbie with function from Wilensky's CommonLISPcraft
Date: 
Message-ID: <871yd8ewmb.fsf@tunes.org>
··@bird.hoax.qwest.net () writes:

> On Tue, 16 Apr 2002 03:43:14 GMT, Henry Lebowzki <···@uol.com.br> wrote:
>>Hello-
>>
>>
>>	Can you help me out here? I don't understand this function
>>(nevrmind the nonsense, I mean the lisp syntax):
>>
> 
> i find lisp to be easy to understand. maybe you will too with some good 
> pointers. first off, begin your analysis in the middle. second take a look
> at things which are atoms, lists, and functions. what is the operation and
> what is the data? from there, you can get into some really fun stuff. 
> 
>>	(defun interpret-step (step)
>>		(cond ((equal (car step) 'stir-bowl)
>>			(get 'mixer)))
>>
> 
> in my LISP implementation, i can type "(help 'car)" and i get help on that 
> function. maybe you're lisp implementation has a different online help 
> facility.
> 
HELP is not a standard function. DESCRIBE and DOCUMENTATION are
standard, though.

(describe 'car)
(documentation 'car 'function)

are both helpful in the implementation I use (SBCL).

> hope that gives you a little bit of a pointer.
> 
> cj

-- 
BPT <···@tunes.org>	    		/"\ ASCII Ribbon Campaign
backronym for Linux:			\ / No HTML or RTF in mail
	Linux Is Not Unix			 X  No MS-Word in mail
Meme plague ;)   --------->		/ \ Respect Open Standards
From: Bruce Hoult
Subject: Re: Please help newbie with function from Wilensky's CommonLISPcraft
Date: 
Message-ID: <bruce-FC8272.17563616042002@copper.ipg.tsnz.net>
In article <···············@news.uni-stuttgart.de>,
 ···@uol.com.br (Henry Lebowzki) wrote:

> Hello-
> 
> 
> 	Can you help me out here? I don't understand this function
> (nevrmind the nonsense, I mean the lisp syntax):
> 
> 	(defun interpret-step (step)
> 		(cond ((equal (car step) 'stir-bowl)
> 			(get 'mixer)))
> 
> 	What does the second line do?
> 	What's the meaning of "(car step) 'stir-bowl)" ?

Translated to a C-like language, this would be something like:

  interpret_step(list step)
  {
    if (step.head == "stir-bowl"){
      return get("mixer");
    }
  }

Does that help?

-- Bruce