I have written some functions that work just fine, so when I evaluate
this sentence:
(mapcar #'car (cadr (parse-it (caar (get-info "car")))))
it will give me: (engine tire gear-box)
now I want to make a function that allows me to get-info for more
things so I wrote:
(defun give-information (topic)
(mapcar #'car (cadr (parse-it (caar (get-info topic))))))
the idea is that it should give me info about any topic. but it gives
me:
Error: In a call to ARRAY-ELEMENT-TYPE: NIL is not of type ARRAY.
(get-info) is a kind of function that takes a string as element
tnx
ab talebi
In article <················@news.uio.no>, ab talebi wrote:
> the idea is that it should give me info about any topic. but it gives
> me: Error: In a call to ARRAY-ELEMENT-TYPE: NIL is not of type ARRAY.
>
> (get-info) is a kind of function that takes a string as element
Learn to use your debugger. Let him show you a backtrace when the
error occurs.
Regards,
--
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."
PGP key ID 0x42B32FC9
>>>>> On Thu, 17 Jan 2002 15:23:03 GMT, ab talebi ("ab") writes:
ab> I have written some functions that work just fine, so when I evaluate
ab> this sentence:
ab> (mapcar #'car (cadr (parse-it (caar (get-info "car")))))
ab> it will give me: (engine tire gear-box)
ab> now I want to make a function that allows me to get-info for more
ab> things so I wrote:
ab> (defun give-information (topic)
ab> (mapcar #'car (cadr (parse-it (caar (get-info topic))))))
ab> the idea is that it should give me info about any topic. but it gives
ab> me:
ab> Error: In a call to ARRAY-ELEMENT-TYPE: NIL is not of type ARRAY.
ab> (get-info) is a kind of function that takes a string as element
The variable TOPIC does not contain what you expect.
On Thu, 17 Jan 2002 17:23:37 GMT, Christopher Stacy
<······@spacy.Boston.MA.US> wrote:
>>>>>> On Thu, 17 Jan 2002 15:23:03 GMT, ab talebi ("ab") writes:
>
> ab> I have written some functions that work just fine, so when I evaluate
> ab> this sentence:
> ab> (mapcar #'car (cadr (parse-it (caar (get-info "car")))))
>
> ab> it will give me: (engine tire gear-box)
>
> ab> now I want to make a function that allows me to get-info for more
> ab> things so I wrote:
>
> ab> (defun give-information (topic)
> ab> (mapcar #'car (cadr (parse-it (caar (get-info topic))))))
>
> ab> the idea is that it should give me info about any topic. but it gives
> ab> me:
> ab> Error: In a call to ARRAY-ELEMENT-TYPE: NIL is not of type ARRAY.
> ab> (get-info) is a kind of function that takes a string as element
>
>The variable TOPIC does not contain what you expect.
I understand that. this is general question
if we have a function (like get-info) that takes a string as argument,
how can we write another fuction (give-information) that takes an
argument and passes it to get-info as a string. Does give-information
have to take its argument as a string too?
tnx
ab talebi
············@yahoo.com (ab talebi) writes:
> I understand that. this is general question
>
> if we have a function (like get-info) that takes a string as argument,
> how can we write another fuction (give-information) that takes an
> argument and passes it to get-info as a string. Does give-information
> have to take its argument as a string too?
Well, you simply write the GIVE-INFORMATION function and use whatever
method is appropriate to coerce the incoming argument into a string.
Exactly how you do that would, in general, be application dependent.
However, you might find the TYPECASE form to be of value.
An alternate approach would be to make GET-INFO be a generic function
and write methods for the various types of arguments for it:
(defmethod get-info ((key STRING)) ... do what you do now ...)
(defmethod get-info ((key SYMBOL)) (get-info (symbol-name key)))
;; Note that in this case, the string will generally be in UPPERCASE
>
> tnx
> ab talebi
--
Thomas A. Russ, USC/Information Sciences Institute ···@isi.edu
In article <················@news.uio.no>,
ab talebi <············@yahoo.com> wrote:
>On Thu, 17 Jan 2002 17:23:37 GMT, Christopher Stacy
><······@spacy.Boston.MA.US> wrote:
>
>>>>>>> On Thu, 17 Jan 2002 15:23:03 GMT, ab talebi ("ab") writes:
>>
>> ab> I have written some functions that work just fine, so when I evaluate
>> ab> this sentence:
>> ab> (mapcar #'car (cadr (parse-it (caar (get-info "car")))))
>>
>> ab> it will give me: (engine tire gear-box)
>>
>> ab> now I want to make a function that allows me to get-info for more
>> ab> things so I wrote:
>>
>> ab> (defun give-information (topic)
>> ab> (mapcar #'car (cadr (parse-it (caar (get-info topic))))))
>>
>> ab> the idea is that it should give me info about any topic. but it gives
>> ab> me:
>> ab> Error: In a call to ARRAY-ELEMENT-TYPE: NIL is not of type ARRAY.
>> ab> (get-info) is a kind of function that takes a string as element
>>
>>The variable TOPIC does not contain what you expect.
>
>I understand that. this is general question
>
>if we have a function (like get-info) that takes a string as argument,
>how can we write another fuction (give-information) that takes an
>argument and passes it to get-info as a string. Does give-information
>have to take its argument as a string too?
Of course. Since it just passes it on to GET-INFO, the argument it
receives has to be valid for the function it sends it to.
--
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
"ab talebi" <············@yahoo.com> wrote in message
·····················@news.uio.no...
> I have written some functions that work just fine, so when I evaluate
> this sentence:
> (mapcar #'car (cadr (parse-it (caar (get-info "car")))))
> the idea is that it should give me info about any topic. but it gives
> me:
> Error: In a call to ARRAY-ELEMENT-TYPE: NIL is not of type ARRAY.
>
> (get-info) is a kind of function that takes a string as element
As other suggested, use your debugger. If you still need help, you have to
show us the source AND a session in the listener that makes this happen.
--
Coby
(remove #\space "coby . beck @ opentechgroup . com")