Re: Newbie lisp problem: string to list of strings separated by space
- From: Pascal Bourguignon <usenet@xxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Mar 2006 17:48:28 +0200
Yossarian <yossarian@xxxxxxxxxxx> writes:
Use a local variable! Use LET
Indeed, the idea was to use a local variable ...
Now, if I replace "setq" with "let", then I receive the following error.
Are there extra requirements for using "let"? What is wrong now?
(defun parse(a)
(let pos (or (position #\space a) -1) )
(cond ((= pos -1) (list a))
((> pos -1) (append
(parse (subseq a 0 pos))
(parse (subseq a (+ pos 1) (length
a)))))))
;;; Warning: Function not defined: PARSE
;;; An error occurred in function #< COMPILED-FUNCTION: #xD0F828 >:
;;; Error: The variable A is unbound
It might be a good idea to read some tutorial and some reference
manual. You wouldn't want to be taken for a Mondoshawan, would you?
Zorg: I hate warriors, too narrow-minded. I'll tell you what I do
like: a killer, a died-in-the-wood killer. Cold blooded
methodical. Now a real killer when he picked up the ZF-1,
would have immediately asked about the little red button on
the bottom of the gun.
Aknot: [Scene shifts to Aknot, who is staring in confusion at the
little red button. He shrugs and pushes it]
Zorg: [Casually smokes a cigarette as the room with the Mangalores
blows up] Bring me the priest.
http://www.imdb.com/title/tt0119116/quotes
http://www.cliki.net/Education
http://www.lispworks.com/documentation/HyperSpec/Front/Contents.htm
http://www.lispworks.com/documentation/HyperSpec/Body/s_let_l.htm
--
__Pascal Bourguignon__ http://www.informatimago.com/
CAUTION: The mass of this product contains the energy equivalent of
85 million tons of TNT per net ounce of weight.
.
- Follow-Ups:
- Re: Newbie lisp problem: string to list of strings separated by space
- From: Raffael Cavallaro
- Re: Newbie lisp problem: string to list of strings separated by space
- References:
- Newbie lisp problem: string to list of strings separated by space
- From: Yossarian
- Re: Newbie lisp problem: string to list of strings separated by space
- From: Pascal Bourguignon
- Re: Newbie lisp problem: string to list of strings separated by space
- From: Yossarian
- Newbie lisp problem: string to list of strings separated by space
- Prev by Date: Re: packages, load paths and environment variables
- Next by Date: Re: What language will be used to write the first self aware program?
- Previous by thread: Re: Newbie lisp problem: string to list of strings separated by space
- Next by thread: Re: Newbie lisp problem: string to list of strings separated by space
- Index(es):