文字を重複させる

30分プログラム、その791。anarchy golf - Duplicate charactersにインスパイアされました。

使い方

- dup_str "hello";;
val it = "hheelllloo" : string

ソースコード

fun dup [] = []
  | dup (x::xs) = x :: x :: dup xs;

fun dup_str str = String.implode (dup (String.explode str))