💾 Archived View for thrig.me › blog › 2023 › 09 › 20 › parallel-backwards-functions.gmi captured on 2024-08-31 at 12:18:21. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-14)

-=-=-=-=-=-=-

Parallel Backwards Functions

Usually C and LISP go together like water and a duck. However! Both suffer from functions that vary where they put an argument, in particular the stream can be at the front, or the back of the arguments list depending on the function. Consistency!

    $ cfu 'fprintf(stderr, "sream before\n")'
    sream before
    $ cfu 'fputs("stream after\n", stderr)'
    stream after
    $ alias sbclnqe='sbcl --noinform --quit --eval'
    $ sbclnqe '(format *error-output* "stream before~&")'
    stream before
    $ sbclnqe '(princ "stream after" *error-output*)' ; echo
    stream after

Pedantically the "both" above refers to the UNIX® I/O library and the Common LISP standard, as you can find C that hasn't got UNIX® on it, or LISP that isn't so common.

Don't think I've ever seen anyone infix the stream, which might run along the lines of FORMAT-STRING STREAM FORMAT-ARGS or something like that. Maybe there's a forth somewhere where that stack order made sense.

tags #c #lisp

Often ducks float on water like LISPs are built atop C.