Skip to content

Instantly share code, notes, and snippets.

@valvallow
Last active December 18, 2015 19:49
Show Gist options
  • Save valvallow/5836016 to your computer and use it in GitHub Desktop.
Save valvallow/5836016 to your computer and use it in GitHub Desktop.
Unicodeで遊ぶ http://d.hatena.ne.jp/rahaema/20130622/p1 をgaucheで
(use srfi-13)
(use srfi-14)
(define (ab->maru str)
(string-map
(^c (let1 i (char->integer c)
(integer->char
(cond ((char-set-contains? #[a-z] c)
(+ (- i (char->integer #\a)) #x24d0))
((char-set-contains? #[A-Z] c)
(+ (- i (char->integer #\A)) #x24b6))
(else i)))))
str))
(print (ab->maru "Masahide Maehara"))
;; => Ⓜⓐⓢⓐⓗⓘⓓⓔ Ⓜⓐⓔⓗⓐⓡⓐ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment