[Remind-Fans] Stupid tricks: fizzbuzz in remind(1)
Tim Chase
remind at tim.thechases.com
Sun Feb 16 22:35:19 EST 2020
Playing around, this classic programming test came to mind. So why
not. Here's "fizzbuzz" as done in remind:
$ (echo 'FSET doy() $U - date($Uy-1,12,31)'; echo 'MSG [iif(doy() % 15
== 0, "fizzbuzz", iif(doy() % 5 == 0, "buzz", iif(doy() % 3 == 0,
"fizz", doy())))]') | remind -c12 - 2020-1-1 | less
Or, if you prefer to put this in fizzbuzz.rem:
FSET doy() $U - date($Uy-1,12,31)
MSG [iif(doy() % 15 == 0, \
"fizzbuzz", \
iif(doy() % 5 == 0, \
"buzz", \
iif(doy() % 3 == 0, \
"fizz", \
doy() \
) \
) \
)]
and then
$ remind -c12 fizzbuzz.rem 2020-1-1 | less
to get a year worth of fizzbuzz.
I really should find a better hobby.
But doing dumb things like this is so fun! :-)
-tim
More information about the Remind-fans
mailing list