| Deutsch English Français Italiano |
|
<v9sbf4$2artq$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: HenHanna <HenHanna@devnull.tb>
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
Bytes: 2334
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