• .Re: How do I construct this string?

    From Robert L.@21:1/5 to Raymond Wiker on Thu Feb 24 21:41:17 2022
    Raymond Wiker wrote:

    (defun join (list delimiter)
    (with-output-to-string (ret)
    (loop for (elt . next) on list
    do (progn (write-string elt ret)
    (when next
    (write-string delimiter ret))))))

    Let's make it shorter.

    Gauche Scheme and Racket:

    (use srfi-1) ;; pair-for-each for Gauche.
    or
    (require srfi/1) ;; pair-for-each for Racket.
    (require srfi/26) ;; cut for Racket.

    (define (join items delim)
    (with-output-to-string
    (cut
    pair-for-each
    (lambda (xs)
    (display (car xs))
    (and (pair? (cdr xs)) (display delim)))
    items)))

    (join '(2 3 4) '-)
    ===>
    "2-3-4"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Zyni=20Mo=C3=AB?=@21:1/5 to Robert L. on Thu Feb 24 22:39:45 2022
    Robert L. <No_spamming@noWhere_7073.org> wrote:
    Raymond Wiker wrote:

    (defun join (list delimiter)
    (with-output-to-string (ret)
    (loop for (elt . next) on list
    do (progn (write-string elt ret)
    (when next
    (write-string delimiter ret))))))

    Let's make it shorter.

    Gauche Scheme and Racket:

    (use srfi-1) ;; pair-for-each for Gauche.
    or
    (require srfi/1) ;; pair-for-each for Racket.
    (require srfi/26) ;; cut for Racket.

    (define (join items delim)
    (with-output-to-string
    (cut
    pair-for-each
    (lambda (xs)
    (display (car xs))
    (and (pair? (cdr xs)) (display delim)))
    items)))

    (join '(2 3 4) '-)
    ===>
    "2-3-4"


    So, more lines of non-portable code is 'shorter' than fewer lines of
    portable code. Your brain is truly minute.

    --
    the small snake

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeff Barnett@21:1/5 to All on Thu Feb 24 17:19:24 2022
    T24gMi8yNC8yMDIyIDM6MzkgUE0sIFp5bmkgTW/DqyB3cm90ZToNCj4gUm9iZXJ0IEwuIDxO b19zcGFtbWluZ0Bub1doZXJlXzcwNzMub3J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gJ3Nob3J0ZXInIHRoYW4gZmV3ZXIgbGluZXMgb2YNCj4gcG9ydGFi bGUgY29kZS4gIFlvdXIgYnJhaW4gaXMgdHJ1bHkgbWludXRlLg0KVGhhdCBpcyB0cnVlLiBI b3dldmVyLCBteSB0aGVvcnkgaXMgdGhhdCBzL2hlIG9ubHkgc2hvd3MgdXAgaGVyZSBhZnRl ciANCmJlaW5nIGZpcmVkIGZvciBhY3Rpbmcgc2ltaWxhcmx5IHRvd2FyZHMgd29ya21hdGVz IGFuZCBzdXBlcmlvcnMuIEhlIA0Kd2lsbCBldmVudHVhbGx5IGdldCBhbm90aGVyIGpvYiBi dXQsIGFzIEknbSBzdXJlIHlvdSd2ZSBub3RpY2VkLCB0aGUgDQpzZXNzaW9ucyBoZXJlIGdl dCBsb25nZXIgYW5kIGhpcyB3b3JrIHNwYW5zIGdldCBzaG9ydGVyLiBJIHRoaW5rIHMvaGUg DQpoYXMgcnVuIG91dCBvZiByZWZlcmVuY2VzIGFuZCByZXB1dGF0aW9uIGFuZCBvZG9yIGFy ZSBiZXR0ZXIga25vd24gDQp0aHJvdWdoIG91dC4gQXQgdGhpcyByYXRlLCB3ZSBhcmUgc3R1 Y2sgd2l0aCBpdCBhbmQgd2lsbCBiZSB1bnRpbCBzb21lIA0KdGhlcmFwZXV0aWMgbWVhc3Vy ZXMgaW50ZXJ2ZW5lLg0KLS0gDQpKZWZmIEJhcm5ldHQNCg==

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Madhu@21:1/5 to All on Fri Feb 25 09:20:59 2022
    I tend to see it as a statement on the afterlife. just when you think
    the newsgroup is dead and quiet and there is nothing more, you see a
    steady influx of these messages. just when you think death is final
    quiescence you get to see the a steady flow of torments in the lake of
    fire

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeff Barnett@21:1/5 to Madhu on Thu Feb 24 22:10:50 2022
    On 2/24/2022 8:50 PM, Madhu wrote:

    I tend to see it as a statement on the afterlife. just when you think
    the newsgroup is dead and quiet and there is nothing more, you see a
    steady influx of these messages. just when you think death is final quiescence you get to see the a steady flow of torments in the lake of
    fire

    Nothing so poetic. Just the smoke of an injured psyche moaning in
    public. The smoke is all that's left.
    --
    Jeff Barnett

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Monnier@21:1/5 to All on Fri Feb 25 13:19:09 2022
    Jeff Barnett [2022-02-24 22:10:50] wrote:
    On 2/24/2022 8:50 PM, Madhu wrote:
    I tend to see it as a statement on the afterlife. just when you think
    the newsgroup is dead and quiet and there is nothing more, you see a
    steady influx of these messages. just when you think death is final
    quiescence you get to see the a steady flow of torments in the lake of
    fire
    Nothing so poetic. Just the smoke of an injured psyche moaning in
    public. The smoke is all that's left.

    And to be fair, these posts are incomparably more valuable and
    on-topic than the infamous allcap ones.


    Stefan

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