Haskell, 60(削除) 60 (削除ここまで) 59 bytes
(init<>reverse).(scanl(pure.(>>=?)<*>tail)
a?_=do \uu<->ua;u:[' '|' '<u]))<*>tail)
Explanation / Ungolfed
Explanation
For a string (eg. "abc") we apply first
scanl (pure . (>>= \u->u:[' '|' '<u])?) <*> tail
which is the same as
\str -> scanl (const . (>>= \u->u:[' '|' '<u])?) str (tail str)
This repeatedly applies (>>= \u->u:[' '|' '<u])?) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the last element) with its reversed counter part:
init<>reverse
Haskell, 60 bytes
(init<>reverse).(scanl(pure.(>>= \u->u:[' '|' '<u]))<*>tail)
Explanation / Ungolfed
For a string (eg. "abc") we apply first
scanl (pure . (>>= \u->u:[' '|' '<u])) <*> tail
which is the same as
\str -> scanl (const . (>>= \u->u:[' '|' '<u])) str (tail str)
This repeatedly applies (>>= \u->u:[' '|' '<u])) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the last element) with its reversed counter part:
init<>reverse
Haskell, (削除) 60 (削除ここまで) 59 bytes
(init<>reverse).(scanl(?)<*>tail)
a?_=do u<-a;u:[' '|' '<u]
Explanation
For a string (eg. "abc") we apply first
scanl (?) <*> tail
which is the same as
\str -> scanl (?) str (tail str)
This repeatedly applies (?) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the last element) with its reversed counter part:
init<>reverse
Haskell, 60 bytes
(init<>reverse).(scanl(pure.(>>= \u->u:[' '|' '<u]))<*>tail)
Explanation / Ungolfed
For a string (eg. "abc") we apply first
scanl (pure . (>>= \u->u:[' '|' '<u])) <*> tail
which is the same as
\str -> scanl (const . (>>= \u->u:[' '|' '<u])) str (tail str)
This repeatedly applies (>>= \u->u:[' '|' '<u])) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the firstlast element) with its reversed counter part:
init<>reverse
Haskell, 60 bytes
(init<>reverse).(scanl(pure.(>>= \u->u:[' '|' '<u]))<*>tail)
Explanation / Ungolfed
For a string (eg. "abc") we apply first
scanl (pure . (>>= \u->u:[' '|' '<u])) <*> tail
which is the same as
\str -> scanl (const . (>>= \u->u:[' '|' '<u])) str (tail str)
This repeatedly applies (>>= \u->u:[' '|' '<u])) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the first element) with its reversed counter part:
init<>reverse
Haskell, 60 bytes
(init<>reverse).(scanl(pure.(>>= \u->u:[' '|' '<u]))<*>tail)
Explanation / Ungolfed
For a string (eg. "abc") we apply first
scanl (pure . (>>= \u->u:[' '|' '<u])) <*> tail
which is the same as
\str -> scanl (const . (>>= \u->u:[' '|' '<u])) str (tail str)
This repeatedly applies (>>= \u->u:[' '|' '<u])) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the last element) with its reversed counter part:
init<>reverse
Haskell, 60 bytes
(init<>reverse).(scanl(pure.(>>= \u->u:[' '|' '<u]))<*>tail)
Explanation / Ungolfed
For a string (eg. "abc") we apply first
scanl (pure . (>>= \u->u:[' '|' '<u])) <*> tail
which is the same as
\str -> scanl (const . (>>= \u->u:[' '|' '<u])) str (tail str)
This repeatedly applies (>>= \u->u:[' '|' '<u])) (appends a space to each character in the range [33..]) to the str until there are that many strings as str has characters: ["abc","a b c ", "a b c "]
Now we only need to concatenate the result (minus the first element) with its reversed counter part:
init<>reverse