• Re: merits of Lisp vs Python

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp,comp.lang.scheme on Thu Jul 24 09:20:59 2025
    From Newsgroup: comp.lang.lisp

    Contrast the much more common

    a[i] = b[n]

    with

    (setf (aref a i) (aref b n))

    Would this be concise enough?

    (a i b n)


    Gauche Scheme

    (define-method object-apply
    ((v0 <vector>) (i0 <integer>) (v1 <vector>) (i1 <integer>))
    (vector-set! v0 i0 (ref v1 i1)))

    (define a #(2 4 6 8))
    (define b #(30 50 70 90))

    gosh> a
    #(2 4 6 8)

    (a 2 b 3)

    gosh> a
    #(2 4 90 8)
    --
    [T]he problem is that lispniks are as cultish as any other devout group and basically fall down frothing at the mouth if they see [heterodoxy].
    --- Kenny Tilton
    The good news is, it's not Lisp that sucks, but Common Lisp. --- Paul Graham --- Synchronet 3.21a-Linux NewsLink 1.2
  • From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp on Wed Jun 18 21:25:23 2025
    From Newsgroup: comp.lang.lisp

    Wade Humeniuk wrote:

    John Thingstad wrote:

    (defun + (array) (loop for number across array summing number))
    for a array.


    Really?

    CL-USER 1 > (reduce '+ #(1 2 3))
    6

    Gauche Scheme

    (use gauche.sequence)

    (fold + 0 #(1 2 3))
    ===>
    6
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.lang.lisp on Thu Jun 19 03:06:49 2025
    From Newsgroup: comp.lang.lisp

    On 2025-06-18, B. Pym <Nobody447095@here-nor-there.org> wrote:
    Wade Humeniuk wrote:

    John Thingstad wrote:

    (defun + (array) (loop for number across array summing number))
    for a array.


    Really?

    CL-USER 1 > (reduce '+ #(1 2 3))
    6

    Gauche Scheme

    (use gauche.sequence)

    (fold + 0 #(1 2 3))

    Alas, that could have been

    (fold + #(1 2 3))

    if they had only copied the good idea: when the initial accumulator is
    not specified, infer it by calling the function without arguments.

    With functions like +, you usually want the reduce accumulator to be the identity element, and the function can give it to you: (+) -> 0.

    For the list appending monad, the empty list is the identity element,
    and that's what (append) returns, so it works for that too:

    (reduce #'append '((1) (2 3 4) (5))) -> (1 2 3 4 5)
    --
    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