💾 Archived View for idiomdrottning.org › newline1 captured on 2024-05-12 at 15:49:13. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-06-11)

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

newline1 and skip1

newline1 is a version of Scheme’s newline that does nothing the first time it’s called.

(for-each (fn (newline1) (display x)) '(a b c d e))

prints

a
b
c
d
e

skip1 is a general combinator that makes these:

(define tab1 (skip1 (fn (newline) (display "    "))))
(for-each (fn (tab1) (display x)) '(ol li li li))

prints

ol
    li
    li
    li

To reset them (so they’ll skip their next invocation), call them with a single argument, 'reset.

(newline1 'reset)
(tab1 'reset)

skip1 can take any number of procedures with any number of arguments, it runs ((compose proc1 proc2 …) arg1 arg2 …).

For example,

(define conv1 (skip1 print add1 *))
(for-each conv1 '(1 2 3) '(10 20 30))

prints

41
91

newline1 and skip1 are available in brev-separate from version 1.52.

brev-separate