Post History
Haskell + hgl, 32 24 bytes tlM$tk6<cy<fiI(rl2~<)eL3 Explanation tlM map a over the tail of the input ... fiI if ... el3 the length is 3 (rl2~<) repeat each letter in place twi...
Answer
#7: Post edited
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
hgl is supposed to be good a structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants. This wouldn't actually save any bytes here, but it's a good idea.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
- * There should be a flip of `cz`, and it should probably be two bytes. If this existed I could do the extremely weird:
- ```
- tlM$cZ W6<fiI(rl2~<)eL3
- ```
- This reshapes the string to the size of the built-in string `"aeiouy"` as a substitute for `tk6<cy`. It would save 1 byte.
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good at structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants. This wouldn't actually save any bytes here, but it's a good idea.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
- * There should be a flip of `cz`, and it should probably be two bytes. If this existed I could do the extremely weird:
- ```
- tlM$cZ W6<fiI(rl2~<)eL3
- ```
- This reshapes the string to the size of the built-in string `"aeiouy"` as a substitute for `tk6<cy`. It would save 1 byte.
#6: Post edited
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants. This wouldn't actually save any bytes here, but it's a good idea.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
* There should be a flip of 'cz'. If this existed I could do the extremely weird:- ```
tlM$fcz W6<fiI(rl2~<)eL3- ```
This reshapes the string to the size of the built-in string `"aeiouy"` as a substitute for `tk6<cy`. It would still tie this answer however.
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants. This wouldn't actually save any bytes here, but it's a good idea.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
- * There should be a flip of `cz`, and it should probably be two bytes. If this existed I could do the extremely weird:
- ```
- tlM$cZ W6<fiI(rl2~<)eL3
- ```
- This reshapes the string to the size of the built-in string `"aeiouy"` as a substitute for `tk6<cy`. It would save 1 byte.
#5: Post edited
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
* `fiI`, and its partner `lii`, should have infix variants.* Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants. This wouldn't actually save any bytes here, but it's a good idea.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
- * There should be a flip of 'cz'. If this existed I could do the extremely weird:
- ```
- tlM$fcz W6<fiI(rl2~<)eL3
- ```
- This reshapes the string to the size of the built-in string `"aeiouy"` as a substitute for `tk6<cy`. It would still tie this answer however.
#4: Post edited
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
hgl is supposed to be good a structural manipulations like this, so this answer is way too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants.
* Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would save an impressive 3 bytes on this answer.
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer feels a little too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would have saved an impressive 3 bytes on an earlier version of this answer, but using the odd length shortcut on this answer would tie.
#3: Post edited
# Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), 32 bytes- ```
tlM$fiI rt3 eL2<fiI(rl2~<)(od<l)- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
* `l` the length ...* `od` is odd ..- * `(rl2~<)` repeat each letter in place twice.
* `fiI` if ...* `eL2` the length is 2 ...* `rt3` repeat the entire thing thrice.Odd length occurs only when the input is size 1 or 3, at which point doubling in place gets us to an even length.- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer is way too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would save an impressive 3 bytes on this answer.
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), ~~32~~ 24 bytes
- ```
- tlM$tk6<cy<fiI(rl2~<)eL3
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `el3` the length is 3
- * `(rl2~<)` repeat each letter in place twice.
- * `cy` cycle the list indefinitely
- * `tk6` take the first 6 characters.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer is way too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would save an impressive 3 bytes on this answer.
#2: Post edited
# Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), 37 bytes- ```
mp"#"<fiI rt3 eL2<fiI(rl2~<)(od<l)<tl- ```
- ## Explanation
* `tl` remove the `#`- * `fiI` if ...
- * `l` the length ...
- * `od` is odd ..
- * `(rl2~<)` repeat each letter in place twice.
- * `fiI` if ...
- * `eL2` the length is 2 ...
- * `rt3` repeat the entire thing thrice.
* `mp"#"` add a hash to the front.- Odd length occurs only when the input is size 1 or 3, at which point doubling in place gets us to an even length.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer is way too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants.
* Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would save an impressive 3 bytes on this answer.* I thought there was a function to map over the tail of a list. This should be implemented.
- # Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), 32 bytes
- ```
- tlM$fiI rt3 eL2<fiI(rl2~<)(od<l)
- ```
- ## Explanation
- * `tlM` map a over the tail of the input ...
- * `fiI` if ...
- * `l` the length ...
- * `od` is odd ..
- * `(rl2~<)` repeat each letter in place twice.
- * `fiI` if ...
- * `eL2` the length is 2 ...
- * `rt3` repeat the entire thing thrice.
- Odd length occurs only when the input is size 1 or 3, at which point doubling in place gets us to an even length.
- ## Reflection
- hgl is supposed to be good a structural manipulations like this, so this answer is way too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl.
- So I have the following suggestions:
- * `fiI`, and its partner `lii`, should have infix variants.
- * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would save an impressive 3 bytes on this answer.
#1: Initial revision
# Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), 37 bytes ``` mp"#"<fiI rt3 eL2<fiI(rl2~<)(od<l)<tl ``` ## Explanation * `tl` remove the `#` * `fiI` if ... * `l` the length ... * `od` is odd .. * `(rl2~<)` repeat each letter in place twice. * `fiI` if ... * `eL2` the length is 2 ... * `rt3` repeat the entire thing thrice. * `mp"#"` add a hash to the front. Odd length occurs only when the input is size 1 or 3, at which point doubling in place gets us to an even length. ## Reflection hgl is supposed to be good a structural manipulations like this, so this answer is way too long. I think a big part of the issue is that it involves a lot of conditional behavior which is not so robust in hgl. So I have the following suggestions: * `fiI`, and its partner `lii`, should have infix variants. * Odd length (`od<l`) and even length (`ev<l`) should have shortcuts. This would save an impressive 3 bytes on this answer. * I thought there was a function to map over the tail of a list. This should be implemented.