PasteRack.org
Paste # 14620
2020-09-15 18:27:28

Fork as a new paste.

Paste viewed 103 times.


Embed:

fizzbuzz

(define (fizzbuzz n)
  #2dmatch
  ╔═══════════════════════════╦══════════════╦════════════════════╗
  ║ (modulo n 5) (modulo n 3) ║      0       ║         _          ║ 
  ╠═══════════════════════════╬══════════════╬════════════════════╣
  ║         0                 ║  "FizzBuzz"  ║       "Buzz"       ║
  ╠═══════════════════════════╬══════════════╬════════════════════╣
  ║         _                 ║    "Fizz"    ║ (number->string n) ║
  ╚═══════════════════════════╩══════════════╩════════════════════╝)

(fizzbuzz 12)

=>

prog:2:2: read-syntax: bad syntax `#2d`
  context...:
   read-vector-or-graph
   read-one/not-eof
   loop
   [repeats 2 more times]
   read-unwrapped-sequence17
   read-undotted
   read-syntax3
   /home/pasterack/racket73/share/pkgs/scribble-lib/scribble/private/manual-code.rkt:112:0: get-tokens
   /home/pasterack/racket73/share/pkgs/scribble-lib/scribble/private/manual-code.rkt:56:0: typeset-code15
   "/home/pasterack/pasterack/tmp/14620/14620code.scrbl": [running body]
   temp37_0
   for-loop
   run-module-instance!125
   do-dynamic-require5
   loop
   ...cket/cmdline.rkt:191:51
   ...