From: ab talebi
Subject: Find-next-string ??
Date: 
Message-ID: <3c455672.66797950@news.uio.no>
I have this list in the variable "data" which contains several
string-lists:

((
"computer ((hardware software) (brands quality)) ram ((sdram)(rdram))
graphics ((chipset memory) (ATI ASUS))" 

"car ((brand model) (opel vectra )) gear ((manual) (automatic))"

"house ((quality hight) (iron wood) (inventory rooms))"))

there are three "sting-headers" (computer, car and house) and each of
them have a list of belongings.

now I can extract the first string with:
(caar data)

==> "computer ((hardware software) (brands quality)) ram
((sdram)(rdram)) graphics ((chipset memory) (ATI ASUS))"

but how can I get the other two (or more) stings and their
belonging-lists ?

tnx
ab talebi

From: Nils Goesche
Subject: Re: Find-next-string ??
Date: 
Message-ID: <a23nbm$uhhq5$1@ID-125440.news.dfncis.de>
In article <·················@news.uio.no>, ab talebi wrote:
> I have this list in the variable "data" which contains several
> string-lists:
> 
> ((
> "computer ((hardware software) (brands quality)) ram ((sdram)(rdram))
> graphics ((chipset memory) (ATI ASUS))" 
> 
> "car ((brand model) (opel vectra )) gear ((manual) (automatic))"
> 
> "house ((quality hight) (iron wood) (inventory rooms))"))
> 
> now I can extract the first string with:
> (caar data)
> 
> but how can I get the other two (or more) stings and their
> belonging-lists ?

With cadar?

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9
From: ab talebi
Subject: Re: Find-next-string ??
Date: 
Message-ID: <3c45732b.74152136@news.uio.no>
On 16 Jan 2002 11:15:03 GMT, Nils Goesche <······@cartan.de> wrote:

>In article <·················@news.uio.no>, ab talebi wrote:
>> I have this list in the variable "data" which contains several
>> string-lists:
>> 
>> ((
>> "computer ((hardware software) (brands quality)) ram ((sdram)(rdram))
>> graphics ((chipset memory) (ATI ASUS))" 
>> 
>> "car ((brand model) (opel vectra )) gear ((manual) (automatic))"
>> 
>> "house ((quality hight) (iron wood) (inventory rooms))"))
>> 
>> now I can extract the first string with:
>> (caar data)
>> 
>> but how can I get the other two (or more) stings and their
>> belonging-lists ?
>
>With cadar?
>
>Regards,
>-- 
>Nils Goesche
>"Don't ask for whom the <CTRL-G> tolls."
>
>PGP key ID 0x42B32FC9

yes I can with caar, cadar, caddar, will give me respectively first,
second and third strings and their belonging lists, but the problem is
that we don't know how many string-lists we will have. Here we have
only three (computer car house) but it can be many more.
From: Nils Goesche
Subject: Re: Find-next-string ??
Date: 
Message-ID: <a23tvo$u4bvo$1@ID-125440.news.dfncis.de>
In article <·················@news.uio.no>, ab talebi wrote:
> On 16 Jan 2002 11:15:03 GMT, Nils Goesche <······@cartan.de> wrote:
> 
>>With cadar?
> 
> yes I can with caar, cadar, caddar, will give me respectively first,
> second and third strings and their belonging lists, but the problem is
> that we don't know how many string-lists we will have. Here we have
> only three (computer car house) but it can be many more.

How about (nth 2 mylist) then?

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9
From: ab talebi
Subject: Re: Find-next-string ??
Date: 
Message-ID: <3c457f36.77236086@news.uio.no>
On 16 Jan 2002 13:08:08 GMT, Nils Goesche <······@cartan.de> wrote:

>In article <·················@news.uio.no>, ab talebi wrote:
>> On 16 Jan 2002 11:15:03 GMT, Nils Goesche <······@cartan.de> wrote:
>> 
>>>With cadar?
>> 
>> yes I can with caar, cadar, caddar, will give me respectively first,
>> second and third strings and their belonging lists, but the problem is
>> that we don't know how many string-lists we will have. Here we have
>> only three (computer car house) but it can be many more.
>
>How about (nth 2 mylist) then?
>

this will of course return NIL. that is the same as (third mylist).

Is there a way of counting how many strings there are i a given list?

tnx
ab talebi
From: Espen Wiborg
Subject: Re: Find-next-string ??
Date: 
Message-ID: <u7kqil8oo.fsf@empolis.no>
············@yahoo.com (ab talebi) writes:
<-snip->
> this will of course return NIL. that is the same as (third mylist).
> Is there a way of counting how many strings there are i a given list?

(length list)

Or, if you really only want to count the strings:

(count-if #'stringp list)

although I don't see why you would want this...

-- 
Espen Wiborg <·······@empolis.no>
'Pooh?' he said.  'Yes, Piglet?' Pooh replied. 'Nothing,' Piglet
said, taking Pooh's paw, 'I just wanted to throw an exception.'
From: Christopher Stacy
Subject: Re: Find-next-string ??
Date: 
Message-ID: <ur8oqe776.fsf@spacy.Boston.MA.US>
>>>>> On Wed, 16 Jan 2002 13:27:01 GMT, ab talebi ("ab") writes:

 ab> On 16 Jan 2002 13:08:08 GMT, Nils Goesche <······@cartan.de> wrote:
 >> In article <·················@news.uio.no>, ab talebi wrote:
 >>> On 16 Jan 2002 11:15:03 GMT, Nils Goesche <······@cartan.de> wrote:
 >>> 
 >>>> With cadar?
 >>> 
 >>> yes I can with caar, cadar, caddar, will give me respectively first,
 >>> second and third strings and their belonging lists, but the problem is
 >>> that we don't know how many string-lists we will have. Here we have
 >>> only three (computer car house) but it can be many more.
 >> 
 >> How about (nth 2 mylist) then?
 >> 

 ab> this will of course return NIL. that is the same as (third mylist).

 ab> Is there a way of counting how many strings there are i a given list?

LENGTH tells you how many elements are in a list.
From: Coby Beck
Subject: Re: Find-next-string ??
Date: 
Message-ID: <jSh18.9186$_w.1039776@typhoon.tampabay.rr.com>
"ab talebi" <············@yahoo.com> wrote in message
······················@news.uio.no...
> On 16 Jan 2002 13:08:08 GMT, Nils Goesche <······@cartan.de> wrote:
>
> >In article <·················@news.uio.no>, ab talebi wrote:
> >> On 16 Jan 2002 11:15:03 GMT, Nils Goesche <······@cartan.de> wrote:
> >>
> >>>With cadar?
> >>
> >> yes I can with caar, cadar, caddar, will give me respectively first,
> >> second and third strings and their belonging lists, but the problem is
> >> that we don't know how many string-lists we will have. Here we have
> >> only three (computer car house) but it can be many more.
> >
> >How about (nth 2 mylist) then?
> >
>
> this will of course return NIL. that is the same as (third mylist).
>

That's because you do, of course, want (nth 2 (car mylist))

Why are your strings double-listed?

--
Coby
···········@101yboc