Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
Rebol []
comma-quibbling: func [block] [
rejoin [
"^{"
to-string use [s] [
s: copy block
s: next s
forskip s 2 [insert s either tail? next s [" and "] [", "]]
s: head s
]
"^}"
]
]
foreach t [[] [ABC] [ABC DEF] [ABC DEF G H]] [print comma-quibbling t]

View file

@ -0,0 +1,24 @@
Rebol []
; builds string instead of using an intermediate block
comma-quibbling: func [block /oxford /local s length] [
length: length? block
rejoin [
"^{"
either length < 2 [to-string block] [
s: to-string block/1
for n 2 (length - 1) 1 [repend s [", " pick block n]]
if all [oxford (length > 2)] [append s ","]
repend s [" and " last block]
]
"^}"
]
]
test: [[] [ABC] [ABC DEF] [ABC DEF G H]]
foreach t test [print comma-quibbling t]
print "Now with Oxford comma"
foreach t test [print comma-quibbling/oxford t]