fun pyramid s =
let
fun loop s' NONE = []
| loop s' (SOME c) =
let
val ns = subst (str c) "" s'
in
loop ns (CharVector.find Char.isGraph ns) @ [s']
end
val ss = (String.concatWith " " o global_slice ".") s
in
(app println o loop ss o SOME o sub) (ss, 0)
end
val _ = pyramid "hoge"
val _ = pyramid "abracadabra"
omoikani
#4804()
[
StandardML
]
Rating0/0=0.00
適当。
fun pyramid s = let fun loop s' NONE = [] | loop s' (SOME c) = let val ns = subst (str c) "" s' in loop ns (CharVector.find Char.isGraph ns) @ [s'] end val ss = (String.concatWith " " o global_slice ".") s in (app println o loop ss o SOME o sub) (ss, 0) end val _ = pyramid "hoge" val _ = pyramid "abracadabra"Rating0/0=0.00-0+
[ reply ]