• (in Python) given a list of candidates [ (12, "Dat"), (5, "dat"), (4, "

    From HenHanna@21:1/5 to All on Wed Jul 10 01:45:58 2024
    XPost: comp.lang.misc, sci.lang

    (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) ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From B. Pym@21:1/5 to HenHanna on Wed Jul 10 16:26:58 2024
    XPost: comp.lang.misc, sci.lang

    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 "...")

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From HenHanna@21:1/5 to B. Pym on Wed Jul 10 19:21:56 2024
    XPost: comp.lang.misc, sci.lang

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)