Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Q: Why did the lone ranger kill Tonto? A: He found out what "kimosabe" really means.


comp / comp.lang.lisp / (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4, "..."), ...] find the Tuple with the Min (1st) tag value

SubjectAuthor
* (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4, "..."), ..HenHanna
`* Re: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4,"..."),B. Pym
 `- Re: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4,"..."),HenHanna

1
Subject: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4, "..."), ...] find the Tuple with the Min (1st) tag value
From: HenHanna
Newsgroups: comp.lang.lisp, comp.lang.misc, sci.lang
Organization: A noiseless patient Spider
Date: Wed, 10 Jul 2024 08:45 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: HenHanna@devnull.tb (HenHanna)
Newsgroups: comp.lang.lisp,comp.lang.misc,sci.lang
Subject: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4,
"..."), ...] find the Tuple with the Min (1st) tag value
Date: Wed, 10 Jul 2024 01:45:58 -0700
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <v6lho7$1rc9n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 10 Jul 2024 10:45:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4d026fb34b3ef224e52af3dcb33f5523";
logging-data="1945911"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/w+cCLBPYBFZYzVi4dM4jQUnjva8g7LX0="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Plx4fmQxd2GtBojLJJ+ZQFhUCTk=
Content-Language: en-US
View all headers

(in Python) let's say i have a list of candidates
like this
a= [ (12, "Data1"), (5, "data"), (4, "..."), ...]

and i want to find the Tuple with the Min (1st) tag value.

in Python that's what min() gives, by default.

min(a)

Is this the same in Scheme(Gauche) ?

Subject: Re: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4,"..."), ...] find the Tuple with the Min (1st) tag value
From: B. Pym
Newsgroups: comp.lang.lisp, comp.lang.misc, sci.lang
Organization: A noiseless patient Spider
Date: Wed, 10 Jul 2024 16:26 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: NoSpam_762@not_there.org (B. Pym)
Newsgroups: comp.lang.lisp,comp.lang.misc,sci.lang
Subject: Re: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4,"..."), ...] find the Tuple with the Min (1st) tag value
Date: Wed, 10 Jul 2024 16:26:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <v6mcog$1vuc4$1@dont-email.me>
References: <v6lho7$1rc9n$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Date: Wed, 10 Jul 2024 18:26:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="6f6282e3be4159d4eef0e2cf40c4caf3";
logging-data="2095492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19YlFBvUyMwKLyf9Oj7BsI2"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:Uo1b4Ns0YIlVT3nqY8u7ZEOnROI=
View all headers

HenHanna wrote:

>
> (in Python) let's say i have a list of candidates
> like this
> a= [ (12, "Data1"), (5, "data"), (4, "..."), ...]
>
> and i want to find the Tuple with the Min (1st) tag value.
>
> in Python that's what min() gives, by default.
>
> min(a)
>
>
> Is this the same in Scheme(Gauche) ?

(use gauche.collection) ;; find-min

(find-min
'[(12 "Data1") (5 "data") (4 "...")]
:key car)

===>
(4 "...")

Subject: Re: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4,"..."), ...] find the Tuple with the Min (1st) tag value
From: HenHanna
Newsgroups: comp.lang.lisp, comp.lang.misc, sci.lang
Organization: A noiseless patient Spider
Date: Thu, 11 Jul 2024 02:21 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: HenHanna@devnull.tb (HenHanna)
Newsgroups: comp.lang.lisp,comp.lang.misc,sci.lang
Subject: Re: (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"),
(4,"..."), ...] find the Tuple with the Min (1st) tag value
Date: Wed, 10 Jul 2024 19:21:56 -0700
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <v6nfk5$296j5$3@dont-email.me>
References: <v6lho7$1rc9n$1@dont-email.me> <v6mcog$1vuc4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 11 Jul 2024 04:21:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="5997fecf5cbee109c90816f0e589a653";
logging-data="2398821"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198ibN0RbrbHRcE00v5N7ik/Bro/e8LobA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:xjDqtt8rK94eC/LCgrwGcY7mx3o=
In-Reply-To: <v6mcog$1vuc4$1@dont-email.me>
Content-Language: en-US
View all headers

On 7/10/2024 9:26 AM, B. Pym wrote:
> HenHanna wrote:
>
>>
>> (in Python) let's say i have a list of candidates
>> like this
>> a= [ (12, "Data1"), (5, "data"), (4, "..."), ...]
>>
>> and i want to find the Tuple with the Min (1st) tag value.
>>
>> in Python that's what min() gives, by default.
>>
>> min(a)
>>
>>
>> Is this the same in Scheme(Gauche) ?
>
>
> (use gauche.collection) ;; find-min
>
> (find-min
> '[(12 "Data1") (5 "data") (4 "...")]
> :key car)
>
> ===> (4 "...")

thanks.. how is it done in CL (Common Lisp) ?

in Python, this substitution
(go look for the key value in the CAR position
for Tuples and Lists (and what else?))
works in other situations also.

i just realized that i like this so much because
it reminds me of my Mother-Tongue (Assoc in Lisp 1.5)

What other features from LISP 1.5 do i feel nostalgic about?
----- Dotted Pairs, replca, replcd

the name Member, Atom, (memq)

(funarg triple) the name Moses

1

rocksolid light 0.9.8
clearnet tor