Upside down text

后端 未结 2 1163
时光说笑
时光说笑 2021-01-26 19:24

How would you design a program that will take in a string of lower case letters and produce the string upside down?

so if I type in home

i get

2条回答
  •  天命终不由人
    2021-01-26 20:05

    Try this, a bit of a brute-force approach but works quite well for uppercase, lowercase and number characters - all other characters are presented just as they come:

    (define upside-map '#hash(
      (#\a . #\ɐ) (#\b . #\q) (#\c . #\ɔ) (#\d . #\p) (#\e . #\ǝ) (#\f . #\ɟ)
      (#\g . #\ƃ) (#\h . #\ɥ) (#\i . #\ı) (#\j . #\ɾ) (#\k . #\ʞ) (#\l . #\ן)
      (#\m . #\ɯ) (#\n . #\u) (#\o . #\o) (#\p . #\d) (#\q . #\b) (#\r . #\ɹ)
      (#\s . #\s) (#\t . #\ʇ) (#\u . #\n) (#\v . #\ʌ) (#\w . #\ʍ) (#\x . #\x)
      (#\y . #\ʎ) (#\z . #\z) (#\A . #\∀) (#\B . #\

提交回复
热议问题