There's a hole in the bottom of the sea
$begingroup$
Whilst trying (and failing) have persuade my infant son to eat his dinner, I tried singing to him. Mid way through this song I realised the formulaic structure might lend itself well to code golfing!
The task is to write a program or function which accepts no input and produces the following text:
There's a hole in the bottom of the sea
There's a hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
Challenge rules:
- The text may be printed or returned as function output
- Each verse is separated by a single empty line
- Trailing whitespace is OK as long as it does not change the layout (so no leading whitespace or extra spaces between words)
- Trailing newlines are OK too.
- No leading newlines.
- All languages welcomed, and this is code-golf, so the shortest answer in bytes for each language wins!
code-golf kolmogorov-complexity
$endgroup$
|
show 4 more comments
$begingroup$
Whilst trying (and failing) have persuade my infant son to eat his dinner, I tried singing to him. Mid way through this song I realised the formulaic structure might lend itself well to code golfing!
The task is to write a program or function which accepts no input and produces the following text:
There's a hole in the bottom of the sea
There's a hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
Challenge rules:
- The text may be printed or returned as function output
- Each verse is separated by a single empty line
- Trailing whitespace is OK as long as it does not change the layout (so no leading whitespace or extra spaces between words)
- Trailing newlines are OK too.
- No leading newlines.
- All languages welcomed, and this is code-golf, so the shortest answer in bytes for each language wins!
code-golf kolmogorov-complexity
$endgroup$
6
$begingroup$
Similar to There Was an Old Lady (other similar challenges e.g. this have been closed as duplicates, although I don't think they necessarily should.)
$endgroup$
– Jonathan Allan
Jan 30 at 16:33
6
$begingroup$
Ho, ro, the rattlin' bog, the bog down in the valley-o.
$endgroup$
– fəˈnɛtɪk
Jan 30 at 22:22
4
$begingroup$
For comparison (though not a programming language)gzip -5
compresses it to 186 bytes (andbzip2
andxz
seem to do worse).
$endgroup$
– Daniel Schepler
Jan 30 at 23:34
1
$begingroup$
Congrats, from another developer parent :)
$endgroup$
– AJFaraday
Jan 31 at 14:26
1
$begingroup$
I want to adapt this song to 05AB1E... "There's a hole in oh-five-ay-bee-one-ee!"
$endgroup$
– Magic Octopus Urn
Jan 31 at 16:40
|
show 4 more comments
$begingroup$
Whilst trying (and failing) have persuade my infant son to eat his dinner, I tried singing to him. Mid way through this song I realised the formulaic structure might lend itself well to code golfing!
The task is to write a program or function which accepts no input and produces the following text:
There's a hole in the bottom of the sea
There's a hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
Challenge rules:
- The text may be printed or returned as function output
- Each verse is separated by a single empty line
- Trailing whitespace is OK as long as it does not change the layout (so no leading whitespace or extra spaces between words)
- Trailing newlines are OK too.
- No leading newlines.
- All languages welcomed, and this is code-golf, so the shortest answer in bytes for each language wins!
code-golf kolmogorov-complexity
$endgroup$
Whilst trying (and failing) have persuade my infant son to eat his dinner, I tried singing to him. Mid way through this song I realised the formulaic structure might lend itself well to code golfing!
The task is to write a program or function which accepts no input and produces the following text:
There's a hole in the bottom of the sea
There's a hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sea
There's a hole, there's a hole
There's a hole in the bottom of the sea
Challenge rules:
- The text may be printed or returned as function output
- Each verse is separated by a single empty line
- Trailing whitespace is OK as long as it does not change the layout (so no leading whitespace or extra spaces between words)
- Trailing newlines are OK too.
- No leading newlines.
- All languages welcomed, and this is code-golf, so the shortest answer in bytes for each language wins!
code-golf kolmogorov-complexity
code-golf kolmogorov-complexity
edited Jan 30 at 16:02
Sok
asked Jan 30 at 14:46
SokSok
4,157925
4,157925
6
$begingroup$
Similar to There Was an Old Lady (other similar challenges e.g. this have been closed as duplicates, although I don't think they necessarily should.)
$endgroup$
– Jonathan Allan
Jan 30 at 16:33
6
$begingroup$
Ho, ro, the rattlin' bog, the bog down in the valley-o.
$endgroup$
– fəˈnɛtɪk
Jan 30 at 22:22
4
$begingroup$
For comparison (though not a programming language)gzip -5
compresses it to 186 bytes (andbzip2
andxz
seem to do worse).
$endgroup$
– Daniel Schepler
Jan 30 at 23:34
1
$begingroup$
Congrats, from another developer parent :)
$endgroup$
– AJFaraday
Jan 31 at 14:26
1
$begingroup$
I want to adapt this song to 05AB1E... "There's a hole in oh-five-ay-bee-one-ee!"
$endgroup$
– Magic Octopus Urn
Jan 31 at 16:40
|
show 4 more comments
6
$begingroup$
Similar to There Was an Old Lady (other similar challenges e.g. this have been closed as duplicates, although I don't think they necessarily should.)
$endgroup$
– Jonathan Allan
Jan 30 at 16:33
6
$begingroup$
Ho, ro, the rattlin' bog, the bog down in the valley-o.
$endgroup$
– fəˈnɛtɪk
Jan 30 at 22:22
4
$begingroup$
For comparison (though not a programming language)gzip -5
compresses it to 186 bytes (andbzip2
andxz
seem to do worse).
$endgroup$
– Daniel Schepler
Jan 30 at 23:34
1
$begingroup$
Congrats, from another developer parent :)
$endgroup$
– AJFaraday
Jan 31 at 14:26
1
$begingroup$
I want to adapt this song to 05AB1E... "There's a hole in oh-five-ay-bee-one-ee!"
$endgroup$
– Magic Octopus Urn
Jan 31 at 16:40
6
6
$begingroup$
Similar to There Was an Old Lady (other similar challenges e.g. this have been closed as duplicates, although I don't think they necessarily should.)
$endgroup$
– Jonathan Allan
Jan 30 at 16:33
$begingroup$
Similar to There Was an Old Lady (other similar challenges e.g. this have been closed as duplicates, although I don't think they necessarily should.)
$endgroup$
– Jonathan Allan
Jan 30 at 16:33
6
6
$begingroup$
Ho, ro, the rattlin' bog, the bog down in the valley-o.
$endgroup$
– fəˈnɛtɪk
Jan 30 at 22:22
$begingroup$
Ho, ro, the rattlin' bog, the bog down in the valley-o.
$endgroup$
– fəˈnɛtɪk
Jan 30 at 22:22
4
4
$begingroup$
For comparison (though not a programming language)
gzip -5
compresses it to 186 bytes (and bzip2
and xz
seem to do worse).$endgroup$
– Daniel Schepler
Jan 30 at 23:34
$begingroup$
For comparison (though not a programming language)
gzip -5
compresses it to 186 bytes (and bzip2
and xz
seem to do worse).$endgroup$
– Daniel Schepler
Jan 30 at 23:34
1
1
$begingroup$
Congrats, from another developer parent :)
$endgroup$
– AJFaraday
Jan 31 at 14:26
$begingroup$
Congrats, from another developer parent :)
$endgroup$
– AJFaraday
Jan 31 at 14:26
1
1
$begingroup$
I want to adapt this song to 05AB1E... "There's a hole in oh-five-ay-bee-one-ee!"
$endgroup$
– Magic Octopus Urn
Jan 31 at 16:40
$begingroup$
I want to adapt this song to 05AB1E... "There's a hole in oh-five-ay-bee-one-ee!"
$endgroup$
– Magic Octopus Urn
Jan 31 at 16:40
|
show 4 more comments
34 Answers
34
active
oldest
votes
1 2
next
$begingroup$
SOGL, 103 94 93 bytes
Ψ ~Δ№Q‘离vζh‛←&M⁶╥7[P≈╔6≡⁸(φΔ⅔Σ‚>≡ā⁷⁽○¹‘Ξ⁵K4s³‘⁽Bθ2n{@∑" the ”+Κ:bΚē‽:C}TPb"n@²‘+Tō, upcPøP
Try it here!
...‘ push "bottom of the sea" - kept for the loop, here for
...‘ push "hole in log in bump on frog on wart on hair on fly on flea on smile on"
...‘ push "there's a "
⁽ uppercase the 1st letter of that
B save "There's a " in B
θ split the long data string on spaces
2n split in arrays of length 2
{ for each of those:
@∑ join the current array with spaces - e.g. "hole in"
" the ”+ append " the " to it
Κ prepend that to "bottom of the sea" (or whatever it is now)
: create a copy
bΚ prepend B to it - finishes current line
ē‽:C} if (E++), save a copy of that in C (for the last line)
TP print the current line twice
b"...‘+ B + "hole" - "There's a hole"
T output that, keeping item
ō, output ", "
up print the kept item lowercased
cP print the contents of C
øP print an empty line
$endgroup$
14
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
8
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
1
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
4
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
add a comment |
$begingroup$
Stax, 90 87 75 bytes
¥▌▼h4█☻■Ω1gçΔ¶Zjµ│☺X▄)/╞▄╒)¥jêLqα╧ñu┌⌂½╧ûⁿ↕O◘╔╪kl<æàbπïfuσ♪╫qΓ╪ûQ├╘Te♥Æó♣ƒE
Run and debug it
Unpacked, ungolfed, and commented it looks like this.
`;$w]i"50h1&V~OP>F$` compressed literal for "There's a hole in the bottom of the sea"
X store in register X without popping
zG push an empty string and jump to the target (trailing })
`hfUiVx}.|j~vG12])Bxk?v zF`j split "log bump frog wart hair fly flea smile" into array of words
F for each word, execute the following
i. o. i? (i ? " o" : " i") where i is the 0-based iteration index
+ concatenate to the word
`_o9!`+ concatenate "n the "
G jump to target below, resume next foreach iteration when finished
} this is the target of `G`, execution resumes when finished
As|@ insert substring at position 10
QQ peek and print with newlines twice
x14( trim string to leftmost 14 characters
q peek and print without newlines
., p print ", " without newline
vP lowercase 14 characters and print with newline
xP push value of register X, then print with newline
zP print blank line
Run this one
$endgroup$
2
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
1
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
add a comment |
$begingroup$
Perl 5, 158 154 bytes
$_="There's a bottom of the sea
";for$,(<{{hole,log}" i",{bump,frog,wart,hair,fly,flea,smile}" o"}>){s/a/a $,n the/;say$_.$_.($t||=s/.{14}/$&, l$&
$&/r)}
154 bytes
158 bytes
$endgroup$
5
$begingroup$
There's a bottom of the sea
. The facts check out, +1
$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
:), there's also this variation starting withThere's a sea
but it's longer
$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
add a comment |
$begingroup$
Python 2, 202 190 187 185 183 182 181 bytes
s="bottom of the sean"
a="There's a "
for w in'hole log bump frog wart hair fly flea smile'.split():s=w+" %sn the "%'io'['g'in s]+s;print(a+s)*2+a+"hole, t%sholen"%a[1:]+a+s[-30:]
Try it online!
Old alternatives to 'io'['g'in s]
(13 bytes):
- 14:
'oi'[s[5]<'n']
- 15:
'io'[len(s)>30]
,'ioo'[len(s)%3]
,'ooi'[len(s)%4]
, and'io'[w[1]=='o']
Saved:
- -1 byte, thanks to Jonathan Allan
- -1 byte, thanks to Rod
- -1 byte, thanks to Erik the Outgolfer
$endgroup$
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte
$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring'io'['g'in s]
!
$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
|
show 1 more comment
$begingroup$
C (gcc), 261 246 236 bytes
#define X" on the "
char*a="smile"X"flea"X"fly"X"hair"X"wart"X"frog"X"bump"X"log in the hole in the bottom of the sean";f(i){for(i=0;i<9;)printf("T%s%sT%1$s%2$sT%1$shole, t%1$sholenT%1$s%3$sn","here's a ",a+"_TH<0$31r"[i++],a+95);}
-15 bytes, Thanks to Daniel Schepler
-10 bytes, Thanks to ceilingcat
Try it online!
$endgroup$
2
$begingroup$
Could you write,*b="_TH<0$31r"
instead?
$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
add a comment |
$begingroup$
05AB1E, 103 100 99 97 96 93 92 bytes
Saved a byte thanks to Kevin Cruijssen
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v’T€Î's a ’s„oiN2‹èy“ÿ ÿn€€ ÿ“©“—耂€€í™“JDN_iDU}X14£Dl‚„, ýXõ»,®
Try it online!
Explanation
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v
starts a loop over the list ["hole", "log", "bump", "frog", "wart", "hair", "fly", "flea", "smile"]
. The words are compressed using the 05AB1E dictionary.
On each we do:
’T€Î's a ’ # push the string "There's a "
s # move the string from the previous iteration to the top of the stack
# will be an empty string the first iteration since there is no input
„oiN2‹è # push "i" for the first 2 iterations and "o" otherwise
y # push the current word
“ÿ ÿn€€ ÿ“ # use interpolacing to create the meat of the current iteration string
# meaning "hole in the ", "log in the hole in the " and so on
© # store a copy in the register for the next iteration
“—耂€€í™“ # push the string "bottom of the sea"
JD # join the whole line together and duplicate it
N_iDU} # if this is the first iteration, store a copy of the line in X
X14£ # push the first 14 chars of X, which is "There's a hole"
Dl # make a lower-case copy
‚„, ý # join the original with the lowercase copy on ", ", forming line 3
X # push X which is line 4
õ # push and empty string, to create the line break between sections
», # join the whole section on newlines and print
® # push the register for the next iteration
$endgroup$
2
$begingroup$
You can remove the leadingõ
, because apparently it outputs an empty string by default when as
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!
$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
1
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
add a comment |
$begingroup$
PowerShell, 194 188 185 180 174 bytes
$z=$a="in the bottom of the sea"
$b="here's a"
$h="$b hole"
echo hole log bump frog wart hair fly flea smile|%{,"T$b $_ $a"*2
$a='oi'[!$j++]+"n the $_ $a"
"T$h, t$h
T$h $z
"}
Try it online!
Can't quite seem to catch Python...
Basically, sets a few common strings to $h
, $a
, $z
, and $b
, then goes through a loop through each of the items (hole
, log
, ... flea
, smile
), each iteration outputting the appropriate verse. There's a little bit of logic with !$j++
in the middle to account for the in
/on
switch that happens. Otherwise, all the strings are just left on the pipeline, and the default Write-Output
gives us newlines for free.
-6 bytes thanks to Arnauld.
-3 bytes thanks to mazzy.
-5 bytes thanks to Veskah.
-6 bytes thanks to mazzy.
$endgroup$
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use-split
quite a bit for getting words.
$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
1
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
|
show 3 more comments
$begingroup$
JavaScript (ES6), 201 194 189 188 187 bytes
Saved 1 byte thanks to @Shaggy
_=>`14log4bump5frog5wart5hair5fly5flea5smile5`.replace(/.+?d/g,w=>`T0${(p=w+3+p)+p}1, t01
T01432
`.replace(/d/g,n=>`here's a |hole|bottom of the sea
|n the | i| o`.split`|`[n]),p=`2T0`)
Try it online!
JavaScript (ES6), 235 bytes
Simply RegPack'ed.
_=>[..."Z^_$cdjkqvxz{}~"].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`Tj{{}qq}$$}~~}dd}__}xx}cc}[[v~ frogz$}v
Z{kZz on^x flyz_v], tj]Zkq log in^{k] in^ bottom of^ seajhere's ad wartz~c fleazx$ bumpzq_ hairzd^ the] hole[ smilezcZ
Tj`)
Try it online!
$endgroup$
add a comment |
$begingroup$
Bash, 168 160 bytes
r="There's a bottom of the sea
";for i in {hole,log} in {bump,frog,wart,hair,fly,flea,smile} on;{
r=${r/a/a $i the};t=${r:0:14};echo "$r$r${u=$t, ${t,}
$r}";}
160 bytes
168 bytes
Translated from my other answer in Perl.
$endgroup$
add a comment |
$begingroup$
Japt -Rx
, 126 116 113 112 111 109 107 bytes
It turns out that golfing a string compression challenge while on your phone down the boozer is incredibly difficult - who'd've thunk?!
`T's»dâ ÈÞomºfdÈ a`rdS
tE8
¯E
`logn¿mpnfgnØnirnf§nf¤Úè`qÍË2ÆiAV¯E©8 iF¯E ÔqVri'oÃpW+v iSi,)UPÃc
Test it
:The first 3 lines get assigned to variables U, V & W, respectively
`...` :The compressed string "There'sdadholedindthedbottomdofdthedsea"
rdS :Replace all "d"s with spaces
tE8 :Substring of U from 0-based index 14 (E), of length 8 (=" in the ")
¯E :Slice U to index 14 (="There's a hole")
`...` :The compressed string "lognbumpnfrognwartnhairnflynfleasmilent"
qÍ :Split on "n" (note that the last element is irrelevant)
Ë :Map each element at 0-based index E in array F
2Æ : Map the range [0,2)
iA : Insert the following in U at index 10
V¯ : V sliced to index
E©8 : Logical AND of E and 8 (=0 on first iteration, 8 on all others)
i : Prepend
F¯E : Slice F to index E
Ô : Reverse
q : Join with
Vri'o : Replace "i" with "o" in V
à : End map
p : Push
W+ : W appended with
v : W lowercased
iSi, : Prepended with a space prepended with a comma
) : End append
UP : U and an empty string
à :End map
c :Flatten
:Implicitly join with newlines, trim & output
$endgroup$
add a comment |
$begingroup$
XML, 719 673 603 514 493 486 bytes
<!DOCTYPE a[<!ENTITY T "There's a"><!ENTITY O " on the"><!ENTITY a " hole in the bottom of the sea
"><!ENTITY b " log in the&a;"><!ENTITY c " bump&O;&b;"><!ENTITY d " frog&O;&c;"><!ENTITY e " wart&O;&d;"><!ENTITY f " hair&O;&e;"><!ENTITY g " fly&O;&f;"><!ENTITY i " flea&O;&g;"><!ENTITY z "&T; hole, there's a hole
&T;&a;
">]><a>&T;&a;&T;&a;&z;&T;&b;&T;&b;&z;&T;&c;&T;&c;&z;&T;&d;&T;&d;&z;&T;&e;&T;&e;&z;&T;&f;&T;&f;&z;&T;&g;&T;&g;&z;&T;&i;&T;&i;&z;&T; smile&O;&i;&T; smile&O;&i;&z;</a>
You can "execute" it with xmlstarlet sel -t -m '//a' -v . -n <xml_file_here>
.
This would be a lot easier if XML wasn't so verbose, but on the bright side, this is less than 25% the size of the original text.
$endgroup$
add a comment |
$begingroup$
Retina 0.8.2, 150 bytes
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
N
$&$'¶TH
O^$`
.+
$&¶$&¶THW, tHW¶THE¶
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Try it online! Explanation:
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
Insert the last verse.
N
$&$'¶TH
Compute all the verses.
O^$`
Put the verses in the correct order.
.+
$&¶$&¶THW, tHW¶THE¶
Complete each verse and add the chorus.
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Expand some placeholders.
$endgroup$
add a comment |
$begingroup$
R, 237 231 bytes
i=" in the "
for(j in 0:8)cat(f<-c(t<-"There's a ",paste(c("log","bump","frog","wart","hair","fly","flea","smile")[j:0],collapse=" on the "),if(j)i,h<-"hole",i,b<-"bottom of the sea
"),f,t,h,", there's a ",h,"
",t,h,i,b,"
",sep="")
Try it online!
$endgroup$
add a comment |
$begingroup$
C (gcc), 334 328 307 299 bytes
char*s="here's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sean";i;k=105;a={0,1,1,1,1,0,1,2,2};main(j){for(;i<9;k-=11+a[i++])do{printf("T%s%s",s,s+k);}while(j++&1||!printf("T%shole, t%sholenT%s%sn",s,s,s,s+105));}
Try it online!
$endgroup$
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
add a comment |
$begingroup$
Perl 6, 166 bytes
($/=@(($!="There's a")X [R,](<hole log bump frog wart hair fly flea smile>Z(<i o>[$++>1]~"n the")xx*)X"bottom of the sea
")).map:{say "$_$_$! hole, {$!.lc} hole
$0"}
Try it online!
$endgroup$
add a comment |
$begingroup$
Japt -R
, 142 bytes
`¤clogc¿mpcfgcØÖrcf§cf¤acsÚè`qc
` e Þom e a`
`T's a `
£W+U¯YÄ ÔËE?"io"gE<Y +`n e `:P +Dø+` {V}
` ²+W+`¤, t's a ¤
{W}¤ {V+R
Try it online!
$endgroup$
add a comment |
$begingroup$
PHP, 180 178 bytes
foreach([hole,log,bump,frog,wart,hair,fly,flea,smile]as$w)echo$a=T.($b="here's a ").($s="$w ".io[++$i>2]."n the $s").$c="bottom of the sea
",$a,T,$b.=hole,", t$b
T$b in the $c
";
Run with -nr
or try it online.
Yields warnings in PHP 7.2; to fix, put quotes around
the array elements, io
, hole
and the two standalone T
.
$endgroup$
add a comment |
$begingroup$
Batch, 267 bytes
@echo off
set r=i
set t= There's a hole
set s=bottom of the sea
for %%w in (hole log bump frog wart hair fly flea smile)do call:c %%w
exit/b
:c
set s=%1 %r%n the %s%
echo%t:~,11%%s%
echo%t:~,11%%s%
echo%t%,%t:T=t%
echo%t%%s:~-25%
echo(
if %1==log set r=o
t
contains a string repeated in the chorus, s
contains most of the verse line, while r
chooses between in the
and on the
. In the verses, only the first 11 characters of t
is needed, while in the first chorus line the second copy of t
has its T
lowercased and the second chorus line reuses the last 25 characters of s
.
$endgroup$
add a comment |
$begingroup$
Ruby, 173 170 bytes
a="T#{["here's a hole"]*3*"%s"%[", t","
T"]+c=" in the "}bottom of the sea
"
b=a[31,39]
%w{log bump frog wart hair fly flea smile x}.map{|i|puts b,b,a;b[9]+=i+c;c[1]=?o}
Try it online!
$endgroup$
add a comment |
$begingroup$
Haskell, 243 215 bytes
Reduced to 215 bytes with great help from nimi
c[[l n,l n,'T'#h++", "++'t'#h,l 8,""]|n<-[8,7..0]]
t#u=t:"here's a "++u
h="hole"
c=concat
l n='T'#c(drop n$map(++" on the ")(words"smile flea fly hair wart frog bump")++["log in the ",h," in the bottom of the sea"])
Try it online!
(Old 243 byte version is here).
A quite straightforward solution.
-- main function producing a list of lines
v = concat [[
l n,
l n, -- second line of each verse equals to its first line
'T' # h ++ ", " ++ 't' # h,
l 8, -- last line of each verse is the same in all verses
""
] | n <- [8,7..0]]
-- a small helper to construct similar strings
t # u = t : "here's a " ++ u
h = "hole"
-- construct a first line of n-th verse (with n = 8 is the first and n = 0 is the last one)
-- Every such line begins with a constant prefix followed by expanding list of nested entities
l n = 'T' # concat (
drop n $
map (++ " on the ") (words "smile flea fly hair wart frog bump")
++ ["log in the ", h, " in the bottom of the sea"]
)
$endgroup$
1
$begingroup$
Some tips: a) you uses
only once, so you can inline it. b) you always prepend and append something tot
, so you can make it a (infix) function:t#u=t:"here's a "++u
. c) constructing the big list in functionl
withmap(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from8
down to0
(single digit numbers!) e) now inliningi
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop thev=
.
$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
1
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use>>=
(concatMap) from the list monad and inlineconcat
in functionl
. Try it online!
$endgroup$
– nimi
Feb 1 at 17:14
add a comment |
$begingroup$
JavaScript (Babel Node), 239 bytes
-7 bytes from @Oliver *.*
(x=0,r='hole0log0bump0frog0wart0hair0fly0flea0smile'.split`0`).map(a=>(t=(i="There's a ")+a+r.slice(0,x++).reverse().map((h,_)=>` ${"io"[_<x-2|0]}n the ${h}`).join``+(o=` in the bottom of the sea
`))+t+(`${k=i+"hole"}, ${k}
`)+k+o).join`
`
Try it online!
$endgroup$
1
$begingroup$
Te secondT
on the 3rd line of each verse should be lowercase.
$endgroup$
– Shaggy
Jan 31 at 14:16
add a comment |
$begingroup$
Python 3, 213 206 198 193 bytes
k='n the ';o=e='bottom of the sean';b="There's a ";h='hole'
for j in[h]+'log bump frog wart hair fly smile'.split():o=j+' '+'io'['g'in o]+k+o;print(b+o+b+o+b+h+', t'+b[1:]+h+'n'+b+h+' i'+k+e)
Try it online!
-15 bytes thanks to @Sara
-5 bytes thanks to @ASCII-only
Probably a bit more golfable, but not much.
New contributor
$endgroup$
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression thato=e=
would make botho
ande
refer to the same object. I also thought split would be longer.
$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@ArtemisFowlo
ande
do refer to the same object... it's just that strings are immutable in Python so things like+=
will create a new copy instead of mutating the existing one
$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
|
show 2 more comments
$begingroup$
Clean, 267 bytes
import StdEnv,Text,Data.List
t="here's a "
h="hole"
b=" in the bottom of the sea"
f=foldr((+)os#p="T"+t+join" on the "(reverse s)+" in the "+h+b
=join"n"[p,p,"T"+t+h+", t"+t+h+"nT"+t+h+b+"nn"])""(tl(inits["log","bump","frog","wart","hair","fly","flea","smile"]))
Try it online!
$endgroup$
add a comment |
$begingroup$
cQuents, 238 219 bytes
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
:"here's a ","hole in the bottom of the sea"," on the"
Try it online!
This challenge made me finally implement lists and strings in my language. This language is built for integer sequences, so it did pretty well!
Explanation
:"here's a ","hole in the bottom of the sea"," on the"
helper line: c1), c2), and c3) access the three terms in this list
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
helper line: yields a list containing the first n terms in it, accessed with bx)
for example, the first three terms are:
"","log in the","bump"~c3
so b3) would yield ["","log in the","bump on the"] (~ is concatenation and c3 is " on the")
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
|@
join sequence on literal newline
#36:: output first 36 terms in sequence joined together
following are the 4 terms in the sequence, which will cycle through 9 times (for a total of 36 terms)
"T"~c1)~jrbk));@ )~c2, first term
"T"~c1)~ "T" concat "here's a " concat
jrbk));@ ) the first k terms of b, reversed, and joined on " "
~c2, concat "hole in the bottom of the sea"
Z, second term - same as previous
"T"~c1)~"hole, t"~c1)~"hole", third term
"T"~c1)~ "T" concat "here's a " concat
"hole, t"~c1)~"hole", "hole, t" concat "here's a " concat "hole"
"T"~c1)~c2)~@
fourth term - "T" concat "here's a " concat "hole on the bottom of the sea" concat newline
$endgroup$
add a comment |
$begingroup$
Perl 5, 194 bytes
@ASCII-only shaved off 6 bytes with literal newlines and a l
trick I forgot about
$"=" on the ";say+($b=($e="There's a ").hole,$c=" in the bottom of the sea",$/)x2,$.="$b, l$b
$b$c
";say"$e@a[-$_..-1] in the hole$c
"x2,$.for 1..(@a=qw/smile flea fly hair wart frog bump log/)
Try it online!
$endgroup$
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen thel
before, but never had a reason to use it, so never thought of it.
$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
|
show 3 more comments
$begingroup$
Charcoal, 115 106 bytes
≔There's a holeθEE⁹⁺…θχ⪫⮌…⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x⁺²ιn the ⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Try it online! Link is to verbose version of code. Edit: Saved 9 bytes by copying my Batch code for the last line of the chorus. Explanation:
≔There's a holeθ
Save the string There's a hole
, which is used twice as-is, a third time in lower case, and also a fourth time but just the first 10 characters.
⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x
Split the string bottom of the seaxhole ixlog ixbump oxfrog oxwart oxhair oxfly oxflea oxsmile o
on x
s.
E⁹⁺…θχ⪫⮌…...⁺²ιn the
Loop over the 9 verses, taking the first i+2
elements of the array, reversing them, joining them with n the
, and prefixing There's a
to the result.
E...⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Expand each line into a verse by duplicating the line and constructing the chorus. Each line of the verse is then implicitly printed on each own line, and each verse is implicitly separated by a blank line.
$endgroup$
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 222 bytes
string b="There's a ",d="hole in the bottom of the sean",e,f;foreach(var s in" log bump frog wart hair fly flea smile".Split())Write((e=b+(f=s!=""?s+(f!=""?" o":" i")+"n the "+f:s)+d)+e+b+$@"hole, there's a hole
{b+d}
");
Try it online!
-5 bytes thanks to @ASCIIOnly!
I have a small child and can assure you this song is equal parts catchy and annoying.
$endgroup$
1
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
.Any()
->!=""
?
$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
and you don't need the space afterin
in theforeach
>_>
$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
add a comment |
$begingroup$
V, 184 170 bytes
4iThere's a hole in the bottom of the sea
kky5w5eá,lpD5brtHj4yyGp4w8ion the 2briilog 3bibump 3bifrog 3biwart 3bihair 3bifly 3biflea 3bismile 7ñ4yykp4wd3wñ8ñÄ5jñ
Try it online!
Explanation:
4iThere's a hole in the bottom of the sea<n><esc>
Insert "Theres' a hole in the bottom of the sea" 4 times.
kk
Move to the third line
y5w
copy "There's a hole"
5eá,
insert a comma after "There's a hole"
lp
paste after the comma
D
delete the rest of the line
5brt
lowercase the second T
Hj4yy
copy 4 lines from the second line
Gp
Paste everything after the first line
4w8ion the <esc>
(at the end of the first verse) move to first "hole" in second verse and insert "on the " 8 times
2briilog <esc>
move backwards to the last "on", replace the o with an i and then insert "log "
3bibump <esc>3bifrog <esc>3biwart <esc>3bihair <esc>3bifly <esc>3biflea <esc>3bismile <esc>
Move backwards through the line, inserting the appropriate words between each "on the"
7ñ4yykp4wd3wñ
execute4yykp4wd3w
7 times
4yykp
duplicate the verse before this one
4wd3w
move to the first word after "There's a hole" and delete 3 words
8ñÄ5jñ
duplicate the first line of each verse after the first (there are 8 of these to do)
$endgroup$
add a comment |
$begingroup$
///, 216 bytes
/V/////U// VS/TCVR/iBVQUtheVPUoBVOUholeVN/RASVM/ASO, tCO
SA
VL/RMSVKUlog VJUbumpPKVIUfrogPJVHUwartPIVGUhairPHVFUflyPGVEUfleaPFVDUsmilePEVC/here's aVB/nQVA/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
Try it online!
This sort of task is the one and only thing that /// is reasonably good at. :D Hey, the result is shorter than C, C# or Java!
The output from this program ends in two trailing line breaks; hope that's not a deal-breaker.
Anyway, there's no real cleverness here. I simply identified repeated strings and defined one-character shortcuts for them, and repeated until I didn't see any more repeated strings. I did this in a more-or-less naive and greedy fashion. I did, however, intentionally define a shortcut for "smile on the flea on the ... sea", followed by "flea on the fly on the ... sea", and so forth, in order to form a chain of shortcuts. The result is that the whole sequence of new nouns is clearly visible in the code, and I find that pretty pleasing. :)
After V and U are replaced, we have the following more readable code:
/S/TC//R/iB//Q/ the//P/ oB//O/ hole//N/RAS//M/ASO, tCO
SA
//L/RMS//K/ log //J/ bumpPK//I/ frogPJ//H/ wartPI//G/ hairPH//F/ flyPG//E/ fleaPF//D/ smilePE//C/here's a//B/nQ//A/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
$endgroup$
add a comment |
$begingroup$
Shell, 291 bytes
echo 'smile,flea,fly,hair,wart,frog,bump,log,hole'|awk -F, 'BEGIN{z="here'''s a ";a="T"z;c=a "hole";b=" in the bottom of the sea"}function f(n){printf a $n;for(j=n+1;j<=NF;j++){printf " on the " $j};print b;}{for(i=NF;i>=1;i--){printf (i<NF)?"n":"";f(i);f(i);print c", t" z "hole";f(NF)}}'
I'm sure it can be golfed further (definitions of vars & function) ...
$endgroup$
add a comment |
1 2
next
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "200"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179269%2ftheres-a-hole-in-the-bottom-of-the-sea%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
34 Answers
34
active
oldest
votes
34 Answers
34
active
oldest
votes
active
oldest
votes
active
oldest
votes
1 2
next
$begingroup$
SOGL, 103 94 93 bytes
Ψ ~Δ№Q‘离vζh‛←&M⁶╥7[P≈╔6≡⁸(φΔ⅔Σ‚>≡ā⁷⁽○¹‘Ξ⁵K4s³‘⁽Bθ2n{@∑" the ”+Κ:bΚē‽:C}TPb"n@²‘+Tō, upcPøP
Try it here!
...‘ push "bottom of the sea" - kept for the loop, here for
...‘ push "hole in log in bump on frog on wart on hair on fly on flea on smile on"
...‘ push "there's a "
⁽ uppercase the 1st letter of that
B save "There's a " in B
θ split the long data string on spaces
2n split in arrays of length 2
{ for each of those:
@∑ join the current array with spaces - e.g. "hole in"
" the ”+ append " the " to it
Κ prepend that to "bottom of the sea" (or whatever it is now)
: create a copy
bΚ prepend B to it - finishes current line
ē‽:C} if (E++), save a copy of that in C (for the last line)
TP print the current line twice
b"...‘+ B + "hole" - "There's a hole"
T output that, keeping item
ō, output ", "
up print the kept item lowercased
cP print the contents of C
øP print an empty line
$endgroup$
14
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
8
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
1
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
4
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
add a comment |
$begingroup$
SOGL, 103 94 93 bytes
Ψ ~Δ№Q‘离vζh‛←&M⁶╥7[P≈╔6≡⁸(φΔ⅔Σ‚>≡ā⁷⁽○¹‘Ξ⁵K4s³‘⁽Bθ2n{@∑" the ”+Κ:bΚē‽:C}TPb"n@²‘+Tō, upcPøP
Try it here!
...‘ push "bottom of the sea" - kept for the loop, here for
...‘ push "hole in log in bump on frog on wart on hair on fly on flea on smile on"
...‘ push "there's a "
⁽ uppercase the 1st letter of that
B save "There's a " in B
θ split the long data string on spaces
2n split in arrays of length 2
{ for each of those:
@∑ join the current array with spaces - e.g. "hole in"
" the ”+ append " the " to it
Κ prepend that to "bottom of the sea" (or whatever it is now)
: create a copy
bΚ prepend B to it - finishes current line
ē‽:C} if (E++), save a copy of that in C (for the last line)
TP print the current line twice
b"...‘+ B + "hole" - "There's a hole"
T output that, keeping item
ō, output ", "
up print the kept item lowercased
cP print the contents of C
øP print an empty line
$endgroup$
14
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
8
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
1
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
4
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
add a comment |
$begingroup$
SOGL, 103 94 93 bytes
Ψ ~Δ№Q‘离vζh‛←&M⁶╥7[P≈╔6≡⁸(φΔ⅔Σ‚>≡ā⁷⁽○¹‘Ξ⁵K4s³‘⁽Bθ2n{@∑" the ”+Κ:bΚē‽:C}TPb"n@²‘+Tō, upcPøP
Try it here!
...‘ push "bottom of the sea" - kept for the loop, here for
...‘ push "hole in log in bump on frog on wart on hair on fly on flea on smile on"
...‘ push "there's a "
⁽ uppercase the 1st letter of that
B save "There's a " in B
θ split the long data string on spaces
2n split in arrays of length 2
{ for each of those:
@∑ join the current array with spaces - e.g. "hole in"
" the ”+ append " the " to it
Κ prepend that to "bottom of the sea" (or whatever it is now)
: create a copy
bΚ prepend B to it - finishes current line
ē‽:C} if (E++), save a copy of that in C (for the last line)
TP print the current line twice
b"...‘+ B + "hole" - "There's a hole"
T output that, keeping item
ō, output ", "
up print the kept item lowercased
cP print the contents of C
øP print an empty line
$endgroup$
SOGL, 103 94 93 bytes
Ψ ~Δ№Q‘离vζh‛←&M⁶╥7[P≈╔6≡⁸(φΔ⅔Σ‚>≡ā⁷⁽○¹‘Ξ⁵K4s³‘⁽Bθ2n{@∑" the ”+Κ:bΚē‽:C}TPb"n@²‘+Tō, upcPøP
Try it here!
...‘ push "bottom of the sea" - kept for the loop, here for
...‘ push "hole in log in bump on frog on wart on hair on fly on flea on smile on"
...‘ push "there's a "
⁽ uppercase the 1st letter of that
B save "There's a " in B
θ split the long data string on spaces
2n split in arrays of length 2
{ for each of those:
@∑ join the current array with spaces - e.g. "hole in"
" the ”+ append " the " to it
Κ prepend that to "bottom of the sea" (or whatever it is now)
: create a copy
bΚ prepend B to it - finishes current line
ē‽:C} if (E++), save a copy of that in C (for the last line)
TP print the current line twice
b"...‘+ B + "hole" - "There's a hole"
T output that, keeping item
ō, output ", "
up print the kept item lowercased
cP print the contents of C
øP print an empty line
edited Feb 1 at 15:17
answered Jan 30 at 15:26
dzaimadzaima
16k22060
16k22060
14
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
8
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
1
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
4
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
add a comment |
14
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
8
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
1
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
4
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
14
14
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
$begingroup$
But....but how?
$endgroup$
– SomeShinyObject
Jan 31 at 4:06
8
8
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
$begingroup$
Incredible. How even--
$endgroup$
– Austin Burk
Jan 31 at 5:04
1
1
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
$begingroup$
HNQ strikes again! :
$endgroup$
– Shaggy
Feb 1 at 1:30
4
4
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
$begingroup$
@KevinCruijssen added
$endgroup$
– dzaima
Feb 1 at 15:20
add a comment |
$begingroup$
Stax, 90 87 75 bytes
¥▌▼h4█☻■Ω1gçΔ¶Zjµ│☺X▄)/╞▄╒)¥jêLqα╧ñu┌⌂½╧ûⁿ↕O◘╔╪kl<æàbπïfuσ♪╫qΓ╪ûQ├╘Te♥Æó♣ƒE
Run and debug it
Unpacked, ungolfed, and commented it looks like this.
`;$w]i"50h1&V~OP>F$` compressed literal for "There's a hole in the bottom of the sea"
X store in register X without popping
zG push an empty string and jump to the target (trailing })
`hfUiVx}.|j~vG12])Bxk?v zF`j split "log bump frog wart hair fly flea smile" into array of words
F for each word, execute the following
i. o. i? (i ? " o" : " i") where i is the 0-based iteration index
+ concatenate to the word
`_o9!`+ concatenate "n the "
G jump to target below, resume next foreach iteration when finished
} this is the target of `G`, execution resumes when finished
As|@ insert substring at position 10
QQ peek and print with newlines twice
x14( trim string to leftmost 14 characters
q peek and print without newlines
., p print ", " without newline
vP lowercase 14 characters and print with newline
xP push value of register X, then print with newline
zP print blank line
Run this one
$endgroup$
2
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
1
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
add a comment |
$begingroup$
Stax, 90 87 75 bytes
¥▌▼h4█☻■Ω1gçΔ¶Zjµ│☺X▄)/╞▄╒)¥jêLqα╧ñu┌⌂½╧ûⁿ↕O◘╔╪kl<æàbπïfuσ♪╫qΓ╪ûQ├╘Te♥Æó♣ƒE
Run and debug it
Unpacked, ungolfed, and commented it looks like this.
`;$w]i"50h1&V~OP>F$` compressed literal for "There's a hole in the bottom of the sea"
X store in register X without popping
zG push an empty string and jump to the target (trailing })
`hfUiVx}.|j~vG12])Bxk?v zF`j split "log bump frog wart hair fly flea smile" into array of words
F for each word, execute the following
i. o. i? (i ? " o" : " i") where i is the 0-based iteration index
+ concatenate to the word
`_o9!`+ concatenate "n the "
G jump to target below, resume next foreach iteration when finished
} this is the target of `G`, execution resumes when finished
As|@ insert substring at position 10
QQ peek and print with newlines twice
x14( trim string to leftmost 14 characters
q peek and print without newlines
., p print ", " without newline
vP lowercase 14 characters and print with newline
xP push value of register X, then print with newline
zP print blank line
Run this one
$endgroup$
2
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
1
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
add a comment |
$begingroup$
Stax, 90 87 75 bytes
¥▌▼h4█☻■Ω1gçΔ¶Zjµ│☺X▄)/╞▄╒)¥jêLqα╧ñu┌⌂½╧ûⁿ↕O◘╔╪kl<æàbπïfuσ♪╫qΓ╪ûQ├╘Te♥Æó♣ƒE
Run and debug it
Unpacked, ungolfed, and commented it looks like this.
`;$w]i"50h1&V~OP>F$` compressed literal for "There's a hole in the bottom of the sea"
X store in register X without popping
zG push an empty string and jump to the target (trailing })
`hfUiVx}.|j~vG12])Bxk?v zF`j split "log bump frog wart hair fly flea smile" into array of words
F for each word, execute the following
i. o. i? (i ? " o" : " i") where i is the 0-based iteration index
+ concatenate to the word
`_o9!`+ concatenate "n the "
G jump to target below, resume next foreach iteration when finished
} this is the target of `G`, execution resumes when finished
As|@ insert substring at position 10
QQ peek and print with newlines twice
x14( trim string to leftmost 14 characters
q peek and print without newlines
., p print ", " without newline
vP lowercase 14 characters and print with newline
xP push value of register X, then print with newline
zP print blank line
Run this one
$endgroup$
Stax, 90 87 75 bytes
¥▌▼h4█☻■Ω1gçΔ¶Zjµ│☺X▄)/╞▄╒)¥jêLqα╧ñu┌⌂½╧ûⁿ↕O◘╔╪kl<æàbπïfuσ♪╫qΓ╪ûQ├╘Te♥Æó♣ƒE
Run and debug it
Unpacked, ungolfed, and commented it looks like this.
`;$w]i"50h1&V~OP>F$` compressed literal for "There's a hole in the bottom of the sea"
X store in register X without popping
zG push an empty string and jump to the target (trailing })
`hfUiVx}.|j~vG12])Bxk?v zF`j split "log bump frog wart hair fly flea smile" into array of words
F for each word, execute the following
i. o. i? (i ? " o" : " i") where i is the 0-based iteration index
+ concatenate to the word
`_o9!`+ concatenate "n the "
G jump to target below, resume next foreach iteration when finished
} this is the target of `G`, execution resumes when finished
As|@ insert substring at position 10
QQ peek and print with newlines twice
x14( trim string to leftmost 14 characters
q peek and print without newlines
., p print ", " without newline
vP lowercase 14 characters and print with newline
xP push value of register X, then print with newline
zP print blank line
Run this one
edited Feb 5 at 3:59
answered Jan 30 at 23:26
recursiverecursive
5,7091322
5,7091322
2
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
1
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
add a comment |
2
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
1
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
2
2
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
Would you mind adding an explanation? Curious to see how it works.
$endgroup$
– Kevin Cruijssen
Feb 1 at 8:18
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
$begingroup$
I will but I still have the feeling that a totally different approach will do better. After I succeed or fail in that I'll explain whatever's left.
$endgroup$
– recursive
Feb 1 at 15:50
1
1
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
$begingroup$
@KevinCruijssen: I had a feeling that that there was a much better approach. Sure enough, I totally re-wrote it, and saved another 12 bytes of bloat. I added some explanation as well.
$endgroup$
– recursive
Feb 5 at 4:00
add a comment |
$begingroup$
Perl 5, 158 154 bytes
$_="There's a bottom of the sea
";for$,(<{{hole,log}" i",{bump,frog,wart,hair,fly,flea,smile}" o"}>){s/a/a $,n the/;say$_.$_.($t||=s/.{14}/$&, l$&
$&/r)}
154 bytes
158 bytes
$endgroup$
5
$begingroup$
There's a bottom of the sea
. The facts check out, +1
$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
:), there's also this variation starting withThere's a sea
but it's longer
$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
add a comment |
$begingroup$
Perl 5, 158 154 bytes
$_="There's a bottom of the sea
";for$,(<{{hole,log}" i",{bump,frog,wart,hair,fly,flea,smile}" o"}>){s/a/a $,n the/;say$_.$_.($t||=s/.{14}/$&, l$&
$&/r)}
154 bytes
158 bytes
$endgroup$
5
$begingroup$
There's a bottom of the sea
. The facts check out, +1
$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
:), there's also this variation starting withThere's a sea
but it's longer
$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
add a comment |
$begingroup$
Perl 5, 158 154 bytes
$_="There's a bottom of the sea
";for$,(<{{hole,log}" i",{bump,frog,wart,hair,fly,flea,smile}" o"}>){s/a/a $,n the/;say$_.$_.($t||=s/.{14}/$&, l$&
$&/r)}
154 bytes
158 bytes
$endgroup$
Perl 5, 158 154 bytes
$_="There's a bottom of the sea
";for$,(<{{hole,log}" i",{bump,frog,wart,hair,fly,flea,smile}" o"}>){s/a/a $,n the/;say$_.$_.($t||=s/.{14}/$&, l$&
$&/r)}
154 bytes
158 bytes
edited Jan 31 at 13:22
answered Jan 31 at 9:32
Nahuel FouilleulNahuel Fouilleul
3,015211
3,015211
5
$begingroup$
There's a bottom of the sea
. The facts check out, +1
$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
:), there's also this variation starting withThere's a sea
but it's longer
$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
add a comment |
5
$begingroup$
There's a bottom of the sea
. The facts check out, +1
$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
:), there's also this variation starting withThere's a sea
but it's longer
$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
5
5
$begingroup$
There's a bottom of the sea
. The facts check out, +1$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
There's a bottom of the sea
. The facts check out, +1$endgroup$
– Jo King
Jan 31 at 13:33
$begingroup$
:), there's also this variation starting with
There's a sea
but it's longer$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
$begingroup$
:), there's also this variation starting with
There's a sea
but it's longer$endgroup$
– Nahuel Fouilleul
Feb 1 at 13:25
add a comment |
$begingroup$
Python 2, 202 190 187 185 183 182 181 bytes
s="bottom of the sean"
a="There's a "
for w in'hole log bump frog wart hair fly flea smile'.split():s=w+" %sn the "%'io'['g'in s]+s;print(a+s)*2+a+"hole, t%sholen"%a[1:]+a+s[-30:]
Try it online!
Old alternatives to 'io'['g'in s]
(13 bytes):
- 14:
'oi'[s[5]<'n']
- 15:
'io'[len(s)>30]
,'ioo'[len(s)%3]
,'ooi'[len(s)%4]
, and'io'[w[1]=='o']
Saved:
- -1 byte, thanks to Jonathan Allan
- -1 byte, thanks to Rod
- -1 byte, thanks to Erik the Outgolfer
$endgroup$
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte
$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring'io'['g'in s]
!
$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
|
show 1 more comment
$begingroup$
Python 2, 202 190 187 185 183 182 181 bytes
s="bottom of the sean"
a="There's a "
for w in'hole log bump frog wart hair fly flea smile'.split():s=w+" %sn the "%'io'['g'in s]+s;print(a+s)*2+a+"hole, t%sholen"%a[1:]+a+s[-30:]
Try it online!
Old alternatives to 'io'['g'in s]
(13 bytes):
- 14:
'oi'[s[5]<'n']
- 15:
'io'[len(s)>30]
,'ioo'[len(s)%3]
,'ooi'[len(s)%4]
, and'io'[w[1]=='o']
Saved:
- -1 byte, thanks to Jonathan Allan
- -1 byte, thanks to Rod
- -1 byte, thanks to Erik the Outgolfer
$endgroup$
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte
$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring'io'['g'in s]
!
$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
|
show 1 more comment
$begingroup$
Python 2, 202 190 187 185 183 182 181 bytes
s="bottom of the sean"
a="There's a "
for w in'hole log bump frog wart hair fly flea smile'.split():s=w+" %sn the "%'io'['g'in s]+s;print(a+s)*2+a+"hole, t%sholen"%a[1:]+a+s[-30:]
Try it online!
Old alternatives to 'io'['g'in s]
(13 bytes):
- 14:
'oi'[s[5]<'n']
- 15:
'io'[len(s)>30]
,'ioo'[len(s)%3]
,'ooi'[len(s)%4]
, and'io'[w[1]=='o']
Saved:
- -1 byte, thanks to Jonathan Allan
- -1 byte, thanks to Rod
- -1 byte, thanks to Erik the Outgolfer
$endgroup$
Python 2, 202 190 187 185 183 182 181 bytes
s="bottom of the sean"
a="There's a "
for w in'hole log bump frog wart hair fly flea smile'.split():s=w+" %sn the "%'io'['g'in s]+s;print(a+s)*2+a+"hole, t%sholen"%a[1:]+a+s[-30:]
Try it online!
Old alternatives to 'io'['g'in s]
(13 bytes):
- 14:
'oi'[s[5]<'n']
- 15:
'io'[len(s)>30]
,'ioo'[len(s)%3]
,'ooi'[len(s)%4]
, and'io'[w[1]=='o']
Saved:
- -1 byte, thanks to Jonathan Allan
- -1 byte, thanks to Rod
- -1 byte, thanks to Erik the Outgolfer
edited Jan 31 at 7:46
answered Jan 30 at 14:57
TFeldTFeld
16.4k21451
16.4k21451
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte
$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring'io'['g'in s]
!
$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
|
show 1 more comment
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte
$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring'io'['g'in s]
!
$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
"hole, t%sholen"%a[1:]
saves a byte$endgroup$
– Jonathan Allan
Jan 30 at 16:29
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
You can save a byte by dropping the zip
$endgroup$
– Rod
Jan 30 at 18:26
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@JonathanAllan Thanks :)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
@Rod Thanks, :-)
$endgroup$
– TFeld
Jan 30 at 18:55
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring 'io'['g'in s]
!$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
$begingroup$
'oi'[s[5]<'n']
will be an old alternative too: Featuring 'io'['g'in s]
!$endgroup$
– Erik the Outgolfer
Jan 30 at 22:51
|
show 1 more comment
$begingroup$
C (gcc), 261 246 236 bytes
#define X" on the "
char*a="smile"X"flea"X"fly"X"hair"X"wart"X"frog"X"bump"X"log in the hole in the bottom of the sean";f(i){for(i=0;i<9;)printf("T%s%sT%1$s%2$sT%1$shole, t%1$sholenT%1$s%3$sn","here's a ",a+"_TH<0$31r"[i++],a+95);}
-15 bytes, Thanks to Daniel Schepler
-10 bytes, Thanks to ceilingcat
Try it online!
$endgroup$
2
$begingroup$
Could you write,*b="_TH<0$31r"
instead?
$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
add a comment |
$begingroup$
C (gcc), 261 246 236 bytes
#define X" on the "
char*a="smile"X"flea"X"fly"X"hair"X"wart"X"frog"X"bump"X"log in the hole in the bottom of the sean";f(i){for(i=0;i<9;)printf("T%s%sT%1$s%2$sT%1$shole, t%1$sholenT%1$s%3$sn","here's a ",a+"_TH<0$31r"[i++],a+95);}
-15 bytes, Thanks to Daniel Schepler
-10 bytes, Thanks to ceilingcat
Try it online!
$endgroup$
2
$begingroup$
Could you write,*b="_TH<0$31r"
instead?
$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
add a comment |
$begingroup$
C (gcc), 261 246 236 bytes
#define X" on the "
char*a="smile"X"flea"X"fly"X"hair"X"wart"X"frog"X"bump"X"log in the hole in the bottom of the sean";f(i){for(i=0;i<9;)printf("T%s%sT%1$s%2$sT%1$shole, t%1$sholenT%1$s%3$sn","here's a ",a+"_TH<0$31r"[i++],a+95);}
-15 bytes, Thanks to Daniel Schepler
-10 bytes, Thanks to ceilingcat
Try it online!
$endgroup$
C (gcc), 261 246 236 bytes
#define X" on the "
char*a="smile"X"flea"X"fly"X"hair"X"wart"X"frog"X"bump"X"log in the hole in the bottom of the sean";f(i){for(i=0;i<9;)printf("T%s%sT%1$s%2$sT%1$shole, t%1$sholenT%1$s%3$sn","here's a ",a+"_TH<0$31r"[i++],a+95);}
-15 bytes, Thanks to Daniel Schepler
-10 bytes, Thanks to ceilingcat
Try it online!
edited Jan 31 at 15:35
answered Jan 30 at 18:47
Giacomo GarabelloGiacomo Garabello
1,429417
1,429417
2
$begingroup$
Could you write,*b="_TH<0$31r"
instead?
$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
add a comment |
2
$begingroup$
Could you write,*b="_TH<0$31r"
instead?
$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
2
2
$begingroup$
Could you write
,*b="_TH<0$31r"
instead?$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Could you write
,*b="_TH<0$31r"
instead?$endgroup$
– Daniel Schepler
Jan 30 at 23:21
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
Would it save any bytes to define " in the "?
$endgroup$
– OldBunny2800
Jan 31 at 19:51
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
$begingroup$
@OldBunny2800 no, it would be longer! in this case you need at least 6 occurrences to be effective...
$endgroup$
– Giacomo Garabello
Feb 1 at 8:16
add a comment |
$begingroup$
05AB1E, 103 100 99 97 96 93 92 bytes
Saved a byte thanks to Kevin Cruijssen
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v’T€Î's a ’s„oiN2‹èy“ÿ ÿn€€ ÿ“©“—耂€€í™“JDN_iDU}X14£Dl‚„, ýXõ»,®
Try it online!
Explanation
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v
starts a loop over the list ["hole", "log", "bump", "frog", "wart", "hair", "fly", "flea", "smile"]
. The words are compressed using the 05AB1E dictionary.
On each we do:
’T€Î's a ’ # push the string "There's a "
s # move the string from the previous iteration to the top of the stack
# will be an empty string the first iteration since there is no input
„oiN2‹è # push "i" for the first 2 iterations and "o" otherwise
y # push the current word
“ÿ ÿn€€ ÿ“ # use interpolacing to create the meat of the current iteration string
# meaning "hole in the ", "log in the hole in the " and so on
© # store a copy in the register for the next iteration
“—耂€€í™“ # push the string "bottom of the sea"
JD # join the whole line together and duplicate it
N_iDU} # if this is the first iteration, store a copy of the line in X
X14£ # push the first 14 chars of X, which is "There's a hole"
Dl # make a lower-case copy
‚„, ý # join the original with the lowercase copy on ", ", forming line 3
X # push X which is line 4
õ # push and empty string, to create the line break between sections
», # join the whole section on newlines and print
® # push the register for the next iteration
$endgroup$
2
$begingroup$
You can remove the leadingõ
, because apparently it outputs an empty string by default when as
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!
$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
1
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
add a comment |
$begingroup$
05AB1E, 103 100 99 97 96 93 92 bytes
Saved a byte thanks to Kevin Cruijssen
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v’T€Î's a ’s„oiN2‹èy“ÿ ÿn€€ ÿ“©“—耂€€í™“JDN_iDU}X14£Dl‚„, ýXõ»,®
Try it online!
Explanation
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v
starts a loop over the list ["hole", "log", "bump", "frog", "wart", "hair", "fly", "flea", "smile"]
. The words are compressed using the 05AB1E dictionary.
On each we do:
’T€Î's a ’ # push the string "There's a "
s # move the string from the previous iteration to the top of the stack
# will be an empty string the first iteration since there is no input
„oiN2‹è # push "i" for the first 2 iterations and "o" otherwise
y # push the current word
“ÿ ÿn€€ ÿ“ # use interpolacing to create the meat of the current iteration string
# meaning "hole in the ", "log in the hole in the " and so on
© # store a copy in the register for the next iteration
“—耂€€í™“ # push the string "bottom of the sea"
JD # join the whole line together and duplicate it
N_iDU} # if this is the first iteration, store a copy of the line in X
X14£ # push the first 14 chars of X, which is "There's a hole"
Dl # make a lower-case copy
‚„, ý # join the original with the lowercase copy on ", ", forming line 3
X # push X which is line 4
õ # push and empty string, to create the line break between sections
», # join the whole section on newlines and print
® # push the register for the next iteration
$endgroup$
2
$begingroup$
You can remove the leadingõ
, because apparently it outputs an empty string by default when as
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!
$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
1
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
add a comment |
$begingroup$
05AB1E, 103 100 99 97 96 93 92 bytes
Saved a byte thanks to Kevin Cruijssen
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v’T€Î's a ’s„oiN2‹èy“ÿ ÿn€€ ÿ“©“—耂€€í™“JDN_iDU}X14£Dl‚„, ýXõ»,®
Try it online!
Explanation
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v
starts a loop over the list ["hole", "log", "bump", "frog", "wart", "hair", "fly", "flea", "smile"]
. The words are compressed using the 05AB1E dictionary.
On each we do:
’T€Î's a ’ # push the string "There's a "
s # move the string from the previous iteration to the top of the stack
# will be an empty string the first iteration since there is no input
„oiN2‹è # push "i" for the first 2 iterations and "o" otherwise
y # push the current word
“ÿ ÿn€€ ÿ“ # use interpolacing to create the meat of the current iteration string
# meaning "hole in the ", "log in the hole in the " and so on
© # store a copy in the register for the next iteration
“—耂€€í™“ # push the string "bottom of the sea"
JD # join the whole line together and duplicate it
N_iDU} # if this is the first iteration, store a copy of the line in X
X14£ # push the first 14 chars of X, which is "There's a hole"
Dl # make a lower-case copy
‚„, ý # join the original with the lowercase copy on ", ", forming line 3
X # push X which is line 4
õ # push and empty string, to create the line break between sections
», # join the whole section on newlines and print
® # push the register for the next iteration
$endgroup$
05AB1E, 103 100 99 97 96 93 92 bytes
Saved a byte thanks to Kevin Cruijssen
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v’T€Î's a ’s„oiN2‹èy“ÿ ÿn€€ ÿ“©“—耂€€í™“JDN_iDU}X14£Dl‚„, ýXõ»,®
Try it online!
Explanation
“¥ÊˆŽ bumpÑå‡îtíÁ¤†îÌea¹²“#v
starts a loop over the list ["hole", "log", "bump", "frog", "wart", "hair", "fly", "flea", "smile"]
. The words are compressed using the 05AB1E dictionary.
On each we do:
’T€Î's a ’ # push the string "There's a "
s # move the string from the previous iteration to the top of the stack
# will be an empty string the first iteration since there is no input
„oiN2‹è # push "i" for the first 2 iterations and "o" otherwise
y # push the current word
“ÿ ÿn€€ ÿ“ # use interpolacing to create the meat of the current iteration string
# meaning "hole in the ", "log in the hole in the " and so on
© # store a copy in the register for the next iteration
“—耂€€í™“ # push the string "bottom of the sea"
JD # join the whole line together and duplicate it
N_iDU} # if this is the first iteration, store a copy of the line in X
X14£ # push the first 14 chars of X, which is "There's a hole"
Dl # make a lower-case copy
‚„, ý # join the original with the lowercase copy on ", ", forming line 3
X # push X which is line 4
õ # push and empty string, to create the line break between sections
», # join the whole section on newlines and print
® # push the register for the next iteration
edited Jan 31 at 16:54
answered Jan 30 at 18:11
EmignaEmigna
47.4k433144
47.4k433144
2
$begingroup$
You can remove the leadingõ
, because apparently it outputs an empty string by default when as
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!
$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
1
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
add a comment |
2
$begingroup$
You can remove the leadingõ
, because apparently it outputs an empty string by default when as
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!
$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
1
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
2
2
$begingroup$
You can remove the leading
õ
, because apparently it outputs an empty string by default when a s
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
$begingroup$
You can remove the leading
õ
, because apparently it outputs an empty string by default when a s
wap is used with nothing on the stack. I couldn't find anything else to golf; very nice answer!$endgroup$
– Kevin Cruijssen
Jan 31 at 14:58
1
1
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
$begingroup$
@KevinCruijssen: Oh yeah, I didn't consider that as there's usually input. Thanks :)
$endgroup$
– Emigna
Jan 31 at 16:52
add a comment |
$begingroup$
PowerShell, 194 188 185 180 174 bytes
$z=$a="in the bottom of the sea"
$b="here's a"
$h="$b hole"
echo hole log bump frog wart hair fly flea smile|%{,"T$b $_ $a"*2
$a='oi'[!$j++]+"n the $_ $a"
"T$h, t$h
T$h $z
"}
Try it online!
Can't quite seem to catch Python...
Basically, sets a few common strings to $h
, $a
, $z
, and $b
, then goes through a loop through each of the items (hole
, log
, ... flea
, smile
), each iteration outputting the appropriate verse. There's a little bit of logic with !$j++
in the middle to account for the in
/on
switch that happens. Otherwise, all the strings are just left on the pipeline, and the default Write-Output
gives us newlines for free.
-6 bytes thanks to Arnauld.
-3 bytes thanks to mazzy.
-5 bytes thanks to Veskah.
-6 bytes thanks to mazzy.
$endgroup$
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use-split
quite a bit for getting words.
$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
1
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
|
show 3 more comments
$begingroup$
PowerShell, 194 188 185 180 174 bytes
$z=$a="in the bottom of the sea"
$b="here's a"
$h="$b hole"
echo hole log bump frog wart hair fly flea smile|%{,"T$b $_ $a"*2
$a='oi'[!$j++]+"n the $_ $a"
"T$h, t$h
T$h $z
"}
Try it online!
Can't quite seem to catch Python...
Basically, sets a few common strings to $h
, $a
, $z
, and $b
, then goes through a loop through each of the items (hole
, log
, ... flea
, smile
), each iteration outputting the appropriate verse. There's a little bit of logic with !$j++
in the middle to account for the in
/on
switch that happens. Otherwise, all the strings are just left on the pipeline, and the default Write-Output
gives us newlines for free.
-6 bytes thanks to Arnauld.
-3 bytes thanks to mazzy.
-5 bytes thanks to Veskah.
-6 bytes thanks to mazzy.
$endgroup$
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use-split
quite a bit for getting words.
$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
1
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
|
show 3 more comments
$begingroup$
PowerShell, 194 188 185 180 174 bytes
$z=$a="in the bottom of the sea"
$b="here's a"
$h="$b hole"
echo hole log bump frog wart hair fly flea smile|%{,"T$b $_ $a"*2
$a='oi'[!$j++]+"n the $_ $a"
"T$h, t$h
T$h $z
"}
Try it online!
Can't quite seem to catch Python...
Basically, sets a few common strings to $h
, $a
, $z
, and $b
, then goes through a loop through each of the items (hole
, log
, ... flea
, smile
), each iteration outputting the appropriate verse. There's a little bit of logic with !$j++
in the middle to account for the in
/on
switch that happens. Otherwise, all the strings are just left on the pipeline, and the default Write-Output
gives us newlines for free.
-6 bytes thanks to Arnauld.
-3 bytes thanks to mazzy.
-5 bytes thanks to Veskah.
-6 bytes thanks to mazzy.
$endgroup$
PowerShell, 194 188 185 180 174 bytes
$z=$a="in the bottom of the sea"
$b="here's a"
$h="$b hole"
echo hole log bump frog wart hair fly flea smile|%{,"T$b $_ $a"*2
$a='oi'[!$j++]+"n the $_ $a"
"T$h, t$h
T$h $z
"}
Try it online!
Can't quite seem to catch Python...
Basically, sets a few common strings to $h
, $a
, $z
, and $b
, then goes through a loop through each of the items (hole
, log
, ... flea
, smile
), each iteration outputting the appropriate verse. There's a little bit of logic with !$j++
in the middle to account for the in
/on
switch that happens. Otherwise, all the strings are just left on the pipeline, and the default Write-Output
gives us newlines for free.
-6 bytes thanks to Arnauld.
-3 bytes thanks to mazzy.
-5 bytes thanks to Veskah.
-6 bytes thanks to mazzy.
edited Feb 1 at 17:48
answered Jan 30 at 16:02
AdmBorkBorkAdmBorkBork
27.7k466238
27.7k466238
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use-split
quite a bit for getting words.
$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
1
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
|
show 3 more comments
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use-split
quite a bit for getting words.
$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
1
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
-3 bytes :) Try it online!
$endgroup$
– mazzy
Jan 31 at 9:39
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use
-split
quite a bit for getting words.$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
@mazzy That's a clever trick. I'll need to keep that in mind, because I use
-split
quite a bit for getting words.$endgroup$
– AdmBorkBork
Jan 31 at 12:52
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
Two forgotten bytes
$endgroup$
– Veskah
Jan 31 at 21:43
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
$begingroup$
180 bytes
$endgroup$
– Veskah
Jan 31 at 23:40
1
1
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
$begingroup$
174. Try it online!
$endgroup$
– mazzy
Feb 1 at 17:14
|
show 3 more comments
$begingroup$
JavaScript (ES6), 201 194 189 188 187 bytes
Saved 1 byte thanks to @Shaggy
_=>`14log4bump5frog5wart5hair5fly5flea5smile5`.replace(/.+?d/g,w=>`T0${(p=w+3+p)+p}1, t01
T01432
`.replace(/d/g,n=>`here's a |hole|bottom of the sea
|n the | i| o`.split`|`[n]),p=`2T0`)
Try it online!
JavaScript (ES6), 235 bytes
Simply RegPack'ed.
_=>[..."Z^_$cdjkqvxz{}~"].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`Tj{{}qq}$$}~~}dd}__}xx}cc}[[v~ frogz$}v
Z{kZz on^x flyz_v], tj]Zkq log in^{k] in^ bottom of^ seajhere's ad wartz~c fleazx$ bumpzq_ hairzd^ the] hole[ smilezcZ
Tj`)
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript (ES6), 201 194 189 188 187 bytes
Saved 1 byte thanks to @Shaggy
_=>`14log4bump5frog5wart5hair5fly5flea5smile5`.replace(/.+?d/g,w=>`T0${(p=w+3+p)+p}1, t01
T01432
`.replace(/d/g,n=>`here's a |hole|bottom of the sea
|n the | i| o`.split`|`[n]),p=`2T0`)
Try it online!
JavaScript (ES6), 235 bytes
Simply RegPack'ed.
_=>[..."Z^_$cdjkqvxz{}~"].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`Tj{{}qq}$$}~~}dd}__}xx}cc}[[v~ frogz$}v
Z{kZz on^x flyz_v], tj]Zkq log in^{k] in^ bottom of^ seajhere's ad wartz~c fleazx$ bumpzq_ hairzd^ the] hole[ smilezcZ
Tj`)
Try it online!
$endgroup$
add a comment |
$begingroup$
JavaScript (ES6), 201 194 189 188 187 bytes
Saved 1 byte thanks to @Shaggy
_=>`14log4bump5frog5wart5hair5fly5flea5smile5`.replace(/.+?d/g,w=>`T0${(p=w+3+p)+p}1, t01
T01432
`.replace(/d/g,n=>`here's a |hole|bottom of the sea
|n the | i| o`.split`|`[n]),p=`2T0`)
Try it online!
JavaScript (ES6), 235 bytes
Simply RegPack'ed.
_=>[..."Z^_$cdjkqvxz{}~"].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`Tj{{}qq}$$}~~}dd}__}xx}cc}[[v~ frogz$}v
Z{kZz on^x flyz_v], tj]Zkq log in^{k] in^ bottom of^ seajhere's ad wartz~c fleazx$ bumpzq_ hairzd^ the] hole[ smilezcZ
Tj`)
Try it online!
$endgroup$
JavaScript (ES6), 201 194 189 188 187 bytes
Saved 1 byte thanks to @Shaggy
_=>`14log4bump5frog5wart5hair5fly5flea5smile5`.replace(/.+?d/g,w=>`T0${(p=w+3+p)+p}1, t01
T01432
`.replace(/d/g,n=>`here's a |hole|bottom of the sea
|n the | i| o`.split`|`[n]),p=`2T0`)
Try it online!
JavaScript (ES6), 235 bytes
Simply RegPack'ed.
_=>[..."Z^_$cdjkqvxz{}~"].reduce((p,c)=>(l=p.split(c)).join(l.pop()),`Tj{{}qq}$$}~~}dd}__}xx}cc}[[v~ frogz$}v
Z{kZz on^x flyz_v], tj]Zkq log in^{k] in^ bottom of^ seajhere's ad wartz~c fleazx$ bumpzq_ hairzd^ the] hole[ smilezcZ
Tj`)
Try it online!
edited Jan 31 at 14:59
answered Jan 30 at 14:54
ArnauldArnauld
80.3k797332
80.3k797332
add a comment |
add a comment |
$begingroup$
Bash, 168 160 bytes
r="There's a bottom of the sea
";for i in {hole,log} in {bump,frog,wart,hair,fly,flea,smile} on;{
r=${r/a/a $i the};t=${r:0:14};echo "$r$r${u=$t, ${t,}
$r}";}
160 bytes
168 bytes
Translated from my other answer in Perl.
$endgroup$
add a comment |
$begingroup$
Bash, 168 160 bytes
r="There's a bottom of the sea
";for i in {hole,log} in {bump,frog,wart,hair,fly,flea,smile} on;{
r=${r/a/a $i the};t=${r:0:14};echo "$r$r${u=$t, ${t,}
$r}";}
160 bytes
168 bytes
Translated from my other answer in Perl.
$endgroup$
add a comment |
$begingroup$
Bash, 168 160 bytes
r="There's a bottom of the sea
";for i in {hole,log} in {bump,frog,wart,hair,fly,flea,smile} on;{
r=${r/a/a $i the};t=${r:0:14};echo "$r$r${u=$t, ${t,}
$r}";}
160 bytes
168 bytes
Translated from my other answer in Perl.
$endgroup$
Bash, 168 160 bytes
r="There's a bottom of the sea
";for i in {hole,log} in {bump,frog,wart,hair,fly,flea,smile} on;{
r=${r/a/a $i the};t=${r:0:14};echo "$r$r${u=$t, ${t,}
$r}";}
160 bytes
168 bytes
Translated from my other answer in Perl.
edited Feb 4 at 11:49
answered Jan 31 at 11:01
Nahuel FouilleulNahuel Fouilleul
3,015211
3,015211
add a comment |
add a comment |
$begingroup$
Japt -Rx
, 126 116 113 112 111 109 107 bytes
It turns out that golfing a string compression challenge while on your phone down the boozer is incredibly difficult - who'd've thunk?!
`T's»dâ ÈÞomºfdÈ a`rdS
tE8
¯E
`logn¿mpnfgnØnirnf§nf¤Úè`qÍË2ÆiAV¯E©8 iF¯E ÔqVri'oÃpW+v iSi,)UPÃc
Test it
:The first 3 lines get assigned to variables U, V & W, respectively
`...` :The compressed string "There'sdadholedindthedbottomdofdthedsea"
rdS :Replace all "d"s with spaces
tE8 :Substring of U from 0-based index 14 (E), of length 8 (=" in the ")
¯E :Slice U to index 14 (="There's a hole")
`...` :The compressed string "lognbumpnfrognwartnhairnflynfleasmilent"
qÍ :Split on "n" (note that the last element is irrelevant)
Ë :Map each element at 0-based index E in array F
2Æ : Map the range [0,2)
iA : Insert the following in U at index 10
V¯ : V sliced to index
E©8 : Logical AND of E and 8 (=0 on first iteration, 8 on all others)
i : Prepend
F¯E : Slice F to index E
Ô : Reverse
q : Join with
Vri'o : Replace "i" with "o" in V
à : End map
p : Push
W+ : W appended with
v : W lowercased
iSi, : Prepended with a space prepended with a comma
) : End append
UP : U and an empty string
à :End map
c :Flatten
:Implicitly join with newlines, trim & output
$endgroup$
add a comment |
$begingroup$
Japt -Rx
, 126 116 113 112 111 109 107 bytes
It turns out that golfing a string compression challenge while on your phone down the boozer is incredibly difficult - who'd've thunk?!
`T's»dâ ÈÞomºfdÈ a`rdS
tE8
¯E
`logn¿mpnfgnØnirnf§nf¤Úè`qÍË2ÆiAV¯E©8 iF¯E ÔqVri'oÃpW+v iSi,)UPÃc
Test it
:The first 3 lines get assigned to variables U, V & W, respectively
`...` :The compressed string "There'sdadholedindthedbottomdofdthedsea"
rdS :Replace all "d"s with spaces
tE8 :Substring of U from 0-based index 14 (E), of length 8 (=" in the ")
¯E :Slice U to index 14 (="There's a hole")
`...` :The compressed string "lognbumpnfrognwartnhairnflynfleasmilent"
qÍ :Split on "n" (note that the last element is irrelevant)
Ë :Map each element at 0-based index E in array F
2Æ : Map the range [0,2)
iA : Insert the following in U at index 10
V¯ : V sliced to index
E©8 : Logical AND of E and 8 (=0 on first iteration, 8 on all others)
i : Prepend
F¯E : Slice F to index E
Ô : Reverse
q : Join with
Vri'o : Replace "i" with "o" in V
à : End map
p : Push
W+ : W appended with
v : W lowercased
iSi, : Prepended with a space prepended with a comma
) : End append
UP : U and an empty string
à :End map
c :Flatten
:Implicitly join with newlines, trim & output
$endgroup$
add a comment |
$begingroup$
Japt -Rx
, 126 116 113 112 111 109 107 bytes
It turns out that golfing a string compression challenge while on your phone down the boozer is incredibly difficult - who'd've thunk?!
`T's»dâ ÈÞomºfdÈ a`rdS
tE8
¯E
`logn¿mpnfgnØnirnf§nf¤Úè`qÍË2ÆiAV¯E©8 iF¯E ÔqVri'oÃpW+v iSi,)UPÃc
Test it
:The first 3 lines get assigned to variables U, V & W, respectively
`...` :The compressed string "There'sdadholedindthedbottomdofdthedsea"
rdS :Replace all "d"s with spaces
tE8 :Substring of U from 0-based index 14 (E), of length 8 (=" in the ")
¯E :Slice U to index 14 (="There's a hole")
`...` :The compressed string "lognbumpnfrognwartnhairnflynfleasmilent"
qÍ :Split on "n" (note that the last element is irrelevant)
Ë :Map each element at 0-based index E in array F
2Æ : Map the range [0,2)
iA : Insert the following in U at index 10
V¯ : V sliced to index
E©8 : Logical AND of E and 8 (=0 on first iteration, 8 on all others)
i : Prepend
F¯E : Slice F to index E
Ô : Reverse
q : Join with
Vri'o : Replace "i" with "o" in V
à : End map
p : Push
W+ : W appended with
v : W lowercased
iSi, : Prepended with a space prepended with a comma
) : End append
UP : U and an empty string
à :End map
c :Flatten
:Implicitly join with newlines, trim & output
$endgroup$
Japt -Rx
, 126 116 113 112 111 109 107 bytes
It turns out that golfing a string compression challenge while on your phone down the boozer is incredibly difficult - who'd've thunk?!
`T's»dâ ÈÞomºfdÈ a`rdS
tE8
¯E
`logn¿mpnfgnØnirnf§nf¤Úè`qÍË2ÆiAV¯E©8 iF¯E ÔqVri'oÃpW+v iSi,)UPÃc
Test it
:The first 3 lines get assigned to variables U, V & W, respectively
`...` :The compressed string "There'sdadholedindthedbottomdofdthedsea"
rdS :Replace all "d"s with spaces
tE8 :Substring of U from 0-based index 14 (E), of length 8 (=" in the ")
¯E :Slice U to index 14 (="There's a hole")
`...` :The compressed string "lognbumpnfrognwartnhairnflynfleasmilent"
qÍ :Split on "n" (note that the last element is irrelevant)
Ë :Map each element at 0-based index E in array F
2Æ : Map the range [0,2)
iA : Insert the following in U at index 10
V¯ : V sliced to index
E©8 : Logical AND of E and 8 (=0 on first iteration, 8 on all others)
i : Prepend
F¯E : Slice F to index E
Ô : Reverse
q : Join with
Vri'o : Replace "i" with "o" in V
à : End map
p : Push
W+ : W appended with
v : W lowercased
iSi, : Prepended with a space prepended with a comma
) : End append
UP : U and an empty string
à :End map
c :Flatten
:Implicitly join with newlines, trim & output
edited Feb 1 at 12:05
answered Jan 31 at 0:00
ShaggyShaggy
18.8k21768
18.8k21768
add a comment |
add a comment |
$begingroup$
XML, 719 673 603 514 493 486 bytes
<!DOCTYPE a[<!ENTITY T "There's a"><!ENTITY O " on the"><!ENTITY a " hole in the bottom of the sea
"><!ENTITY b " log in the&a;"><!ENTITY c " bump&O;&b;"><!ENTITY d " frog&O;&c;"><!ENTITY e " wart&O;&d;"><!ENTITY f " hair&O;&e;"><!ENTITY g " fly&O;&f;"><!ENTITY i " flea&O;&g;"><!ENTITY z "&T; hole, there's a hole
&T;&a;
">]><a>&T;&a;&T;&a;&z;&T;&b;&T;&b;&z;&T;&c;&T;&c;&z;&T;&d;&T;&d;&z;&T;&e;&T;&e;&z;&T;&f;&T;&f;&z;&T;&g;&T;&g;&z;&T;&i;&T;&i;&z;&T; smile&O;&i;&T; smile&O;&i;&z;</a>
You can "execute" it with xmlstarlet sel -t -m '//a' -v . -n <xml_file_here>
.
This would be a lot easier if XML wasn't so verbose, but on the bright side, this is less than 25% the size of the original text.
$endgroup$
add a comment |
$begingroup$
XML, 719 673 603 514 493 486 bytes
<!DOCTYPE a[<!ENTITY T "There's a"><!ENTITY O " on the"><!ENTITY a " hole in the bottom of the sea
"><!ENTITY b " log in the&a;"><!ENTITY c " bump&O;&b;"><!ENTITY d " frog&O;&c;"><!ENTITY e " wart&O;&d;"><!ENTITY f " hair&O;&e;"><!ENTITY g " fly&O;&f;"><!ENTITY i " flea&O;&g;"><!ENTITY z "&T; hole, there's a hole
&T;&a;
">]><a>&T;&a;&T;&a;&z;&T;&b;&T;&b;&z;&T;&c;&T;&c;&z;&T;&d;&T;&d;&z;&T;&e;&T;&e;&z;&T;&f;&T;&f;&z;&T;&g;&T;&g;&z;&T;&i;&T;&i;&z;&T; smile&O;&i;&T; smile&O;&i;&z;</a>
You can "execute" it with xmlstarlet sel -t -m '//a' -v . -n <xml_file_here>
.
This would be a lot easier if XML wasn't so verbose, but on the bright side, this is less than 25% the size of the original text.
$endgroup$
add a comment |
$begingroup$
XML, 719 673 603 514 493 486 bytes
<!DOCTYPE a[<!ENTITY T "There's a"><!ENTITY O " on the"><!ENTITY a " hole in the bottom of the sea
"><!ENTITY b " log in the&a;"><!ENTITY c " bump&O;&b;"><!ENTITY d " frog&O;&c;"><!ENTITY e " wart&O;&d;"><!ENTITY f " hair&O;&e;"><!ENTITY g " fly&O;&f;"><!ENTITY i " flea&O;&g;"><!ENTITY z "&T; hole, there's a hole
&T;&a;
">]><a>&T;&a;&T;&a;&z;&T;&b;&T;&b;&z;&T;&c;&T;&c;&z;&T;&d;&T;&d;&z;&T;&e;&T;&e;&z;&T;&f;&T;&f;&z;&T;&g;&T;&g;&z;&T;&i;&T;&i;&z;&T; smile&O;&i;&T; smile&O;&i;&z;</a>
You can "execute" it with xmlstarlet sel -t -m '//a' -v . -n <xml_file_here>
.
This would be a lot easier if XML wasn't so verbose, but on the bright side, this is less than 25% the size of the original text.
$endgroup$
XML, 719 673 603 514 493 486 bytes
<!DOCTYPE a[<!ENTITY T "There's a"><!ENTITY O " on the"><!ENTITY a " hole in the bottom of the sea
"><!ENTITY b " log in the&a;"><!ENTITY c " bump&O;&b;"><!ENTITY d " frog&O;&c;"><!ENTITY e " wart&O;&d;"><!ENTITY f " hair&O;&e;"><!ENTITY g " fly&O;&f;"><!ENTITY i " flea&O;&g;"><!ENTITY z "&T; hole, there's a hole
&T;&a;
">]><a>&T;&a;&T;&a;&z;&T;&b;&T;&b;&z;&T;&c;&T;&c;&z;&T;&d;&T;&d;&z;&T;&e;&T;&e;&z;&T;&f;&T;&f;&z;&T;&g;&T;&g;&z;&T;&i;&T;&i;&z;&T; smile&O;&i;&T; smile&O;&i;&z;</a>
You can "execute" it with xmlstarlet sel -t -m '//a' -v . -n <xml_file_here>
.
This would be a lot easier if XML wasn't so verbose, but on the bright side, this is less than 25% the size of the original text.
edited Feb 1 at 22:28
answered Feb 1 at 21:35
BeefsterBeefster
2,3871141
2,3871141
add a comment |
add a comment |
$begingroup$
Retina 0.8.2, 150 bytes
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
N
$&$'¶TH
O^$`
.+
$&¶$&¶THW, tHW¶THE¶
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Try it online! Explanation:
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
Insert the last verse.
N
$&$'¶TH
Compute all the verses.
O^$`
Put the verses in the correct order.
.+
$&¶$&¶THW, tHW¶THE¶
Complete each verse and add the chorus.
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Expand some placeholders.
$endgroup$
add a comment |
$begingroup$
Retina 0.8.2, 150 bytes
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
N
$&$'¶TH
O^$`
.+
$&¶$&¶THW, tHW¶THE¶
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Try it online! Explanation:
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
Insert the last verse.
N
$&$'¶TH
Compute all the verses.
O^$`
Put the verses in the correct order.
.+
$&¶$&¶THW, tHW¶THE¶
Complete each verse and add the chorus.
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Expand some placeholders.
$endgroup$
add a comment |
$begingroup$
Retina 0.8.2, 150 bytes
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
N
$&$'¶TH
O^$`
.+
$&¶$&¶THW, tHW¶THE¶
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Try it online! Explanation:
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
Insert the last verse.
N
$&$'¶TH
Compute all the verses.
O^$`
Put the verses in the correct order.
.+
$&¶$&¶THW, tHW¶THE¶
Complete each verse and add the chorus.
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Expand some placeholders.
$endgroup$
Retina 0.8.2, 150 bytes
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
N
$&$'¶TH
O^$`
.+
$&¶$&¶THW, tHW¶THE¶
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Try it online! Explanation:
THsmile oNflea oNfly oNhair oNwart oNfrog oNbump oNlog iNE
Insert the last verse.
N
$&$'¶TH
Compute all the verses.
O^$`
Put the verses in the correct order.
.+
$&¶$&¶THW, tHW¶THE¶
Complete each verse and add the chorus.
H
here's a
E
W iNbottom of the sea
W
hole
N
n the
Expand some placeholders.
answered Jan 30 at 21:37
NeilNeil
82.5k745179
82.5k745179
add a comment |
add a comment |
$begingroup$
R, 237 231 bytes
i=" in the "
for(j in 0:8)cat(f<-c(t<-"There's a ",paste(c("log","bump","frog","wart","hair","fly","flea","smile")[j:0],collapse=" on the "),if(j)i,h<-"hole",i,b<-"bottom of the sea
"),f,t,h,", there's a ",h,"
",t,h,i,b,"
",sep="")
Try it online!
$endgroup$
add a comment |
$begingroup$
R, 237 231 bytes
i=" in the "
for(j in 0:8)cat(f<-c(t<-"There's a ",paste(c("log","bump","frog","wart","hair","fly","flea","smile")[j:0],collapse=" on the "),if(j)i,h<-"hole",i,b<-"bottom of the sea
"),f,t,h,", there's a ",h,"
",t,h,i,b,"
",sep="")
Try it online!
$endgroup$
add a comment |
$begingroup$
R, 237 231 bytes
i=" in the "
for(j in 0:8)cat(f<-c(t<-"There's a ",paste(c("log","bump","frog","wart","hair","fly","flea","smile")[j:0],collapse=" on the "),if(j)i,h<-"hole",i,b<-"bottom of the sea
"),f,t,h,", there's a ",h,"
",t,h,i,b,"
",sep="")
Try it online!
$endgroup$
R, 237 231 bytes
i=" in the "
for(j in 0:8)cat(f<-c(t<-"There's a ",paste(c("log","bump","frog","wart","hair","fly","flea","smile")[j:0],collapse=" on the "),if(j)i,h<-"hole",i,b<-"bottom of the sea
"),f,t,h,", there's a ",h,"
",t,h,i,b,"
",sep="")
Try it online!
edited Jan 31 at 13:27
answered Jan 31 at 13:03
Kirill L.Kirill L.
5,9981527
5,9981527
add a comment |
add a comment |
$begingroup$
C (gcc), 334 328 307 299 bytes
char*s="here's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sean";i;k=105;a={0,1,1,1,1,0,1,2,2};main(j){for(;i<9;k-=11+a[i++])do{printf("T%s%s",s,s+k);}while(j++&1||!printf("T%shole, t%sholenT%s%sn",s,s,s,s+105));}
Try it online!
$endgroup$
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
add a comment |
$begingroup$
C (gcc), 334 328 307 299 bytes
char*s="here's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sean";i;k=105;a={0,1,1,1,1,0,1,2,2};main(j){for(;i<9;k-=11+a[i++])do{printf("T%s%s",s,s+k);}while(j++&1||!printf("T%shole, t%sholenT%s%sn",s,s,s,s+105));}
Try it online!
$endgroup$
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
add a comment |
$begingroup$
C (gcc), 334 328 307 299 bytes
char*s="here's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sean";i;k=105;a={0,1,1,1,1,0,1,2,2};main(j){for(;i<9;k-=11+a[i++])do{printf("T%s%s",s,s+k);}while(j++&1||!printf("T%shole, t%sholenT%s%sn",s,s,s,s+105));}
Try it online!
$endgroup$
C (gcc), 334 328 307 299 bytes
char*s="here's a smile on the flea on the fly on the hair on the wart on the frog on the bump on the log in the hole in the bottom of the sean";i;k=105;a={0,1,1,1,1,0,1,2,2};main(j){for(;i<9;k-=11+a[i++])do{printf("T%s%s",s,s+k);}while(j++&1||!printf("T%shole, t%sholenT%s%sn",s,s,s,s+105));}
Try it online!
edited Jan 30 at 19:41
answered Jan 30 at 15:32
cleblanccleblanc
3,260316
3,260316
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
add a comment |
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
$begingroup$
265 bytes
$endgroup$
– ceilingcat
Feb 1 at 23:09
add a comment |
$begingroup$
Perl 6, 166 bytes
($/=@(($!="There's a")X [R,](<hole log bump frog wart hair fly flea smile>Z(<i o>[$++>1]~"n the")xx*)X"bottom of the sea
")).map:{say "$_$_$! hole, {$!.lc} hole
$0"}
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 6, 166 bytes
($/=@(($!="There's a")X [R,](<hole log bump frog wart hair fly flea smile>Z(<i o>[$++>1]~"n the")xx*)X"bottom of the sea
")).map:{say "$_$_$! hole, {$!.lc} hole
$0"}
Try it online!
$endgroup$
add a comment |
$begingroup$
Perl 6, 166 bytes
($/=@(($!="There's a")X [R,](<hole log bump frog wart hair fly flea smile>Z(<i o>[$++>1]~"n the")xx*)X"bottom of the sea
")).map:{say "$_$_$! hole, {$!.lc} hole
$0"}
Try it online!
$endgroup$
Perl 6, 166 bytes
($/=@(($!="There's a")X [R,](<hole log bump frog wart hair fly flea smile>Z(<i o>[$++>1]~"n the")xx*)X"bottom of the sea
")).map:{say "$_$_$! hole, {$!.lc} hole
$0"}
Try it online!
answered Jan 31 at 0:13
Jo KingJo King
26.4k364130
26.4k364130
add a comment |
add a comment |
$begingroup$
Japt -R
, 142 bytes
`¤clogc¿mpcfgcØÖrcf§cf¤acsÚè`qc
` e Þom e a`
`T's a `
£W+U¯YÄ ÔËE?"io"gE<Y +`n e `:P +Dø+` {V}
` ²+W+`¤, t's a ¤
{W}¤ {V+R
Try it online!
$endgroup$
add a comment |
$begingroup$
Japt -R
, 142 bytes
`¤clogc¿mpcfgcØÖrcf§cf¤acsÚè`qc
` e Þom e a`
`T's a `
£W+U¯YÄ ÔËE?"io"gE<Y +`n e `:P +Dø+` {V}
` ²+W+`¤, t's a ¤
{W}¤ {V+R
Try it online!
$endgroup$
add a comment |
$begingroup$
Japt -R
, 142 bytes
`¤clogc¿mpcfgcØÖrcf§cf¤acsÚè`qc
` e Þom e a`
`T's a `
£W+U¯YÄ ÔËE?"io"gE<Y +`n e `:P +Dø+` {V}
` ²+W+`¤, t's a ¤
{W}¤ {V+R
Try it online!
$endgroup$
Japt -R
, 142 bytes
`¤clogc¿mpcfgcØÖrcf§cf¤acsÚè`qc
` e Þom e a`
`T's a `
£W+U¯YÄ ÔËE?"io"gE<Y +`n e `:P +Dø+` {V}
` ²+W+`¤, t's a ¤
{W}¤ {V+R
Try it online!
edited Jan 31 at 0:19
answered Jan 30 at 16:08
OliverOliver
5,4001832
5,4001832
add a comment |
add a comment |
$begingroup$
PHP, 180 178 bytes
foreach([hole,log,bump,frog,wart,hair,fly,flea,smile]as$w)echo$a=T.($b="here's a ").($s="$w ".io[++$i>2]."n the $s").$c="bottom of the sea
",$a,T,$b.=hole,", t$b
T$b in the $c
";
Run with -nr
or try it online.
Yields warnings in PHP 7.2; to fix, put quotes around
the array elements, io
, hole
and the two standalone T
.
$endgroup$
add a comment |
$begingroup$
PHP, 180 178 bytes
foreach([hole,log,bump,frog,wart,hair,fly,flea,smile]as$w)echo$a=T.($b="here's a ").($s="$w ".io[++$i>2]."n the $s").$c="bottom of the sea
",$a,T,$b.=hole,", t$b
T$b in the $c
";
Run with -nr
or try it online.
Yields warnings in PHP 7.2; to fix, put quotes around
the array elements, io
, hole
and the two standalone T
.
$endgroup$
add a comment |
$begingroup$
PHP, 180 178 bytes
foreach([hole,log,bump,frog,wart,hair,fly,flea,smile]as$w)echo$a=T.($b="here's a ").($s="$w ".io[++$i>2]."n the $s").$c="bottom of the sea
",$a,T,$b.=hole,", t$b
T$b in the $c
";
Run with -nr
or try it online.
Yields warnings in PHP 7.2; to fix, put quotes around
the array elements, io
, hole
and the two standalone T
.
$endgroup$
PHP, 180 178 bytes
foreach([hole,log,bump,frog,wart,hair,fly,flea,smile]as$w)echo$a=T.($b="here's a ").($s="$w ".io[++$i>2]."n the $s").$c="bottom of the sea
",$a,T,$b.=hole,", t$b
T$b in the $c
";
Run with -nr
or try it online.
Yields warnings in PHP 7.2; to fix, put quotes around
the array elements, io
, hole
and the two standalone T
.
edited Jan 31 at 16:56
answered Jan 31 at 14:00
TitusTitus
13.4k11240
13.4k11240
add a comment |
add a comment |
$begingroup$
Batch, 267 bytes
@echo off
set r=i
set t= There's a hole
set s=bottom of the sea
for %%w in (hole log bump frog wart hair fly flea smile)do call:c %%w
exit/b
:c
set s=%1 %r%n the %s%
echo%t:~,11%%s%
echo%t:~,11%%s%
echo%t%,%t:T=t%
echo%t%%s:~-25%
echo(
if %1==log set r=o
t
contains a string repeated in the chorus, s
contains most of the verse line, while r
chooses between in the
and on the
. In the verses, only the first 11 characters of t
is needed, while in the first chorus line the second copy of t
has its T
lowercased and the second chorus line reuses the last 25 characters of s
.
$endgroup$
add a comment |
$begingroup$
Batch, 267 bytes
@echo off
set r=i
set t= There's a hole
set s=bottom of the sea
for %%w in (hole log bump frog wart hair fly flea smile)do call:c %%w
exit/b
:c
set s=%1 %r%n the %s%
echo%t:~,11%%s%
echo%t:~,11%%s%
echo%t%,%t:T=t%
echo%t%%s:~-25%
echo(
if %1==log set r=o
t
contains a string repeated in the chorus, s
contains most of the verse line, while r
chooses between in the
and on the
. In the verses, only the first 11 characters of t
is needed, while in the first chorus line the second copy of t
has its T
lowercased and the second chorus line reuses the last 25 characters of s
.
$endgroup$
add a comment |
$begingroup$
Batch, 267 bytes
@echo off
set r=i
set t= There's a hole
set s=bottom of the sea
for %%w in (hole log bump frog wart hair fly flea smile)do call:c %%w
exit/b
:c
set s=%1 %r%n the %s%
echo%t:~,11%%s%
echo%t:~,11%%s%
echo%t%,%t:T=t%
echo%t%%s:~-25%
echo(
if %1==log set r=o
t
contains a string repeated in the chorus, s
contains most of the verse line, while r
chooses between in the
and on the
. In the verses, only the first 11 characters of t
is needed, while in the first chorus line the second copy of t
has its T
lowercased and the second chorus line reuses the last 25 characters of s
.
$endgroup$
Batch, 267 bytes
@echo off
set r=i
set t= There's a hole
set s=bottom of the sea
for %%w in (hole log bump frog wart hair fly flea smile)do call:c %%w
exit/b
:c
set s=%1 %r%n the %s%
echo%t:~,11%%s%
echo%t:~,11%%s%
echo%t%,%t:T=t%
echo%t%%s:~-25%
echo(
if %1==log set r=o
t
contains a string repeated in the chorus, s
contains most of the verse line, while r
chooses between in the
and on the
. In the verses, only the first 11 characters of t
is needed, while in the first chorus line the second copy of t
has its T
lowercased and the second chorus line reuses the last 25 characters of s
.
answered Feb 1 at 0:32
NeilNeil
82.5k745179
82.5k745179
add a comment |
add a comment |
$begingroup$
Ruby, 173 170 bytes
a="T#{["here's a hole"]*3*"%s"%[", t","
T"]+c=" in the "}bottom of the sea
"
b=a[31,39]
%w{log bump frog wart hair fly flea smile x}.map{|i|puts b,b,a;b[9]+=i+c;c[1]=?o}
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 173 170 bytes
a="T#{["here's a hole"]*3*"%s"%[", t","
T"]+c=" in the "}bottom of the sea
"
b=a[31,39]
%w{log bump frog wart hair fly flea smile x}.map{|i|puts b,b,a;b[9]+=i+c;c[1]=?o}
Try it online!
$endgroup$
add a comment |
$begingroup$
Ruby, 173 170 bytes
a="T#{["here's a hole"]*3*"%s"%[", t","
T"]+c=" in the "}bottom of the sea
"
b=a[31,39]
%w{log bump frog wart hair fly flea smile x}.map{|i|puts b,b,a;b[9]+=i+c;c[1]=?o}
Try it online!
$endgroup$
Ruby, 173 170 bytes
a="T#{["here's a hole"]*3*"%s"%[", t","
T"]+c=" in the "}bottom of the sea
"
b=a[31,39]
%w{log bump frog wart hair fly flea smile x}.map{|i|puts b,b,a;b[9]+=i+c;c[1]=?o}
Try it online!
edited Feb 1 at 11:11
answered Jan 31 at 7:52
Level River StLevel River St
20.5k32681
20.5k32681
add a comment |
add a comment |
$begingroup$
Haskell, 243 215 bytes
Reduced to 215 bytes with great help from nimi
c[[l n,l n,'T'#h++", "++'t'#h,l 8,""]|n<-[8,7..0]]
t#u=t:"here's a "++u
h="hole"
c=concat
l n='T'#c(drop n$map(++" on the ")(words"smile flea fly hair wart frog bump")++["log in the ",h," in the bottom of the sea"])
Try it online!
(Old 243 byte version is here).
A quite straightforward solution.
-- main function producing a list of lines
v = concat [[
l n,
l n, -- second line of each verse equals to its first line
'T' # h ++ ", " ++ 't' # h,
l 8, -- last line of each verse is the same in all verses
""
] | n <- [8,7..0]]
-- a small helper to construct similar strings
t # u = t : "here's a " ++ u
h = "hole"
-- construct a first line of n-th verse (with n = 8 is the first and n = 0 is the last one)
-- Every such line begins with a constant prefix followed by expanding list of nested entities
l n = 'T' # concat (
drop n $
map (++ " on the ") (words "smile flea fly hair wart frog bump")
++ ["log in the ", h, " in the bottom of the sea"]
)
$endgroup$
1
$begingroup$
Some tips: a) you uses
only once, so you can inline it. b) you always prepend and append something tot
, so you can make it a (infix) function:t#u=t:"here's a "++u
. c) constructing the big list in functionl
withmap(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from8
down to0
(single digit numbers!) e) now inliningi
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop thev=
.
$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
1
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use>>=
(concatMap) from the list monad and inlineconcat
in functionl
. Try it online!
$endgroup$
– nimi
Feb 1 at 17:14
add a comment |
$begingroup$
Haskell, 243 215 bytes
Reduced to 215 bytes with great help from nimi
c[[l n,l n,'T'#h++", "++'t'#h,l 8,""]|n<-[8,7..0]]
t#u=t:"here's a "++u
h="hole"
c=concat
l n='T'#c(drop n$map(++" on the ")(words"smile flea fly hair wart frog bump")++["log in the ",h," in the bottom of the sea"])
Try it online!
(Old 243 byte version is here).
A quite straightforward solution.
-- main function producing a list of lines
v = concat [[
l n,
l n, -- second line of each verse equals to its first line
'T' # h ++ ", " ++ 't' # h,
l 8, -- last line of each verse is the same in all verses
""
] | n <- [8,7..0]]
-- a small helper to construct similar strings
t # u = t : "here's a " ++ u
h = "hole"
-- construct a first line of n-th verse (with n = 8 is the first and n = 0 is the last one)
-- Every such line begins with a constant prefix followed by expanding list of nested entities
l n = 'T' # concat (
drop n $
map (++ " on the ") (words "smile flea fly hair wart frog bump")
++ ["log in the ", h, " in the bottom of the sea"]
)
$endgroup$
1
$begingroup$
Some tips: a) you uses
only once, so you can inline it. b) you always prepend and append something tot
, so you can make it a (infix) function:t#u=t:"here's a "++u
. c) constructing the big list in functionl
withmap(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from8
down to0
(single digit numbers!) e) now inliningi
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop thev=
.
$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
1
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use>>=
(concatMap) from the list monad and inlineconcat
in functionl
. Try it online!
$endgroup$
– nimi
Feb 1 at 17:14
add a comment |
$begingroup$
Haskell, 243 215 bytes
Reduced to 215 bytes with great help from nimi
c[[l n,l n,'T'#h++", "++'t'#h,l 8,""]|n<-[8,7..0]]
t#u=t:"here's a "++u
h="hole"
c=concat
l n='T'#c(drop n$map(++" on the ")(words"smile flea fly hair wart frog bump")++["log in the ",h," in the bottom of the sea"])
Try it online!
(Old 243 byte version is here).
A quite straightforward solution.
-- main function producing a list of lines
v = concat [[
l n,
l n, -- second line of each verse equals to its first line
'T' # h ++ ", " ++ 't' # h,
l 8, -- last line of each verse is the same in all verses
""
] | n <- [8,7..0]]
-- a small helper to construct similar strings
t # u = t : "here's a " ++ u
h = "hole"
-- construct a first line of n-th verse (with n = 8 is the first and n = 0 is the last one)
-- Every such line begins with a constant prefix followed by expanding list of nested entities
l n = 'T' # concat (
drop n $
map (++ " on the ") (words "smile flea fly hair wart frog bump")
++ ["log in the ", h, " in the bottom of the sea"]
)
$endgroup$
Haskell, 243 215 bytes
Reduced to 215 bytes with great help from nimi
c[[l n,l n,'T'#h++", "++'t'#h,l 8,""]|n<-[8,7..0]]
t#u=t:"here's a "++u
h="hole"
c=concat
l n='T'#c(drop n$map(++" on the ")(words"smile flea fly hair wart frog bump")++["log in the ",h," in the bottom of the sea"])
Try it online!
(Old 243 byte version is here).
A quite straightforward solution.
-- main function producing a list of lines
v = concat [[
l n,
l n, -- second line of each verse equals to its first line
'T' # h ++ ", " ++ 't' # h,
l 8, -- last line of each verse is the same in all verses
""
] | n <- [8,7..0]]
-- a small helper to construct similar strings
t # u = t : "here's a " ++ u
h = "hole"
-- construct a first line of n-th verse (with n = 8 is the first and n = 0 is the last one)
-- Every such line begins with a constant prefix followed by expanding list of nested entities
l n = 'T' # concat (
drop n $
map (++ " on the ") (words "smile flea fly hair wart frog bump")
++ ["log in the ", h, " in the bottom of the sea"]
)
edited Feb 1 at 11:50
answered Jan 31 at 10:02
Max YekhlakovMax Yekhlakov
4717
4717
1
$begingroup$
Some tips: a) you uses
only once, so you can inline it. b) you always prepend and append something tot
, so you can make it a (infix) function:t#u=t:"here's a "++u
. c) constructing the big list in functionl
withmap(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from8
down to0
(single digit numbers!) e) now inliningi
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop thev=
.
$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
1
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use>>=
(concatMap) from the list monad and inlineconcat
in functionl
. Try it online!
$endgroup$
– nimi
Feb 1 at 17:14
add a comment |
1
$begingroup$
Some tips: a) you uses
only once, so you can inline it. b) you always prepend and append something tot
, so you can make it a (infix) function:t#u=t:"here's a "++u
. c) constructing the big list in functionl
withmap(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from8
down to0
(single digit numbers!) e) now inliningi
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop thev=
.
$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
1
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use>>=
(concatMap) from the list monad and inlineconcat
in functionl
. Try it online!
$endgroup$
– nimi
Feb 1 at 17:14
1
1
$begingroup$
Some tips: a) you use
s
only once, so you can inline it. b) you always prepend and append something to t
, so you can make it a (infix) function: t#u=t:"here's a "++u
. c) constructing the big list in function l
with map(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from 8
down to 0
(single digit numbers!) e) now inlining i
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop the v=
.$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
Some tips: a) you use
s
only once, so you can inline it. b) you always prepend and append something to t
, so you can make it a (infix) function: t#u=t:"here's a "++u
. c) constructing the big list in function l
with map(++" on the ")(words"smile flea ..."
is shorter. Also: move everything appended to that list into the list itself. d) the list of numbers to drop now runs from 8
down to 0
(single digit numbers!) e) now inlining i
also save some bytes. f) no need to name your main function. According to our meta, Haskell values are considered proper functions, so drop the v=
.$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
$begingroup$
... All in all 215 bytes Try it online!
$endgroup$
– nimi
Jan 31 at 19:04
1
1
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use
>>=
(concatMap) from the list monad and inline concat
in function l
. Try it online!$endgroup$
– nimi
Feb 1 at 17:14
$begingroup$
Another 3 bytes to save: instead of the list comprehension you can use
>>=
(concatMap) from the list monad and inline concat
in function l
. Try it online!$endgroup$
– nimi
Feb 1 at 17:14
add a comment |
$begingroup$
JavaScript (Babel Node), 239 bytes
-7 bytes from @Oliver *.*
(x=0,r='hole0log0bump0frog0wart0hair0fly0flea0smile'.split`0`).map(a=>(t=(i="There's a ")+a+r.slice(0,x++).reverse().map((h,_)=>` ${"io"[_<x-2|0]}n the ${h}`).join``+(o=` in the bottom of the sea
`))+t+(`${k=i+"hole"}, ${k}
`)+k+o).join`
`
Try it online!
$endgroup$
1
$begingroup$
Te secondT
on the 3rd line of each verse should be lowercase.
$endgroup$
– Shaggy
Jan 31 at 14:16
add a comment |
$begingroup$
JavaScript (Babel Node), 239 bytes
-7 bytes from @Oliver *.*
(x=0,r='hole0log0bump0frog0wart0hair0fly0flea0smile'.split`0`).map(a=>(t=(i="There's a ")+a+r.slice(0,x++).reverse().map((h,_)=>` ${"io"[_<x-2|0]}n the ${h}`).join``+(o=` in the bottom of the sea
`))+t+(`${k=i+"hole"}, ${k}
`)+k+o).join`
`
Try it online!
$endgroup$
1
$begingroup$
Te secondT
on the 3rd line of each verse should be lowercase.
$endgroup$
– Shaggy
Jan 31 at 14:16
add a comment |
$begingroup$
JavaScript (Babel Node), 239 bytes
-7 bytes from @Oliver *.*
(x=0,r='hole0log0bump0frog0wart0hair0fly0flea0smile'.split`0`).map(a=>(t=(i="There's a ")+a+r.slice(0,x++).reverse().map((h,_)=>` ${"io"[_<x-2|0]}n the ${h}`).join``+(o=` in the bottom of the sea
`))+t+(`${k=i+"hole"}, ${k}
`)+k+o).join`
`
Try it online!
$endgroup$
JavaScript (Babel Node), 239 bytes
-7 bytes from @Oliver *.*
(x=0,r='hole0log0bump0frog0wart0hair0fly0flea0smile'.split`0`).map(a=>(t=(i="There's a ")+a+r.slice(0,x++).reverse().map((h,_)=>` ${"io"[_<x-2|0]}n the ${h}`).join``+(o=` in the bottom of the sea
`))+t+(`${k=i+"hole"}, ${k}
`)+k+o).join`
`
Try it online!
edited Jan 30 at 18:34
answered Jan 30 at 15:05
Luis felipe De jesus MunozLuis felipe De jesus Munoz
5,70821671
5,70821671
1
$begingroup$
Te secondT
on the 3rd line of each verse should be lowercase.
$endgroup$
– Shaggy
Jan 31 at 14:16
add a comment |
1
$begingroup$
Te secondT
on the 3rd line of each verse should be lowercase.
$endgroup$
– Shaggy
Jan 31 at 14:16
1
1
$begingroup$
Te second
T
on the 3rd line of each verse should be lowercase.$endgroup$
– Shaggy
Jan 31 at 14:16
$begingroup$
Te second
T
on the 3rd line of each verse should be lowercase.$endgroup$
– Shaggy
Jan 31 at 14:16
add a comment |
$begingroup$
Python 3, 213 206 198 193 bytes
k='n the ';o=e='bottom of the sean';b="There's a ";h='hole'
for j in[h]+'log bump frog wart hair fly smile'.split():o=j+' '+'io'['g'in o]+k+o;print(b+o+b+o+b+h+', t'+b[1:]+h+'n'+b+h+' i'+k+e)
Try it online!
-15 bytes thanks to @Sara
-5 bytes thanks to @ASCII-only
Probably a bit more golfable, but not much.
New contributor
$endgroup$
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression thato=e=
would make botho
ande
refer to the same object. I also thought split would be longer.
$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@ArtemisFowlo
ande
do refer to the same object... it's just that strings are immutable in Python so things like+=
will create a new copy instead of mutating the existing one
$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
|
show 2 more comments
$begingroup$
Python 3, 213 206 198 193 bytes
k='n the ';o=e='bottom of the sean';b="There's a ";h='hole'
for j in[h]+'log bump frog wart hair fly smile'.split():o=j+' '+'io'['g'in o]+k+o;print(b+o+b+o+b+h+', t'+b[1:]+h+'n'+b+h+' i'+k+e)
Try it online!
-15 bytes thanks to @Sara
-5 bytes thanks to @ASCII-only
Probably a bit more golfable, but not much.
New contributor
$endgroup$
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression thato=e=
would make botho
ande
refer to the same object. I also thought split would be longer.
$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@ArtemisFowlo
ande
do refer to the same object... it's just that strings are immutable in Python so things like+=
will create a new copy instead of mutating the existing one
$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
|
show 2 more comments
$begingroup$
Python 3, 213 206 198 193 bytes
k='n the ';o=e='bottom of the sean';b="There's a ";h='hole'
for j in[h]+'log bump frog wart hair fly smile'.split():o=j+' '+'io'['g'in o]+k+o;print(b+o+b+o+b+h+', t'+b[1:]+h+'n'+b+h+' i'+k+e)
Try it online!
-15 bytes thanks to @Sara
-5 bytes thanks to @ASCII-only
Probably a bit more golfable, but not much.
New contributor
$endgroup$
Python 3, 213 206 198 193 bytes
k='n the ';o=e='bottom of the sean';b="There's a ";h='hole'
for j in[h]+'log bump frog wart hair fly smile'.split():o=j+' '+'io'['g'in o]+k+o;print(b+o+b+o+b+h+', t'+b[1:]+h+'n'+b+h+' i'+k+e)
Try it online!
-15 bytes thanks to @Sara
-5 bytes thanks to @ASCII-only
Probably a bit more golfable, but not much.
New contributor
edited Mar 31 at 22:20
New contributor
answered Mar 30 at 3:16
Artemis FowlArtemis Fowl
1867
1867
New contributor
New contributor
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression thato=e=
would make botho
ande
refer to the same object. I also thought split would be longer.
$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@ArtemisFowlo
ande
do refer to the same object... it's just that strings are immutable in Python so things like+=
will create a new copy instead of mutating the existing one
$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
|
show 2 more comments
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression thato=e=
would make botho
ande
refer to the same object. I also thought split would be longer.
$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@ArtemisFowlo
ande
do refer to the same object... it's just that strings are immutable in Python so things like+=
will create a new copy instead of mutating the existing one
$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
198 bytes
$endgroup$
– Sara J
Mar 30 at 9:06
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression that
o=e=
would make both o
and e
refer to the same object. I also thought split would be longer.$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@SaraJ Thanks. I was under the (clearly mistaken) impression that
o=e=
would make both o
and e
refer to the same object. I also thought split would be longer.$endgroup$
– Artemis Fowl
Mar 30 at 9:14
$begingroup$
@ArtemisFowl
o
and e
do refer to the same object... it's just that strings are immutable in Python so things like +=
will create a new copy instead of mutating the existing one$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
@ArtemisFowl
o
and e
do refer to the same object... it's just that strings are immutable in Python so things like +=
will create a new copy instead of mutating the existing one$endgroup$
– ASCII-only
Mar 31 at 11:01
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
193
$endgroup$
– ASCII-only
Mar 31 at 11:05
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
$begingroup$
@ASCII-only I know, but I thought that python somehow made sure that they continued to refer to the same object.
$endgroup$
– Artemis Fowl
Mar 31 at 21:56
|
show 2 more comments
$begingroup$
Clean, 267 bytes
import StdEnv,Text,Data.List
t="here's a "
h="hole"
b=" in the bottom of the sea"
f=foldr((+)os#p="T"+t+join" on the "(reverse s)+" in the "+h+b
=join"n"[p,p,"T"+t+h+", t"+t+h+"nT"+t+h+b+"nn"])""(tl(inits["log","bump","frog","wart","hair","fly","flea","smile"]))
Try it online!
$endgroup$
add a comment |
$begingroup$
Clean, 267 bytes
import StdEnv,Text,Data.List
t="here's a "
h="hole"
b=" in the bottom of the sea"
f=foldr((+)os#p="T"+t+join" on the "(reverse s)+" in the "+h+b
=join"n"[p,p,"T"+t+h+", t"+t+h+"nT"+t+h+b+"nn"])""(tl(inits["log","bump","frog","wart","hair","fly","flea","smile"]))
Try it online!
$endgroup$
add a comment |
$begingroup$
Clean, 267 bytes
import StdEnv,Text,Data.List
t="here's a "
h="hole"
b=" in the bottom of the sea"
f=foldr((+)os#p="T"+t+join" on the "(reverse s)+" in the "+h+b
=join"n"[p,p,"T"+t+h+", t"+t+h+"nT"+t+h+b+"nn"])""(tl(inits["log","bump","frog","wart","hair","fly","flea","smile"]))
Try it online!
$endgroup$
Clean, 267 bytes
import StdEnv,Text,Data.List
t="here's a "
h="hole"
b=" in the bottom of the sea"
f=foldr((+)os#p="T"+t+join" on the "(reverse s)+" in the "+h+b
=join"n"[p,p,"T"+t+h+", t"+t+h+"nT"+t+h+b+"nn"])""(tl(inits["log","bump","frog","wart","hair","fly","flea","smile"]))
Try it online!
edited Jan 30 at 23:02
answered Jan 30 at 22:43
ΟurousΟurous
7,41611136
7,41611136
add a comment |
add a comment |
$begingroup$
cQuents, 238 219 bytes
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
:"here's a ","hole in the bottom of the sea"," on the"
Try it online!
This challenge made me finally implement lists and strings in my language. This language is built for integer sequences, so it did pretty well!
Explanation
:"here's a ","hole in the bottom of the sea"," on the"
helper line: c1), c2), and c3) access the three terms in this list
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
helper line: yields a list containing the first n terms in it, accessed with bx)
for example, the first three terms are:
"","log in the","bump"~c3
so b3) would yield ["","log in the","bump on the"] (~ is concatenation and c3 is " on the")
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
|@
join sequence on literal newline
#36:: output first 36 terms in sequence joined together
following are the 4 terms in the sequence, which will cycle through 9 times (for a total of 36 terms)
"T"~c1)~jrbk));@ )~c2, first term
"T"~c1)~ "T" concat "here's a " concat
jrbk));@ ) the first k terms of b, reversed, and joined on " "
~c2, concat "hole in the bottom of the sea"
Z, second term - same as previous
"T"~c1)~"hole, t"~c1)~"hole", third term
"T"~c1)~ "T" concat "here's a " concat
"hole, t"~c1)~"hole", "hole, t" concat "here's a " concat "hole"
"T"~c1)~c2)~@
fourth term - "T" concat "here's a " concat "hole on the bottom of the sea" concat newline
$endgroup$
add a comment |
$begingroup$
cQuents, 238 219 bytes
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
:"here's a ","hole in the bottom of the sea"," on the"
Try it online!
This challenge made me finally implement lists and strings in my language. This language is built for integer sequences, so it did pretty well!
Explanation
:"here's a ","hole in the bottom of the sea"," on the"
helper line: c1), c2), and c3) access the three terms in this list
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
helper line: yields a list containing the first n terms in it, accessed with bx)
for example, the first three terms are:
"","log in the","bump"~c3
so b3) would yield ["","log in the","bump on the"] (~ is concatenation and c3 is " on the")
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
|@
join sequence on literal newline
#36:: output first 36 terms in sequence joined together
following are the 4 terms in the sequence, which will cycle through 9 times (for a total of 36 terms)
"T"~c1)~jrbk));@ )~c2, first term
"T"~c1)~ "T" concat "here's a " concat
jrbk));@ ) the first k terms of b, reversed, and joined on " "
~c2, concat "hole in the bottom of the sea"
Z, second term - same as previous
"T"~c1)~"hole, t"~c1)~"hole", third term
"T"~c1)~ "T" concat "here's a " concat
"hole, t"~c1)~"hole", "hole, t" concat "here's a " concat "hole"
"T"~c1)~c2)~@
fourth term - "T" concat "here's a " concat "hole on the bottom of the sea" concat newline
$endgroup$
add a comment |
$begingroup$
cQuents, 238 219 bytes
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
:"here's a ","hole in the bottom of the sea"," on the"
Try it online!
This challenge made me finally implement lists and strings in my language. This language is built for integer sequences, so it did pretty well!
Explanation
:"here's a ","hole in the bottom of the sea"," on the"
helper line: c1), c2), and c3) access the three terms in this list
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
helper line: yields a list containing the first n terms in it, accessed with bx)
for example, the first three terms are:
"","log in the","bump"~c3
so b3) would yield ["","log in the","bump on the"] (~ is concatenation and c3 is " on the")
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
|@
join sequence on literal newline
#36:: output first 36 terms in sequence joined together
following are the 4 terms in the sequence, which will cycle through 9 times (for a total of 36 terms)
"T"~c1)~jrbk));@ )~c2, first term
"T"~c1)~ "T" concat "here's a " concat
jrbk));@ ) the first k terms of b, reversed, and joined on " "
~c2, concat "hole in the bottom of the sea"
Z, second term - same as previous
"T"~c1)~"hole, t"~c1)~"hole", third term
"T"~c1)~ "T" concat "here's a " concat
"hole, t"~c1)~"hole", "hole, t" concat "here's a " concat "hole"
"T"~c1)~c2)~@
fourth term - "T" concat "here's a " concat "hole on the bottom of the sea" concat newline
$endgroup$
cQuents, 238 219 bytes
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
:"here's a ","hole in the bottom of the sea"," on the"
Try it online!
This challenge made me finally implement lists and strings in my language. This language is built for integer sequences, so it did pretty well!
Explanation
:"here's a ","hole in the bottom of the sea"," on the"
helper line: c1), c2), and c3) access the three terms in this list
::"","log in the","bump"~c3,"frog"~c3,"wart"~c3,"hair"~c3,"fly"~c3,"flea"~c3,"smile"~c3
helper line: yields a list containing the first n terms in it, accessed with bx)
for example, the first three terms are:
"","log in the","bump"~c3
so b3) would yield ["","log in the","bump on the"] (~ is concatenation and c3 is " on the")
|@
#36::"T"~c1)~jrbk));@ )~c2,Z,"T"~c1)~"hole, t"~c1)~"hole","T"~c1)~c2)~@
|@
join sequence on literal newline
#36:: output first 36 terms in sequence joined together
following are the 4 terms in the sequence, which will cycle through 9 times (for a total of 36 terms)
"T"~c1)~jrbk));@ )~c2, first term
"T"~c1)~ "T" concat "here's a " concat
jrbk));@ ) the first k terms of b, reversed, and joined on " "
~c2, concat "hole in the bottom of the sea"
Z, second term - same as previous
"T"~c1)~"hole, t"~c1)~"hole", third term
"T"~c1)~ "T" concat "here's a " concat
"hole, t"~c1)~"hole", "hole, t" concat "here's a " concat "hole"
"T"~c1)~c2)~@
fourth term - "T" concat "here's a " concat "hole on the bottom of the sea" concat newline
edited Jan 31 at 1:58
answered Jan 31 at 1:32
StephenStephen
7,54723397
7,54723397
add a comment |
add a comment |
$begingroup$
Perl 5, 194 bytes
@ASCII-only shaved off 6 bytes with literal newlines and a l
trick I forgot about
$"=" on the ";say+($b=($e="There's a ").hole,$c=" in the bottom of the sea",$/)x2,$.="$b, l$b
$b$c
";say"$e@a[-$_..-1] in the hole$c
"x2,$.for 1..(@a=qw/smile flea fly hair wart frog bump log/)
Try it online!
$endgroup$
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen thel
before, but never had a reason to use it, so never thought of it.
$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
|
show 3 more comments
$begingroup$
Perl 5, 194 bytes
@ASCII-only shaved off 6 bytes with literal newlines and a l
trick I forgot about
$"=" on the ";say+($b=($e="There's a ").hole,$c=" in the bottom of the sea",$/)x2,$.="$b, l$b
$b$c
";say"$e@a[-$_..-1] in the hole$c
"x2,$.for 1..(@a=qw/smile flea fly hair wart frog bump log/)
Try it online!
$endgroup$
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen thel
before, but never had a reason to use it, so never thought of it.
$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
|
show 3 more comments
$begingroup$
Perl 5, 194 bytes
@ASCII-only shaved off 6 bytes with literal newlines and a l
trick I forgot about
$"=" on the ";say+($b=($e="There's a ").hole,$c=" in the bottom of the sea",$/)x2,$.="$b, l$b
$b$c
";say"$e@a[-$_..-1] in the hole$c
"x2,$.for 1..(@a=qw/smile flea fly hair wart frog bump log/)
Try it online!
$endgroup$
Perl 5, 194 bytes
@ASCII-only shaved off 6 bytes with literal newlines and a l
trick I forgot about
$"=" on the ";say+($b=($e="There's a ").hole,$c=" in the bottom of the sea",$/)x2,$.="$b, l$b
$b$c
";say"$e@a[-$_..-1] in the hole$c
"x2,$.for 1..(@a=qw/smile flea fly hair wart frog bump log/)
Try it online!
edited Jan 31 at 23:58
answered Jan 31 at 2:43
XcaliXcali
5,455520
5,455520
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen thel
before, but never had a reason to use it, so never thought of it.
$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
|
show 3 more comments
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen thel
before, but never had a reason to use it, so never thought of it.
$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
194?
$endgroup$
– ASCII-only
Jan 31 at 8:25
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen the
l
before, but never had a reason to use it, so never thought of it.$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
Yup. Nice work. I should have remembered the newlines for certain. I've seen the
l
before, but never had a reason to use it, so never thought of it.$endgroup$
– Xcali
Jan 31 at 23:59
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
190?
$endgroup$
– ASCII-only
Feb 1 at 0:00
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
well this didn't work. neither did this
$endgroup$
– ASCII-only
Feb 1 at 0:17
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
$begingroup$
closer
$endgroup$
– ASCII-only
Feb 1 at 0:23
|
show 3 more comments
$begingroup$
Charcoal, 115 106 bytes
≔There's a holeθEE⁹⁺…θχ⪫⮌…⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x⁺²ιn the ⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Try it online! Link is to verbose version of code. Edit: Saved 9 bytes by copying my Batch code for the last line of the chorus. Explanation:
≔There's a holeθ
Save the string There's a hole
, which is used twice as-is, a third time in lower case, and also a fourth time but just the first 10 characters.
⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x
Split the string bottom of the seaxhole ixlog ixbump oxfrog oxwart oxhair oxfly oxflea oxsmile o
on x
s.
E⁹⁺…θχ⪫⮌…...⁺²ιn the
Loop over the 9 verses, taking the first i+2
elements of the array, reversing them, joining them with n the
, and prefixing There's a
to the result.
E...⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Expand each line into a verse by duplicating the line and constructing the chorus. Each line of the verse is then implicitly printed on each own line, and each verse is implicitly separated by a blank line.
$endgroup$
add a comment |
$begingroup$
Charcoal, 115 106 bytes
≔There's a holeθEE⁹⁺…θχ⪫⮌…⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x⁺²ιn the ⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Try it online! Link is to verbose version of code. Edit: Saved 9 bytes by copying my Batch code for the last line of the chorus. Explanation:
≔There's a holeθ
Save the string There's a hole
, which is used twice as-is, a third time in lower case, and also a fourth time but just the first 10 characters.
⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x
Split the string bottom of the seaxhole ixlog ixbump oxfrog oxwart oxhair oxfly oxflea oxsmile o
on x
s.
E⁹⁺…θχ⪫⮌…...⁺²ιn the
Loop over the 9 verses, taking the first i+2
elements of the array, reversing them, joining them with n the
, and prefixing There's a
to the result.
E...⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Expand each line into a verse by duplicating the line and constructing the chorus. Each line of the verse is then implicitly printed on each own line, and each verse is implicitly separated by a blank line.
$endgroup$
add a comment |
$begingroup$
Charcoal, 115 106 bytes
≔There's a holeθEE⁹⁺…θχ⪫⮌…⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x⁺²ιn the ⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Try it online! Link is to verbose version of code. Edit: Saved 9 bytes by copying my Batch code for the last line of the chorus. Explanation:
≔There's a holeθ
Save the string There's a hole
, which is used twice as-is, a third time in lower case, and also a fourth time but just the first 10 characters.
⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x
Split the string bottom of the seaxhole ixlog ixbump oxfrog oxwart oxhair oxfly oxflea oxsmile o
on x
s.
E⁹⁺…θχ⪫⮌…...⁺²ιn the
Loop over the 9 verses, taking the first i+2
elements of the array, reversing them, joining them with n the
, and prefixing There's a
to the result.
E...⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Expand each line into a verse by duplicating the line and constructing the chorus. Each line of the verse is then implicitly printed on each own line, and each verse is implicitly separated by a blank line.
$endgroup$
Charcoal, 115 106 bytes
≔There's a holeθEE⁹⁺…θχ⪫⮌…⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x⁺²ιn the ⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Try it online! Link is to verbose version of code. Edit: Saved 9 bytes by copying my Batch code for the last line of the chorus. Explanation:
≔There's a holeθ
Save the string There's a hole
, which is used twice as-is, a third time in lower case, and also a fourth time but just the first 10 characters.
⪪”↶±∧⟲!↶⁼,(_⎇RB↧ω⪪zθⅉQθ`✳&⬤⸿◧σ⁻y▷»ΣK▶↙⁻υX`SξQ6 /ι⁹Wq”x
Split the string bottom of the seaxhole ixlog ixbump oxfrog oxwart oxhair oxfly oxflea oxsmile o
on x
s.
E⁹⁺…θχ⪫⮌…...⁺²ιn the
Loop over the 9 verses, taking the first i+2
elements of the array, reversing them, joining them with n the
, and prefixing There's a
to the result.
E...⟦ιι⁺⁺θ, ↧θ⁺θ✂ι±²⁵
Expand each line into a verse by duplicating the line and constructing the chorus. Each line of the verse is then implicitly printed on each own line, and each verse is implicitly separated by a blank line.
edited Feb 1 at 0:40
answered Jan 30 at 22:54
NeilNeil
82.5k745179
82.5k745179
add a comment |
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 222 bytes
string b="There's a ",d="hole in the bottom of the sean",e,f;foreach(var s in" log bump frog wart hair fly flea smile".Split())Write((e=b+(f=s!=""?s+(f!=""?" o":" i")+"n the "+f:s)+d)+e+b+$@"hole, there's a hole
{b+d}
");
Try it online!
-5 bytes thanks to @ASCIIOnly!
I have a small child and can assure you this song is equal parts catchy and annoying.
$endgroup$
1
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
.Any()
->!=""
?
$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
and you don't need the space afterin
in theforeach
>_>
$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 222 bytes
string b="There's a ",d="hole in the bottom of the sean",e,f;foreach(var s in" log bump frog wart hair fly flea smile".Split())Write((e=b+(f=s!=""?s+(f!=""?" o":" i")+"n the "+f:s)+d)+e+b+$@"hole, there's a hole
{b+d}
");
Try it online!
-5 bytes thanks to @ASCIIOnly!
I have a small child and can assure you this song is equal parts catchy and annoying.
$endgroup$
1
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
.Any()
->!=""
?
$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
and you don't need the space afterin
in theforeach
>_>
$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
add a comment |
$begingroup$
C# (Visual C# Interactive Compiler), 222 bytes
string b="There's a ",d="hole in the bottom of the sean",e,f;foreach(var s in" log bump frog wart hair fly flea smile".Split())Write((e=b+(f=s!=""?s+(f!=""?" o":" i")+"n the "+f:s)+d)+e+b+$@"hole, there's a hole
{b+d}
");
Try it online!
-5 bytes thanks to @ASCIIOnly!
I have a small child and can assure you this song is equal parts catchy and annoying.
$endgroup$
C# (Visual C# Interactive Compiler), 222 bytes
string b="There's a ",d="hole in the bottom of the sean",e,f;foreach(var s in" log bump frog wart hair fly flea smile".Split())Write((e=b+(f=s!=""?s+(f!=""?" o":" i")+"n the "+f:s)+d)+e+b+$@"hole, there's a hole
{b+d}
");
Try it online!
-5 bytes thanks to @ASCIIOnly!
I have a small child and can assure you this song is equal parts catchy and annoying.
edited Feb 1 at 5:12
answered Jan 31 at 7:01
danadana
1,921167
1,921167
1
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
.Any()
->!=""
?
$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
and you don't need the space afterin
in theforeach
>_>
$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
add a comment |
1
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
.Any()
->!=""
?
$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
and you don't need the space afterin
in theforeach
>_>
$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
1
1
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
I'm sorry to have reminded you that it exists :o)
$endgroup$
– Sok
Jan 31 at 8:21
$begingroup$
.Any()
-> !=""
?$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
.Any()
-> !=""
?$endgroup$
– ASCII-only
Feb 1 at 1:42
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
also 223
$endgroup$
– ASCII-only
Feb 1 at 1:44
$begingroup$
and you don't need the space after
in
in the foreach
>_>$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
and you don't need the space after
in
in the foreach
>_>$endgroup$
– ASCII-only
Feb 1 at 1:50
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
$begingroup$
@ASCIIOnly - Thanks for the tips :)
$endgroup$
– dana
Feb 1 at 4:34
add a comment |
$begingroup$
V, 184 170 bytes
4iThere's a hole in the bottom of the sea
kky5w5eá,lpD5brtHj4yyGp4w8ion the 2briilog 3bibump 3bifrog 3biwart 3bihair 3bifly 3biflea 3bismile 7ñ4yykp4wd3wñ8ñÄ5jñ
Try it online!
Explanation:
4iThere's a hole in the bottom of the sea<n><esc>
Insert "Theres' a hole in the bottom of the sea" 4 times.
kk
Move to the third line
y5w
copy "There's a hole"
5eá,
insert a comma after "There's a hole"
lp
paste after the comma
D
delete the rest of the line
5brt
lowercase the second T
Hj4yy
copy 4 lines from the second line
Gp
Paste everything after the first line
4w8ion the <esc>
(at the end of the first verse) move to first "hole" in second verse and insert "on the " 8 times
2briilog <esc>
move backwards to the last "on", replace the o with an i and then insert "log "
3bibump <esc>3bifrog <esc>3biwart <esc>3bihair <esc>3bifly <esc>3biflea <esc>3bismile <esc>
Move backwards through the line, inserting the appropriate words between each "on the"
7ñ4yykp4wd3wñ
execute4yykp4wd3w
7 times
4yykp
duplicate the verse before this one
4wd3w
move to the first word after "There's a hole" and delete 3 words
8ñÄ5jñ
duplicate the first line of each verse after the first (there are 8 of these to do)
$endgroup$
add a comment |
$begingroup$
V, 184 170 bytes
4iThere's a hole in the bottom of the sea
kky5w5eá,lpD5brtHj4yyGp4w8ion the 2briilog 3bibump 3bifrog 3biwart 3bihair 3bifly 3biflea 3bismile 7ñ4yykp4wd3wñ8ñÄ5jñ
Try it online!
Explanation:
4iThere's a hole in the bottom of the sea<n><esc>
Insert "Theres' a hole in the bottom of the sea" 4 times.
kk
Move to the third line
y5w
copy "There's a hole"
5eá,
insert a comma after "There's a hole"
lp
paste after the comma
D
delete the rest of the line
5brt
lowercase the second T
Hj4yy
copy 4 lines from the second line
Gp
Paste everything after the first line
4w8ion the <esc>
(at the end of the first verse) move to first "hole" in second verse and insert "on the " 8 times
2briilog <esc>
move backwards to the last "on", replace the o with an i and then insert "log "
3bibump <esc>3bifrog <esc>3biwart <esc>3bihair <esc>3bifly <esc>3biflea <esc>3bismile <esc>
Move backwards through the line, inserting the appropriate words between each "on the"
7ñ4yykp4wd3wñ
execute4yykp4wd3w
7 times
4yykp
duplicate the verse before this one
4wd3w
move to the first word after "There's a hole" and delete 3 words
8ñÄ5jñ
duplicate the first line of each verse after the first (there are 8 of these to do)
$endgroup$
add a comment |
$begingroup$
V, 184 170 bytes
4iThere's a hole in the bottom of the sea
kky5w5eá,lpD5brtHj4yyGp4w8ion the 2briilog 3bibump 3bifrog 3biwart 3bihair 3bifly 3biflea 3bismile 7ñ4yykp4wd3wñ8ñÄ5jñ
Try it online!
Explanation:
4iThere's a hole in the bottom of the sea<n><esc>
Insert "Theres' a hole in the bottom of the sea" 4 times.
kk
Move to the third line
y5w
copy "There's a hole"
5eá,
insert a comma after "There's a hole"
lp
paste after the comma
D
delete the rest of the line
5brt
lowercase the second T
Hj4yy
copy 4 lines from the second line
Gp
Paste everything after the first line
4w8ion the <esc>
(at the end of the first verse) move to first "hole" in second verse and insert "on the " 8 times
2briilog <esc>
move backwards to the last "on", replace the o with an i and then insert "log "
3bibump <esc>3bifrog <esc>3biwart <esc>3bihair <esc>3bifly <esc>3biflea <esc>3bismile <esc>
Move backwards through the line, inserting the appropriate words between each "on the"
7ñ4yykp4wd3wñ
execute4yykp4wd3w
7 times
4yykp
duplicate the verse before this one
4wd3w
move to the first word after "There's a hole" and delete 3 words
8ñÄ5jñ
duplicate the first line of each verse after the first (there are 8 of these to do)
$endgroup$
V, 184 170 bytes
4iThere's a hole in the bottom of the sea
kky5w5eá,lpD5brtHj4yyGp4w8ion the 2briilog 3bibump 3bifrog 3biwart 3bihair 3bifly 3biflea 3bismile 7ñ4yykp4wd3wñ8ñÄ5jñ
Try it online!
Explanation:
4iThere's a hole in the bottom of the sea<n><esc>
Insert "Theres' a hole in the bottom of the sea" 4 times.
kk
Move to the third line
y5w
copy "There's a hole"
5eá,
insert a comma after "There's a hole"
lp
paste after the comma
D
delete the rest of the line
5brt
lowercase the second T
Hj4yy
copy 4 lines from the second line
Gp
Paste everything after the first line
4w8ion the <esc>
(at the end of the first verse) move to first "hole" in second verse and insert "on the " 8 times
2briilog <esc>
move backwards to the last "on", replace the o with an i and then insert "log "
3bibump <esc>3bifrog <esc>3biwart <esc>3bihair <esc>3bifly <esc>3biflea <esc>3bismile <esc>
Move backwards through the line, inserting the appropriate words between each "on the"
7ñ4yykp4wd3wñ
execute4yykp4wd3w
7 times
4yykp
duplicate the verse before this one
4wd3w
move to the first word after "There's a hole" and delete 3 words
8ñÄ5jñ
duplicate the first line of each verse after the first (there are 8 of these to do)
edited Feb 2 at 0:29
answered Feb 2 at 0:01
BeefsterBeefster
2,3871141
2,3871141
add a comment |
add a comment |
$begingroup$
///, 216 bytes
/V/////U// VS/TCVR/iBVQUtheVPUoBVOUholeVN/RASVM/ASO, tCO
SA
VL/RMSVKUlog VJUbumpPKVIUfrogPJVHUwartPIVGUhairPHVFUflyPGVEUfleaPFVDUsmilePEVC/here's aVB/nQVA/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
Try it online!
This sort of task is the one and only thing that /// is reasonably good at. :D Hey, the result is shorter than C, C# or Java!
The output from this program ends in two trailing line breaks; hope that's not a deal-breaker.
Anyway, there's no real cleverness here. I simply identified repeated strings and defined one-character shortcuts for them, and repeated until I didn't see any more repeated strings. I did this in a more-or-less naive and greedy fashion. I did, however, intentionally define a shortcut for "smile on the flea on the ... sea", followed by "flea on the fly on the ... sea", and so forth, in order to form a chain of shortcuts. The result is that the whole sequence of new nouns is clearly visible in the code, and I find that pretty pleasing. :)
After V and U are replaced, we have the following more readable code:
/S/TC//R/iB//Q/ the//P/ oB//O/ hole//N/RAS//M/ASO, tCO
SA
//L/RMS//K/ log //J/ bumpPK//I/ frogPJ//H/ wartPI//G/ hairPH//F/ flyPG//E/ fleaPF//D/ smilePE//C/here's a//B/nQ//A/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
$endgroup$
add a comment |
$begingroup$
///, 216 bytes
/V/////U// VS/TCVR/iBVQUtheVPUoBVOUholeVN/RASVM/ASO, tCO
SA
VL/RMSVKUlog VJUbumpPKVIUfrogPJVHUwartPIVGUhairPHVFUflyPGVEUfleaPFVDUsmilePEVC/here's aVB/nQVA/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
Try it online!
This sort of task is the one and only thing that /// is reasonably good at. :D Hey, the result is shorter than C, C# or Java!
The output from this program ends in two trailing line breaks; hope that's not a deal-breaker.
Anyway, there's no real cleverness here. I simply identified repeated strings and defined one-character shortcuts for them, and repeated until I didn't see any more repeated strings. I did this in a more-or-less naive and greedy fashion. I did, however, intentionally define a shortcut for "smile on the flea on the ... sea", followed by "flea on the fly on the ... sea", and so forth, in order to form a chain of shortcuts. The result is that the whole sequence of new nouns is clearly visible in the code, and I find that pretty pleasing. :)
After V and U are replaced, we have the following more readable code:
/S/TC//R/iB//Q/ the//P/ oB//O/ hole//N/RAS//M/ASO, tCO
SA
//L/RMS//K/ log //J/ bumpPK//I/ frogPJ//H/ wartPI//G/ hairPH//F/ flyPG//E/ fleaPF//D/ smilePE//C/here's a//B/nQ//A/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
$endgroup$
add a comment |
$begingroup$
///, 216 bytes
/V/////U// VS/TCVR/iBVQUtheVPUoBVOUholeVN/RASVM/ASO, tCO
SA
VL/RMSVKUlog VJUbumpPKVIUfrogPJVHUwartPIVGUhairPHVFUflyPGVEUfleaPFVDUsmilePEVC/here's aVB/nQVA/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
Try it online!
This sort of task is the one and only thing that /// is reasonably good at. :D Hey, the result is shorter than C, C# or Java!
The output from this program ends in two trailing line breaks; hope that's not a deal-breaker.
Anyway, there's no real cleverness here. I simply identified repeated strings and defined one-character shortcuts for them, and repeated until I didn't see any more repeated strings. I did this in a more-or-less naive and greedy fashion. I did, however, intentionally define a shortcut for "smile on the flea on the ... sea", followed by "flea on the fly on the ... sea", and so forth, in order to form a chain of shortcuts. The result is that the whole sequence of new nouns is clearly visible in the code, and I find that pretty pleasing. :)
After V and U are replaced, we have the following more readable code:
/S/TC//R/iB//Q/ the//P/ oB//O/ hole//N/RAS//M/ASO, tCO
SA
//L/RMS//K/ log //J/ bumpPK//I/ frogPJ//H/ wartPI//G/ hairPH//F/ flyPG//E/ fleaPF//D/ smilePE//C/here's a//B/nQ//A/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
$endgroup$
///, 216 bytes
/V/////U// VS/TCVR/iBVQUtheVPUoBVOUholeVN/RASVM/ASO, tCO
SA
VL/RMSVKUlog VJUbumpPKVIUfrogPJVHUwartPIVGUhairPHVFUflyPGVEUfleaPFVDUsmilePEVC/here's aVB/nQVA/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
Try it online!
This sort of task is the one and only thing that /// is reasonably good at. :D Hey, the result is shorter than C, C# or Java!
The output from this program ends in two trailing line breaks; hope that's not a deal-breaker.
Anyway, there's no real cleverness here. I simply identified repeated strings and defined one-character shortcuts for them, and repeated until I didn't see any more repeated strings. I did this in a more-or-less naive and greedy fashion. I did, however, intentionally define a shortcut for "smile on the flea on the ... sea", followed by "flea on the fly on the ... sea", and so forth, in order to form a chain of shortcuts. The result is that the whole sequence of new nouns is clearly visible in the code, and I find that pretty pleasing. :)
After V and U are replaced, we have the following more readable code:
/S/TC//R/iB//Q/ the//P/ oB//O/ hole//N/RAS//M/ASO, tCO
SA
//L/RMS//K/ log //J/ bumpPK//I/ frogPJ//H/ wartPI//G/ hairPH//F/ flyPG//E/ fleaPF//D/ smilePE//C/here's a//B/nQ//A/O R bottom ofQ sea
/SASMSKNKLJNJLINILHNHLGNGLFNFLENELDNDRM
answered Feb 4 at 2:18
Tanner SwettTanner Swett
40135
40135
add a comment |
add a comment |
$begingroup$
Shell, 291 bytes
echo 'smile,flea,fly,hair,wart,frog,bump,log,hole'|awk -F, 'BEGIN{z="here'''s a ";a="T"z;c=a "hole";b=" in the bottom of the sea"}function f(n){printf a $n;for(j=n+1;j<=NF;j++){printf " on the " $j};print b;}{for(i=NF;i>=1;i--){printf (i<NF)?"n":"";f(i);f(i);print c", t" z "hole";f(NF)}}'
I'm sure it can be golfed further (definitions of vars & function) ...
$endgroup$
add a comment |
$begingroup$
Shell, 291 bytes
echo 'smile,flea,fly,hair,wart,frog,bump,log,hole'|awk -F, 'BEGIN{z="here'''s a ";a="T"z;c=a "hole";b=" in the bottom of the sea"}function f(n){printf a $n;for(j=n+1;j<=NF;j++){printf " on the " $j};print b;}{for(i=NF;i>=1;i--){printf (i<NF)?"n":"";f(i);f(i);print c", t" z "hole";f(NF)}}'
I'm sure it can be golfed further (definitions of vars & function) ...
$endgroup$
add a comment |
$begingroup$
Shell, 291 bytes
echo 'smile,flea,fly,hair,wart,frog,bump,log,hole'|awk -F, 'BEGIN{z="here'''s a ";a="T"z;c=a "hole";b=" in the bottom of the sea"}function f(n){printf a $n;for(j=n+1;j<=NF;j++){printf " on the " $j};print b;}{for(i=NF;i>=1;i--){printf (i<NF)?"n":"";f(i);f(i);print c", t" z "hole";f(NF)}}'
I'm sure it can be golfed further (definitions of vars & function) ...
$endgroup$
Shell, 291 bytes
echo 'smile,flea,fly,hair,wart,frog,bump,log,hole'|awk -F, 'BEGIN{z="here'''s a ";a="T"z;c=a "hole";b=" in the bottom of the sea"}function f(n){printf a $n;for(j=n+1;j<=NF;j++){printf " on the " $j};print b;}{for(i=NF;i>=1;i--){printf (i<NF)?"n":"";f(i);f(i);print c", t" z "hole";f(NF)}}'
I'm sure it can be golfed further (definitions of vars & function) ...
answered Jan 30 at 18:35
Olivier DulacOlivier Dulac
20917
20917
add a comment |
add a comment |
1 2
next
If this is an answer to a challenge…
…Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.
…Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
Explanations of your answer make it more interesting to read and are very much encouraged.…Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.
More generally…
…Please make sure to answer the question and provide sufficient detail.
…Avoid asking for help, clarification or responding to other answers (use comments instead).
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f179269%2ftheres-a-hole-in-the-bottom-of-the-sea%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
6
$begingroup$
Similar to There Was an Old Lady (other similar challenges e.g. this have been closed as duplicates, although I don't think they necessarily should.)
$endgroup$
– Jonathan Allan
Jan 30 at 16:33
6
$begingroup$
Ho, ro, the rattlin' bog, the bog down in the valley-o.
$endgroup$
– fəˈnɛtɪk
Jan 30 at 22:22
4
$begingroup$
For comparison (though not a programming language)
gzip -5
compresses it to 186 bytes (andbzip2
andxz
seem to do worse).$endgroup$
– Daniel Schepler
Jan 30 at 23:34
1
$begingroup$
Congrats, from another developer parent :)
$endgroup$
– AJFaraday
Jan 31 at 14:26
1
$begingroup$
I want to adapt this song to 05AB1E... "There's a hole in oh-five-ay-bee-one-ee!"
$endgroup$
– Magic Octopus Urn
Jan 31 at 16:40