<p>As pointed out by Marcus Ritt, the correct name for this operation seems to be <em>stutter</em>. </p>

<p>As far as I could determine, it has mostly been used in the field of concurrency theory, where I could trace it back at least to <a href="http://research.microsoft.com/en-us/um/people/lamport/pubs/what-good.pdf" rel="nofollow">Lamport's 1983 seminal paper on temporal logic</a>.</p>

CC BY-SA 3.0
2015-04-15T21:40:28.803Z
2015-04-15T21:40:28.803Z
Yann Ponty
<p>Given a string $s$ over some alphabet, I'd like to use the proper nomenclature/notation for the operation/function $f$ which <em>inflates</em> $s$ by independently duplicating each of its characters.</p>

<p>For instance:
$$ f(abc) = aabbcc$$
or, more generally, a second argument could be provided to specify the number of copies:
$$ f(xy,4) = xxxxyyyy$$</p>

<p>This should be embarassingly standard, so don't hesitate to shoot me in your response! 
(on the other hand, it is always difficult to search for something you cannot name, but I wouldn't accept such a lame excuse from my students, so...)</p>

CC BY-SA 3.0
2014-12-23T22:42:18.003Z
Not sure about a standard name, but in haskell that would be  `concatMap (replicate 3)` (where `concatMap` is the flipped bind for the list monad).
Radu GRIGore
CC BY-SA 3.0
2014-12-23T22:46:22.830Z
Thanks, but it is a nomenclature question rather than a coding one. I'm sure the answer will be embarassingly obvious...
Yann Ponty
CC BY-SA 3.0
2014-12-23T23:55:56.720Z
I know the name for its reverse: *squeeze*, used in the context of regular expressions :) . However "function that duplicates each character of a string" seems fine (to me).
Marzio De Biasi
CC BY-SA 3.0
2014-12-23T23:58:28.460Z
Thanks for the info. Would you have some academic reference on that (paper...)?
Yann Ponty
CC BY-SA 3.0
2014-12-24T00:10:34.377Z
If you mean a reference for "squeeze", I think that you can find it on google. For the "function that duplicates ..." its only my opinion, but I just searched it on google and it appears (at least) on [this paper](http://www.cs.hku.hk/research/techreps/document/TR-2006-13.pdf) and [this book](https://books.google.it/books?id=QwUOopeuTuIC&pg=PA184&lpg=PA184&dq=function+"duplicates+each+character"+string). But I think you can also try to search other variants (or wait other answers) ...
Marzio De Biasi
CC BY-SA 3.0
2014-12-24T08:29:46.343Z
@YannPonty I know it's a nomenclature question. For me, Haskell's library is the standard reference for the name of such functions. The names are chosen very carefully, and inspired by things like category theory. The very fact that there's no _one_ function doing what you want in Haskell's library indicates to me that the name (if there is one) can't be that standard.
Radu GRIGore
CC BY-SA 3.0
2014-12-24T16:24:02.113Z
I see, thanks for the clarification.
Isn't it crazy that this transform does not have a name, though?
I mean, there is even a standard name (Boustrophedon) for the transform that concatenates the first char, last, second, penultimate, third...
Why would this natural transform remain unnamed?
Yann Ponty
CC BY-SA 3.0
2014-12-26T10:18:55.950Z
"stutter" seems like a natural name, google "stutter string function" for examples.
Marcus Ritt
CC BY-SA 3.0
2014-12-29T02:44:52.240Z
This indeed seems to be the right term, and it is mentioned in multiple academic papers, including [this '99 STACS review paper by Thomas Rilke](http://link.springer.com/chapter/10.1007/3-540-49116-3_3). Could you turn your comment into an answer, so I can accept it (and it becomes properly indexed)?
Yann Ponty
<co.combinatorics><string-matching><combinatorics><notation>
What is the standard name for the function which inflates a string by duplicating each of its characters?
Yann Ponty
# What is the standard name for the function which inflates a string by duplicating each of its characters?

(Asked by: username_0 on 2014-12-23)

Given a string $s$ over some alphabet, I'd like to use the proper nomenclature/notation for the operation/function $f$ which *inflates* $s$ by independently duplicating each of its characters.

For instance:
$$ f(abc) = aabbcc$$
or, more generally, a second argument could be provided to specify the number of copies:
$$ f(xy,4) = xxxxyyyy$$

This should be embarassingly standard, so don't hesitate to shoot me in your response!
(on the other hand, it is always difficult to search for something you cannot name, but I wouldn't accept such a lame excuse from my students, so...)

**Tags:** co.combinatorics, string-matching, combinatorics, notation
> **Comments:**
> **username_1**: Not sure about a standard name, but in haskell that would be  `concatMap (replicate 3)` (where `concatMap` is the flipped bind for the list monad).  
> **username_0**: Thanks, but it is a nomenclature question rather than a coding one. I'm sure the answer will be embarassingly obvious...  
> **username_2**: I know the name for its reverse: *squeeze*, used in the context of regular expressions :) . However "function that duplicates each character of a string" seems fine (to me).  
> **username_0**: Thanks for the info. Would you have some academic reference on that (paper...)?  
> **username_2**: If you mean a reference for "squeeze", I think that you can find it on google. For the "function that duplicates ..." its only my opinion, but I just searched it on google and it appears (at least) on [this paper](http://www.cs.hku.hk/research/techreps/document/TR-2006-13.pdf) and [this book](https://books.google.it/books?id=QwUOopeuTuIC&pg=PA184&lpg=PA184&dq=function+"duplicates+each+character"+string). But I think you can also try to search other variants (or wait other answers) ...  
> **username_1**: @YannPonty I know it's a nomenclature question. For me, Haskell's library is the standard reference for the name of such functions. The names are chosen very carefully, and inspired by things like category theory. The very fact that there's no _one_ function doing what you want in Haskell's library indicates to me that the name (if there is one) can't be that standard.  
> **username_0**: I see, thanks for the clarification. Isn't it crazy that this transform does not have a name, though? I mean, there is even a standard name (Boustrophedon) for the transform that concatenates the first char, last, second, penultimate, third... Why would this natural transform remain unnamed?  
> **username_3**: "stutter" seems like a natural name, google "stutter string function" for examples.  
> **username_0**: This indeed seems to be the right term, and it is mentioned in multiple academic papers, including [this '99 STACS review paper by Thomas Rilke](http://link.springer.com/chapter/10.1007/3-540-49116-3_3). Could you turn your comment into an answer, so I can accept it (and it becomes properly indexed)?  

---

## 1 answers

### Answer by username_0 on 2015-04-15. Score: 3 | Accepted answer

As pointed out by Marcus Ritt, the correct name for this operation seems to be *stutter*.

As far as I could determine, it has mostly been used in the field of concurrency theory, where I could trace it back at least to [Lamport's 1983 seminal paper on temporal logic](http://research.microsoft.com/en-us/um/people/lamport/pubs/what-good.pdf).


---

