• Re: What's more idiomatic?

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp on Tue Jun 24 14:16:15 2025
    From Newsgroup: comp.lang.lisp

    Pascal Costanza wrote:

    (loop for x in '(1 2 3)
    for y in '(4 5 6)
    collect (* 2 (+ x y)))

    vs.

    (mapcar (lambda (x y)
    (* 2 (+ x y)))
    '(1 2 3)
    '(4 5 6))


    What if there were 26 lists instead of 2? Instead of just
    "x" and "y", the CL worshipper would have to use "a" through
    "z". Of course, he would run into another problem.
    In CL (COBOL-Like), if you try to use "t" as a variable name,
    you get:

    T is a constant and thus cannot be set.

    (loop
    for a in '(0 1 2)
    for b in '(3 4 5)
    for c in '(6 7 8)
    for d in '(9 10 11)
    for e in '(12 13 14)
    for f in '(15 16 17)
    for g in '(18 19 20)
    for h in '(21 22 23)
    for i in '(24 25 26)
    for j in '(27 28 29)
    for k in '(30 31 32)
    for l in '(33 34 35)
    for m in '(36 37 38)
    for n in '(39 40 41)
    for o in '(42 43 44)
    for p in '(45 46 47)
    for q in '(48 49 50)
    for r in '(51 52 53)
    for s in '(54 55 56)
    for t-is-a-constant in '(57 58 59)
    for u in '(60 61 62)
    for v in '(63 64 65)
    for w in '(66 67 68)
    for x in '(69 70 71)
    for y in '(72 73 74)
    for z in '(75 76 77)
    collect (* 2 (+ a b c d e f g h i j k l m n o p q r s
    t-is-a-constant u v w x y z)))


    (1950 2002 2054)

    Yes, CL (COBOL-Like) is an unbelievably clunky language.
    Its worshippers have no affinity for Lispy programming or
    for elegance of any sort.

    Instead of giving a name to the number from each list,
    wouldn't it be easier simply to say "sum the numbers from
    the lists"?


    (define the-lists
    '((0 1 2)
    (3 4 5)
    (6 7 8)
    (9 10 11)
    (12 13 14)
    (15 16 17)
    (18 19 20)
    (21 22 23)
    (24 25 26)
    (27 28 29)
    (30 31 32)
    (33 34 35)
    (36 37 38)
    (39 40 41)
    (42 43 44)
    (45 46 47)
    (48 49 50)
    (51 52 53)
    (54 55 56)
    (57 58 59)
    (60 61 62)
    (63 64 65)
    (66 67 68)
    (69 70 71)
    (72 73 74)
    (75 76 77)))

    (apply map (lambda args (* 2 (apply + args))) the-lists)

    (1950 2002 2054)
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.lang.lisp on Tue Jun 24 19:56:24 2025
    From Newsgroup: comp.lang.lisp

    On 2025-06-24, B. Pym <Nobody447095@here-nor-there.org> wrote:
    What if there were 26 lists instead of 2? Instead of just

    I've never seen a situation where two named lists had to scale to 26.
    For instance, zipping over symbols and their values.

    You've been demonstrating your skills in writing small one-liner
    programs for solving tiny sub-problems for probably close to
    two decades.

    It's not even on the level of Leetcode problems.

    Meanwhile, in that time, beginners have matured into professionals
    working on complex applications.

    What actual skills do you have?
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Jeff Barnett@jbb@notatt.com to comp.lang.lisp on Tue Jun 24 17:26:44 2025
    From Newsgroup: comp.lang.lisp

    On 6/24/2025 1:56 PM, Kaz Kylheku wrote:
    On 2025-06-24, B. Pym <Nobody447095@here-nor-there.org> wrote:
    What if there were 26 lists instead of 2? Instead of just

    I've never seen a situation where two named lists had to scale to 26.
    For instance, zipping over symbols and their values.

    You've been demonstrating your skills in writing small one-liner
    programs for solving tiny sub-problems for probably close to
    two decades.

    It's not even on the level of Leetcode problems.

    Meanwhile, in that time, beginners have matured into professionals
    working on complex applications.

    What actual skills do you have?


    I think that's a good question. My opinion, stated in the past, is that
    we are only honored with its presence when he is between jobs. Given the frequency of its appearance, I'd say those jobs don't last very long.
    Perhaps that is because of the same display of unwarranted arrogance
    displayed here.
    --
    Jeff Barnett

    --- Synchronet 3.21d-Linux NewsLink 1.2