| Bytes | Lang | Time | Link |
|---|---|---|---|
| 048 | Setanta | 240723T204047Z | bb94 |
| 186 | Messenger | 240723T191138Z | squarero |
| 017 | Uiua | 231013T054214Z | chunes |
| 010 | Thunno 2 j | 230603T184232Z | The Thon |
| 026 | ><> Fish | 230603T000318Z | chunes |
| 012 | Vyxal Ṫ | 220102T043643Z | lyxal |
| nan | 230115T092913Z | The Thon | |
| 025 | Arturo | 230115T081651Z | chunes |
| 017 | GolfScript | 151031T024405Z | Dennis |
| 023 | Rattle | 220928T000036Z | Daniel H |
| nan | 220927T192639Z | bigyihsu | |
| nan | Fig | 220927T191211Z | Seggan |
| 142 | Whitespace | 220905T070152Z | Kevin Cr |
| 020 | Seriously | 160129T021731Z | user4594 |
| 018 | MATL | 180717T150024Z | Sundar R |
| 016 | Cookie | 160323T073653Z | user5153 |
| 011 | MathGolf | 220902T120802Z | Kevin Cr |
| 024 | J | 220830T154140Z | south |
| 028 | BQN | 220428T220247Z | DLosc |
| 019 | Regenerate | 220428T160531Z | DLosc |
| 039 | Python | 220205T170213Z | Oliver |
| 072 | tinylisp | 220205T050054Z | DLosc |
| 020 | Zsh | 211031T234551Z | roblogic |
| 033 | Rust | 211101T145637Z | scpchick |
| 060 | JAVA | 211101T163444Z | Ha'P |
| 052 | QBasic | 211101T162912Z | DLosc |
| 039 | Lua | 211101T162351Z | Riptide |
| 028 | Python 3 | 211101T121918Z | Stephen |
| 060 | Aussie++ | 211101T022305Z | Bbrk24 |
| 026 | Swift | 211101T020804Z | Bbrk24 |
| nan | 160330T065609Z | Dennis | |
| 027 | BRASCA | 210507T070208Z | SjoerdPe |
| 021 | AWK | 210506T234003Z | Pedro Ma |
| 017 | Vim | 210427T204452Z | DLosc |
| 030 | Factor | 210427T201740Z | chunes |
| 018 | Pip | 151031T043400Z | DLosc |
| 013 | Canvas | 200506T053621Z | user9206 |
| 010 | 05AB1E | 160222T160344Z | a spaghe |
| 014 | W d | 200123T141617Z | user8505 |
| 016 | tq | 200101T121933Z | user8505 |
| 221 | MarioLANG | 191203T161614Z | CoedRhyf |
| 031 | Wren | 191203T111809Z | user8505 |
| 013 | Keg | 191203T075153Z | lyxal |
| 221 | Assembly MIPS | 190904T021354Z | Andrew B |
| 014 | Japt | 190903T224835Z | Shaggy |
| 012 | Stax | 190903T213218Z | recursiv |
| 018 | Runic Enchantments | 190903T183932Z | Draco18s |
| 039 | Forth gforth | 190903T173017Z | reffu |
| 022 | Excel | 190902T092318Z | Wernisch |
| 624 | Pyramid Scheme | 190801T200017Z | Khuldrae |
| 014 | Stax | 190801T194520Z | Khuldrae |
| 023 | Pip | 190801T192352Z | Kenzie |
| 024 | Kotlin | 181114T162622Z | snail_ |
| 024 | Java 8 | 181114T142232Z | NotBaal |
| 029 | PowerShell | 151102T161654Z | AdmBorkB |
| 046 | OCL | 180718T021220Z | Tux1 |
| 019 | Perl 5 | 151031T034808Z | Dennis |
| 040 | TSQL | 180501T180313Z | BradC |
| 026 | SmileBASIC | 180501T162628Z | 12Me21 |
| 028 | Python ≥ 3.6 | 171204T185132Z | Mr. Xcod |
| 099 | LOLCODE | 171110T202544Z | qqq |
| 016 | Implicit | 171111T050716Z | MD XF |
| 021 | Stacked | 171113T181015Z | Conor O& |
| 099 | Acc!! | 171110T202249Z | qqq |
| 018 | 170629T004024Z | totallyh | |
| 020 | Pylongolf | 160330T151755Z | user4701 |
| 041 | Lua | 160323T145434Z | Katenkyo |
| 022 | Groovy | 151031T035106Z | a spaghe |
| 038 | R | 160322T210123Z | lambrusc |
| 021 | Vitsy | 151031T125240Z | Addison |
| 015 | Jolf | 160214T215636Z | Conor O& |
| 028 | Applesoft BASIC | 160215T181721Z | dnep |
| 017 | Retina | 151103T151304Z | mbomb007 |
| 016 | Jolf | 160214T212446Z | a spaghe |
| 071 | D | 160214T210814Z | a spaghe |
| 025 | Squirrel | 160213T042555Z | a spaghe |
| 033 | F# | 160209T155201Z | Roujo |
| 021 | jq | 151031T123031Z | manatwor |
| 017 | GS2 | 151031T030543Z | a spaghe |
| 030 | Scala | 160129T040220Z | Jacob |
| 015 | Rotor | 151108T041118Z | a spaghe |
| 016 | Japt | 151101T012818Z | ETHprodu |
| nan | ><> | 151108T081438Z | Blake Lo |
| 012 | pl | 151221T200020Z | a spaghe |
| 414 | Chef | 151108T153508Z | a spaghe |
| 041 | Lua for windows | 151031T115511Z | Alex All |
| 014 | Carrot version ^3 | 151103T082822Z | user4180 |
| 079 | Factor | 151103T144135Z | user2911 |
| 027 | Dart | 151102T202247Z | Nick |
| 033 | C# | 151102T155258Z | DLeh |
| 026 | Clojure | 151102T054246Z | Ray Toal |
| 015 | Chaîne | 151031T214916Z | Conor O& |
| 034 | PHP | 151031T092300Z | user4647 |
| 108 | C++11 | 151031T234451Z | James Mu |
| 015 | gs2 | 151031T234324Z | lynn |
| 041 | JS ES5 | 151031T223731Z | user4616 |
| 038 | Haskell | 151031T225737Z | Zane Mar |
| 023 | Coffeescript | 151031T231155Z | Zane Mar |
| 017 | Stuck | 151031T030650Z | a spaghe |
| 024 | Bash | 151031T213918Z | Fabian S |
| 049 | Minkolang 0.10 | 151031T211400Z | El'e |
| 621 | JavascriptES6 21 Bytes | 151031T024148Z | Generic |
| 020 | O | 151031T205247Z | jado |
| 022 | APL | 151031T063030Z | Alex A. |
| 032 | Fourier | 151031T202348Z | Beta Dec |
| 020 | O | 151031T190828Z | manatwor |
| 021 | Burlesque | 151031T190155Z | mroman |
| 033 | MATLAB | 151031T184341Z | Tom Carp |
| 027 | Mathematica | 151031T140214Z | Ubiquito |
| 035 | Java | 151031T040046Z | TNT |
| 058 | C | 151031T160128Z | Chris Lo |
| 020 | Simplex v.0.7 | 151031T145904Z | Conor O& |
| 021 | Gema | 151031T122726Z | manatwor |
| 021 | Gol><> | 151031T054908Z | Sp3000 |
| 025 | Mouse | 151031T041743Z | Alex A. |
| 025 | Ruby | 151031T040234Z | Alex A. |
| 023 | Julia | 151031T035650Z | Alex A. |
| 031 | Python | 151031T034020Z | Dennis |
| 017 | Pyth | 151031T030437Z | Maltysen |
| 020 | dc | 151031T030145Z | daniero |
| 018 | TeaScript | 151031T023638Z | Downgoat |
| 018 | CJam | 151031T022343Z | a spaghe |
Messenger, 186 bytes
v >
4>IS >>v>v>v> v>v>v>
>S > S2+ >v
vSv >^>^>^>^ >^>^>^
v <>v> v> v > v>v >v
*> *>S >S >v>^>v>S9>S2 >v
>S vSv >S1 >S4 >+ >+>S8
>7^>3+vS^>- >->v vS^>-
> vS SvS^> ^
Messenger is my first (completed) esolang. It works in 2D, and it uses messages for storage, rather than variables or stacks. This makes it tough to code in, since timing and placing have to be managed so that the code doesn't break (or worse, throw an error).
A Python 3.8+ interpreter which works from the command line can be found here. To use it in Try It Online, IDLE, etc., remove the ## WHILE RUNNING ## section of the code.
Explanation
Unused characters in each step have been replaced with a dot.
v
4
Create a message going down, and set its content to 4.
>S
Split the message into two copies: one going up, and one going down.
TOP BRANCH:
>I
Get input. In Messenger, the input type relies on the type of the previous message, so the 4 from earlier is actually used for two things.
>
S
>
Split the message with the inputted integer into two copies. The top instance reaches the right end, and gets printed as a number. Meanwhile,
>>v
S2+
>^·
the bottom instance has 2 added to it.
·>v>v> v>v>v>
· ··
>^>^>^ >^>^>^
Then, it gets delayed enough so that it doesn't get outputted before spooky.
BOTTOM BRANCH:
vSv
v <>v
*> *>
>S ·
>7^·
Get 112 from (4 × 4) × 7.
·> v>
·S >S
vSv
>3+vS
>
Print chr(112 + 3) + chr(112) = 'sp', and store the 112 in another message so we don't have to do more arithmetic.
· · ·
>v··>v·
>S1 >S4
^>- >->
vS SvS^
Print 'ook', and store ord(k) = 107.
v>v >v
>S9>S2 >v
>+ >+>S8
>v vS^>-
^> ^
Print y with (stored) 112 + 9, m with (stored) 107 + 2, and e with 109 - 8.
Phew!
Reflection
This could definitely be golfed down more—I just went with the simplest solution, since doing anything here is harder than you would expect.
Thunno 2 j, 10 bytes
ƙ`me+‘ọṣ‘$
Explanation
ƙ`me+‘ọṣ‘$ # Implicit input
ƙ # Increment the input twice
`me+ # Append the string "me"
‘ọṣ‘ # Push compressed string "spooky"
$ # Push the input again
# Implicit output of joined stack
Vyxal Ṫ, 12 bytes
:⇧‛me«½↵*←«∇
2spooky4joe
Explained
:⇧‛me«½↵*←«∇
:⇧ # Without popping, push input + 2 - this leaves the stack as [input, input + 2]
‛me # push the string "me"
«½↵*←« # and the string "spooky"
∇ # rotate the top three items and output the sum of the stack
Thunno J, \$ 19 \log_{256}(96) \approx \$ 16 bytes
(actually 15.64 bytes but the leaderboard doesn't take floats)
D2+"spooky"s"me"ZMr
Explanation:
D2+"spooky"s"me"ZMr # Implicit input
D2+ # Duplicate and add 2
"spooky"s # Push "spooky" and swap
"me" # Push "me"
ZMr # Push the stack, reversed
# J flag joins by ""
# Implicit output
GolfScript, 17 bytes
~.2+"spooky"\"me"
Try it online on Web GolfScript.
How it works
~.2+"spooky"\"me"
~ # Evaluate the input.
.2+ # Push a copy and add 2.
"spooky" # Push that string.
\ # Swap it with the computed sum.
"me" # Push that string.
Rattle, 23 bytes
\&spooky&me|Ig0bb1+2bb2
Explanation
| everything before this is input
\ as input, take an input string
&spooky ...and "spooky" (hard-coded)
&me ...and "me" (hard-coded)
I split input list and store in consecutive memory slots
g0 get the first element
b add this to the print buffer
b1 add the element in memory slot 1 ("spooky")
+2 add 2 to the top of the stack
b add the top of the stack to the print buffer
b2 add "me" to the print buffer (buffer output implicitly)
Go, 70 bytes
import."fmt"
func f(n int)string{return Sprintf("%dspooky%dme",n,n+2)}
Fig, \$17\log_{256}(96)\approx\$ 13.993 bytes
%"%spooky%me"$w}}
Sadly, "%spooky%me" is incompressible in Fig.
%"%spooky%me"$w}}
}} # Increment twice
w # Wrap it in a list with the original number
$ # Reverse the list
%"%spooky%me" # Replace all '%' in "%spooky%me" with the elements in ^
Whitespace, 142 bytes
[S S S N
_Push_0][S N
S _Duplicate_0][S N
S _Duplicate_0][T N
T T _Read_STDIN_as_integer][T T T _Retrieve_input][T N
S T _Print_as_integer][S S S T T T N
_Push_7_y][S S T T T T N
_Push_-7_k][S S T T T N
_Push_-3_o][S N
S _Duplicate__o][S S T T S N
_Push_-2_p][S S S T N
_Push_1_s][N
S S N
_Create_Label_LOOP][S N
S _Duplicate_top][N
T S S N
_Jump_to_Label_DONE_if_0][S S S T T T S S T S N
_Push_constant_114][T S S S _Add][T N
S S _Print_as_character][N
S N
N
_Jump_to_Label_LOOP][N
S S S N
_Create_Label_DONE][T T T _Retrieve_input][S S S T S N
_Push_2][T S S S _Add][T N
S T _Print_as_integer][S S S T T S T T S T N
_Push_109_m][T N
S S _Print_as_character][S S S T T S S T S T N
_Push_101_e][T N
S S _Print_as_character]
Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Try it online (with raw spaces, tabs and new-lines only).
Explanation in pseudo-code:
Push 0
Integer n = STDIN as number
Print n as integer to STDOUT
Push codepoint-integers c for "ykoops", each lowered by 114
Start LOOP:
If top == 0: Go to function DONE
Add 114 to the top c
Print c as character to STDOUT
Go to next iteration of LOOP
function DONE:
Print n as integer to STDOUT
Print "me" as characters to STDOUT
(stop the program implicitly with an error: no exit defined)
The constant 114 is generated by this Java program, based on this Whitespace tip of mine.
Seriously, 20 bytes
"me",;⌐@"spooky"@kεj
Since this challenge partially inspired this language, I figured I should go ahead and add a solution. Try it online!
Cookie, 16 bytes
Note that the recent changes to the Github page were not made for this challenge, Cookie is still in development.
wŕspooky[r+2]me"
Explanation:
wŕspooky[r+2]me"
w start write command
ŕ take input
spooky write spooky
[r+2] compute input + 2
me write me
" close write command.
MathGolf, 11 bytes
k╕o3╣Rk⌠ûme
Explanation:
k # Push the input-integer
╕o3 # Push compressed string "spoo"
╣R # Push compressed string "ky"
k # Push the input-integer again
⌠ # Increase it by 2
ûme # Push string "me"
# (after which the entire stack joined together is output implicitly)
k...k⌠ could alternatively have been └)...@ for the same byte-count: try it online.
└ # Increase the (implicit) input-integer by 1 without popping
) # Pop and increase it by 1 again
@ # Reverse triple-swap the top three values on the stack
BQN, 30 28 bytes
•Fmt∾"spooky"∾"me"∾˜·•Fmt+⟜2
Anonymous tacit function. Try it at BQN online
Explanation
Reading right-to-left:
+⟜2adds 2 to the argument•Fmtconverts that number to a string·helps with parsing"me"∾˜concatenatesmeto the end of the string"spooky"∾concatenatesspookyto the beginning of the string•Fmt∾concatenates the argument, stringified, to the beginning of the string
Regenerate, 19 bytes
$~1spooky${$~1+2}me
Explanation
$~1spooky${$~1+2}me
$~1 First command-line input
spooky spooky
${ } Treat the result of this expression as a string:
$~1 First command-line input
+2 Plus 2
me me
Python, 39 bytes
x=int(input());print(f"{x}spooky{x+2}me)
Don't remove the int(). That will cause an error.
Tested on Python 3.10.1 (v3.10.1:2cd268a3a9, Dec 6 2021, 14:28:59) [Clang 13.0.0 (clang-1300.0.29.3)] on darwin
tinylisp, 72 bytes
(load library
(q((N)(strcat(string N)(join2(q spooky)(q me)(string(a N 2
Anonymous function that takes a number and returns a name (tinylisp's equivalent of a string). Try it online!
Ungolfed/explanation
(load library) ; Needed for strcat, join2, and ungolfed aliases
(lambda (N) ; Anonymous function with one argument
(strcat ; Concatenate these two names as a single string:
(string N) ; Convert the input number to a string, and
(join2 ; Join these strings together:
(q spooky) ; "spooky" and
(q me) ; "me", with the following separator:
(string ; Convert to a string
(add2 N 2))))) ; the input number plus 2
Rust, 37 33 bytes
Thanks @xigoi for tip on removing i32 type signature for n
|n|{print!("{}spooky{}me",n,n+2)}
JAVA, 60 bytes
class p {String main(int n) {return n+"spooky"+(n+2)+"me";}}
Works fine on blueJ but not on TIO idk why?
QBasic, 52 bytes
INPUT n
?MID$(STR$(n),2)"spooky"MID$(STR$(n+2),2)"me
Try it at Archive.org.
Explanation
QBasic's annoying number-to-string formatting is on full display here. Printing a number directly adds a leading and trailing space, so that's out. PRINT USING seems tailored for fixed-width columns and doesn't do well with numbers of different lengths. STR$(n) is a little better: it only adds a leading space, which we can remove by taking a substring starting at the second character with MID$.
INPUT n Get a number from the user
? Print
MID$(STR$(n),2) The number w/o leading space
"spooky" That string
MID$(STR$(n+2),2) The number + 2 w/o leading space
"me That string (close-quote implied)
Lua, 39 bytes
w=io.write w(...)w'spooky'w(...+2)w'me'
Test
> lua -v & echo -------- & lua ./spooky.lua 2
Lua 5.4.0 Copyright (C) 1994-2020 Lua.org, PUC-Rio
--------
2spooky4me
Aussie++, 60 bytes
THE HARD YAKKA FOR f IS(n)<BAIL ""+n +"spooky"+(n +2)+"me";>
Tested in commit e0091bc.
For some reason, the space in n + is required. The empty string at the beginning seems unnecessary but isn't, see this issue.
Jelly
13 bytes
+0,2ż“×¥X“ŀ`»
I CAN'T OUTGOLF QUARTATA HELP
How it works
+0,2ż“×¥X“ŀ`» Main link. Input: n
+0,2 Add [0, 2] to n, resulting in [n, n + 2].
“×¥X“ŀ`» Yield ['spooky, 'me'] by indexing into a dictionary.
ż Zip the results to left and right with each other.
This yields [[n, 'spooky'], [n + 2, 'me']], which is flattened
before printing.
BRASCA, 27 bytes
ig:an`ykoops`[o]A}}n`em`[o]
Explanation
<implicit input> - Push STDIN on the stack
ig - Turn the codepoints of 0-9 into 0-9, and concatenate stack
:a - Store a copy into register A
n - Print the original (this disables implicit output)
`ykoops`[o] - Push and print "spooky"
A}} - Get the copy from register A and increment twice
n - Print the incremented copy.
`em`[o] - Push and print "me"
AWK, 21 bytes
$0=$0"spooky"$0+2"me"
Substitutes the input for (input)spooky(input+2)me. As the new value of $0 is not zero nor null, prints $0.
Vim, 18 17 bytes
C<C-r>"spooky<C-r>"<esc><C-a><C-a>ame
Explanation
C
Delete the input number (storing it in the register) and enter insert mode.
<C-r>"spooky<C-r>"
Insert the number from the register, followed by spooky, followed by the number from the register again.
<esc><C-a><C-a>
Leave insert mode and increment the number under the cursor twice.
ame
Insert me after the number.
Factor, 30 bytes
[ dup 2 + [I ${}spooky${}meI]]
TIO doesn't have the interpolate vocab, so have a screenshot:
Pip, 18 bytes
Looks like I'm in the second tier of golfing languages here. :^P
[a"spooky"a+2"me"]
Takes the number as a command-line argument and puts the appropriate elements in an array, which is joined together and autoprinted at the end of the program.
Five and a half years later, here's a much more interesting 18-byte solution:
"0spooky2me"RXD_+a
In the string 0spooky2me, Replace each digit (built-in regex variable XD) with itself plus the command-line argument (_+a).
05AB1E, 14 10 bytes
DÌs’ÿæªÿme
Explanation
DÌs’ÿæªÿme
D get input n and duplicate it
Ì increment by 2
s Swap. Stack is now [n+2, n].
’ÿæªÿme Compressed string that expands to "ÿspookyÿme". The first ÿ is then replaced by n and the second by n+2.
W d, 14 bytes
♠╚z[·7♦÷U# 1╘╖
Explanation
Uncompressed:
"a"spooky"a2+"me"
"" % Push an empty string for the first operand to render
a % The 1st operand
"spooky" % Push "spooky"
a2+ % The 1st operand + 2
"me" % Push me
tq, 16 bytes
?"spooky"?+2"me"
Explanation
# Define an array with 4 items
? # First item: input
"spooky" # Second item: "spooky"
?+2 # Third item: input + 2
"me" # Fourth item: "me"
# Print without a separator
```
MarioLANG, 221 bytes
;>+>+>+>+>.>)
:"+"+"+"+"-"-
)++++++++.-:-
+++++++++--+-"
+++++++++.-+-.
+++++++++-.(--
+++++++++-+.--
+++++++++-++--
+++++++++.++--
++++++++++++--
++++++++++++--
++++++++++++--
++++++++++++--
+!+!+!+!+!+!.!
=#=#=#=#=#=#=#
Keg, -no 13 bytes
:&spooky&2+me
This was way too spooky. It's not even October!
Pushes the evaluated input and stores it in the register, pushes the sequence spooky, adds two to the value in the register and then pushes the sequence me.
Uses the latest version of the interpreter which hasn't been updated on TIO thus far.
Assembly (MIPS, SPIM), 221 bytes
.data
a: .asciiz "spooky"
c: .asciiz "me"
.text
.globl main
main:
li $2 5
syscall
la $9 a
la $10 a
move $8 $2
l:
move $4 $8
li $2 1
syscall
li $2 4
move $4 $9
syscall
bne $10 $9 e
la $9 c
addi $8 2
j l
e:
li $2 10
syscall
Couldn't get SPIM and TIO to play nice with argc/argv, so had to take it via input. String formatting in Assembly isn't pleasant.
Stax, 12 bytes
ïöeO¬‼3ì╡☻↔G
Uses an unterminated template literal to embed instructions in an output string.
Runic Enchantments, 18 bytes
i:2+"me"S9´334E{@
Saves 1 byte by using 9´334E to pull "spooky" out of the word dictionary. 8b*E for "me" is the same length.
Forth (gforth), 39 bytes
: f 0 2dup .r ." spooky"2 m+ .r ." me";
Code Explanation
: f \ start a new word definition
0 2dup \ add 0 to the top of the stack and duplicate the top two stack values
.r \ print the input with no following space
." spooky" \ print "spooky"
2 m+ .r \ add 2 to the input and print with no following space
." me" \ print "me"
; \ end the word definition
Excel, 22 bytes
=A1&"spooky"&A1+2&"me"
Pyramid Scheme, 624 bytes
^ ^ ^ ^ ^ ^ ^ ^ ^
/ \ / \ / \ / \ / \ / \ / \ / \ / \
/set\ /out\ /out\ /out\ /out\ /out\ /out\ /out\ /out\
^-----^^-----^ -----^ -----^----- ^----- ^-----^ -----^ -----^
- ^-- / \ / \ / \ / \ / \ /+\ / \ / \
/#\ /chr\ /chr\ /chr\ /chr\ /chr\ ^---^ /chr\ /chr\
^--- ^----- ^----- ^----- ^----- ^-----/2\ - ^----- ^-----
/l\ / \ / \ / \ / \ / \ --- / \ / \
/ine\ /115\ /112\ /111\ /107\ /121\ /109\ /101\
----- ----- ----- ----- ----- ----- ----- -----
Very straightforward. Gets an integer from input and saves it to the blank variable. Prints it. Prints "spooky". Prints blank+2. Prints "me". Follows the same pattern as Hello, World, for the most part.
Stax, 14 bytes
ü╫2┐╚╘Wö»§W╟╛╨
Run and debug it at staxlang.xyz!
Unpacked (16 bytes)
.me;2+`tNCrf`,Wp
.me Literal "me"
;2+ Peek from input stack, push to stack, and add 2
`tNCrf` Literal "spooky"
, Pop from input stack; push to stack
Wp Pop and print everything from the stack with no additional newlines
Java 8, 24 bytes
n->n+"spooky"+(n+2)+"me"
That moment when Java is actually competitive... (and by competitive I mean top 40 :P)
PowerShell, 31 30 29 bytes
param($x)"$x`spooky$($x+2)me"
Takes input $x, constructs and leaves a string on the pipeline with implicit output. The string is formed from $x spooky $x+2 me, with the trick being the ` that allows the variable name to be escaped to be just $x instead of $xspooky.
-1 byte thanks to Veskah.
OCL, 52 46 bytes
Function a b Print b+"spooky"+(b + 2)+"me" End
This one is pretty straight forward, I just wanted to show off an obscure language.
Edit: I found out you can omit the spaces between the pluses when doing concatenation, but not addition. Weird.
Perl 5, 20 19 bytes
$\=spooky.($_+2).me
The code requires the -p switch. Thanks to @Xcali for golfing off 1 byte!
T-SQL, 40 bytes
SELECT CONCAT(n,'spooky',n+2,'me')FROM t
Input taken via a pre-existing table t with integer column n, per our input standards.
CONCAT does an implicit type conversion, otherwise I'd have to do something like CONVERT(n,varchar(9)).
SmileBASIC, 26 bytes
INPUT N?N;"spooky";N+2;"me
Python ≥ 3.6, 28 bytes
lambda x:f'{x}spooky{x+2}me'
Makes use of formatted string literals, a feature that was introduced in Python 3.6.
LOLCODE, 100 99 bytes
HAI 1.3
I HAS A J
GIMMEH J
VISIBLE J!
VISIBLE "spooky"!
VISIBLE SUM OF J AN 2!
VISIBLE "me"
KTHXBYE
Implicit, 20 17 16 bytes
ì¯spooky]ì..ìme"
ì¯spooky]ì..ìme"
ì « implicit integer input, convert to string »;
¯ « copy input to memory »;
spooky « push the ASCII character codes for each letter in `spooky` individually »;
] « copy memory to stack »;
ì « convert string to integer »;
.. « increment twice »;
ì « and back to string »;
me « push character codes for `me` »;
" « stringify the entire stack »;
Stacked, 21 bytes
[:2+,'spooky'#`'me'+]
Function returning the string.
Explanation
[:2+,'spooky'#`'me'+]
[ ] function stack: (y)
: duplicate stack: (y y)
2+ add 2 stack: (y y+2)
, pair stack: ((y y+2))
'spooky'#` join by "spooky" stack: ("{y}spooky{y+2}")
'me'+ append the string "me" stack: ("{y}spooky{y+2}me")
Acc!!, 99 bytes
N
Write _
Write 115
Write 112
Write 111
Write 111
Write 107
Write 121
Write _+2
Write 109
Write 101
Pylongolf, 20 bytes
_:AA"spooky"A2+"me"~
_ asks for input and :A puts it into the variable A.
A"spooky" pushes A, and spooky then A2+ adds the input + 2.
After that we push "me" into the stack and print it with ~.
Lua, 41 Bytes
There's this other lua answer, but it doesn't work anymore since lua 5.3. It will now print 2spooky4.0me Here comes a code working under all versions of lua, and who's still in 41 Bytes:
print(("%dspooky%dme"):format(...,...+2))
Groovy, 24 22 bytes
{it+"spooky${it+2}me"}
R, 38 bytes
n=scan();sprintf("%dspooky%dme",n,n+2)
or (same length)
sprintf("%dspooky%dme",n<<-scan(),n+2)
Example:
n=scan();sprintf("%dspooky%dme",n,n+2)
1: 999
999spooky1001me
Vitsy, 21 Bytes
Note: the Z command was made after this challenge began, but was not made for this challenge.
VVN"ykoops"ZV2+N"em"Z
V Grab the top item of the stack (the input) and make it a
global variable.
V Call it up - push the global variable to the top of the stack.
N Output it as a number.
"ykoops" Push 'spooky' to the stack.
Z Output it all.
V2+N Call the global variable again, add two, then output as num.
"em"Z Push 'me' to the stack and output it all.
More spoopy variation using multiple stacks (27 Bytes):
&"ykoops"&"em"?DN?Z??2+N??Z
& Make a new stack and move to it.
"ykoops" Push 'spooky' to the current stack.
&"em" Do the last to things with 'me'.
? Move over a stack.
DN Output the input.
?Z Move over a stack (the one with 'spooky') and print it.
?? Move back to the original stack.
2+N Add 2 to the input and output it as a number.
??Z Move to the stack with 'me' in it and print it.
Jolf, 15 bytes
Try it here! I forgot about inline string interpolation until after @quartata posted his solution.
"¦jspooky¦+2jme
Explanation
"¦jspooky¦+2jme
" string containing
¦j the input,
spooky "spooky"
¦+2j 2 + the input,
me and "me"
implicitly printed.
Applesoft BASIC, 28 bytes
0input n:?n;"spooky";n+2;"me
The question mark expands to PRINT and the missing final double quotation mark is implied.
Tested with Joshua Bell's online emulator.
Retina, 17 bytes
This assumes that the integer n may be expressed in unary in the output. Each line would go in its own file, with one byte added per additional file.
1+
$_spooky$_11me
If the input is 11, the output is 11spooky1111me.
For non-unary output (but still unary input), use this (27 bytes):
1+
$_spooky$_11me
(\d)+
$#1
D, 71 bytes
import std.string;string s(int i){return format("%sspooky%sme",i,i+2);}
More verbose than Java...
Squirrel, 25 bytes
@(n)n+"spooky"+(n+2)+"me"
F#, 33 bytes
fun n->printf"%ispooky%ime"n<|n+2
jq, 21 characters
(20 characters code + 1 character command line option.)
"\(.)spooky\(.+2)me"
Sample run:
bash-4.3$ jq -r '"\(.)spooky\(.+2)me"' <<< 42
42spooky44me
On-line test (Passing -r through URL is not supported – check Raw Output yourself.)
GS2, 17 bytes
56 40 27 27 04 73 70 6F 6F 6B 79 05 42 04 6D 65 05
I CAN'T OUTGOLF DENNIS HELP
Scala, 30 bytes
(n:Int)=>s"${n}spooky${n+2}me"
Rotor, 15 bytes
&"spooky"~2+"me
Language was created after the challenge. Does not work in the online interpreter (uses input eval.)
Japt, 17 16 bytes
U+"spooky{U+2}me
Japt (Javascript shortened) is a language of my invention. It is newer than this challenge; thus, this answer is non-competing. Unlike my other seven unpublished languages, this one has an actual interpreter that is currently being developed and is already partially working.
I wanted to post this because I like how it's the same length as all the existing first-place second-place answers. Here's how it works:
U+"spooky{U+2}me" implicit: [U,V,W,X,Y,Z] = eval(input)
U+ input +
"spooky me" this string
{U+2} with input+2 inserted here
implicit: output last expression
And there you have it. The spec for all functionality used here was finalized on Oct 29th; nothing was changed to make this answer any shorter. Here's the interpreter, as promised.
><>, 25 (+2) = 27 bytes
:n'emykoops'oooooo{2+noo;
Starting with a value (n) on top of the stack from -v (2 byte penalty). Explanation:
: Duplicates top item on stack
n Pops and outputs top value on stack as number -> n
'emykoops' Pushes each character onto the stack
o x5 Pops and outputs top value on stack as character -> "spooky"
{ Shift stack leftwards making input value top value
2 Pushes 2 on the stack
+ Pops top 2 elements, sums them and pushes result
n Pops and outputs top value on stack as number -> n+2
o x2 Pops and outputs top value on stack as character -> "me"
; Ends execution
Chef, 414 bytes
S.
Ingredients.
g i
2 g t
115 l s
112 l p
111 l o
107 l k
121 l y
109 l m
101 l e
Method.
Take i from refrigerator.Put e into mixing bowl.Put m into mixing bowl.Put i into mixing bowl.Add t.Put y into mixing bowl.Put k into mixing bowl.Put o into mixing bowl.Put o into mixing bowl.Put p into mixing bowl.Put s into mixing bowl.Put i into mixing bowl.Pour contents of mixing bowl into the baking dish.
Serves 1.
A recipe for disaster. Do not try this at home.
Lua for windows, 41 bytes
n=io.read()print(n.."spooky"..n+2 .."me")
test with lua for windows
it takes the input through io.read then stored in variable n then on the same line prints the variable n then "spooky" then n+2 finally it prints "me"
Carrot (version ^3), 14 bytes
#spooky(#+2)me
Explanation:
Carets ^ have now been made optional if you do not want to use commands. The # is the variable representing the input. Every instance of # is replaced with the value of input. Going to the parentheses, the expression inside the parentheses is evaluated and a number is returned.
Test it online here. Please note that this is not permalinked.
Factor, 79 bytes
: f ( x -- ) dup 2 + [ number>string ] bi@ "spooky" swap "me" 4array concat . ;
First stab at it, just did it the obvious way.
Dart, 27 Bytes
t(n)=>'${n}spooky${n+2}me';
Unremarkable but competitive.
C# 33 bytes
string s(n)=>$"{n}spooky{n+2}me";
Clojure, 26 bytes
#(str %"spooky"(+ 2%)"me")
First post. It's a function, as required. I think I took as many liberties with the tokenizer as possible, but I don't know. Here it is in action in the REPL:
user=> #(str %"spooky"(+ 2%)"me")
#<user$eval1176$fn__1177 user$eval1176$fn__1177@2d2d2f69>
user=> (*1 55)
"55spooky57me"
Chaîne, 15 bytes
noncompeting, language postdates question
{i~}:-,}:{2+}me
{i~} | input duplicate write
: : | access dictionary with inner base-93 key
-,} | entry for "spooky"
{2+} | push 2, add previous two, write
me | write me
Implicit output.
PHP, 55 47 46 42 34 bytes
<?=($a=$argv[1]).spooky.($a+2).me;
Accepts the number as command line input.
Credits :)
Thanks to manatwork for saving 4 bytes!
Thanks to insertusernamehere for saving 8 bytes!
C++11, 142 130 108 bytes
Self-imposed challenge: no C headers
#include<sstream>
#include<string>
[](int x){std::stringstream q;q<<x<<"spooky"<<x+2<<"me";return q.str();}
Thanks to Mego for saving a few bytes with the return logic everything.
gs2, 15 bytes
I outgolfed Dennis!
CP437:
spooky•me♣╨V↕0B
Hex dump:
73 70 6f 6f 6b 79 07 6d 65 05 d0 56 12 30 42
At the start of the program, STDIN is pushed (e.g. the string "3") and stored in variable A. The first ten bytes of the program push two strings, "spooky" and "me", to the stack. Then:
d0pushes variableA.56parses it as a number.1230increments it by two.42swaps the top two elements on the stack, leaving"3" "spooky" 5 "me".
The final stack is printed as 3spooky5me.
JS (ES5) 41
Oh, ES6...
function(a){alert(a+"spooky"+(a+2)+"me")}
Haskell, 38 bytes
a n=show(n)++"spooky"++show(n+2)++"me"
Defines a function named a that takes a Num n. Returns <n>spooky<n+2>me.
Coffeescript, 23 bytes
(n)->n+"spooky#{n+2}me"
Anonymous function that takes int n and returns <n>spooky<n+2>me.
Stuck, 17 bytes
i_2+"spooky";"me"
EDIT: GUESS YOU COULD SAY I'M STUCK AT 17 BYTES
Bash, 24 bytes
echo $1spooky$(($1+2))me
Takes input as command line argument
Minkolang 0.10, 49 bytes
I have no way to convert integers to strings (yet!), so this is much longer.
"me"nd2+(dl%"0"+$rl:d)"spooky"2g(dl%"0"+$rl:d)$O.
Explanation
(dl%"0"+$rl:d) does the job of converting an int to a string. If this were replaced by a single character (like Z), then my solution would be just 23 bytes.
"me"nd2+Z"spooky"2gZ$O.
nd takes an integer from input and duplicates it. 2+ adds 2 and 2g later gets the initial input and puts it on top of stack. $O. outputs the whole stack as integers and stops.
Javascript(ES6) 23 21 Bytes
A simple function that will be crushed by golfing lanqs:
_=>_+`spooky${_+2}me`
_=>`${_}spooky${_+2}me`
Special thanks to ETHproductions for saving 2 bytes
O, 20 bytes
j.o"spooky"o))o"me"o
Kinda long Try it online
j Get input as Number . Clone the number to add to later o Print the number "spooky"o Print spooky ))o Increment the input by two and print "me"o Print me
APL, 25 22 bytes
⍕,'spooky','me',⍨∘⍕2+⊢
This creates an unnamed monadic function train that accepts an integer on the left and returns a string.
Numeric values are converted to strings using ⍕. The array of strings is joined into a single string using ∊.
Saved 3 bytes thanks to Thomas Kwa!
O, 20 characters
Q"spooky"Q2+"me"+++p
Sample run:
bash-4.3$ o.sh 'Q"spooky"Q2+"me"+++p' <<< 42
42spooky44me
Burlesque, 21 bytes
J2?+Cl"~spooky~me"jf~
Needs fixed stack layout. Not usable except as a stand-alone program. Otherwise use one of the versions below that are more generic.
Alternative versions:
"~spooky~me"jbxJ2?+_+f~ [24 bytes]
J"spooky"?+j2?+"me"?+?+ [24 bytes, too]
MATLAB, 33 bytes
@(x)fprintf('%dspooky%dme',x,x+2)
Pretty self explanatory. Tried a few ways and this was the shortest I could find.
You should be able to run this with the Octave online interpreter.
Mathematica, 45 27 bytes
Print[#,"spooky",#+2,"me"]&
g=ToString[#]<>"spooky"<>ToString[#+2]<>"me"&
Thanks to Martin Büttner for the significant improvement (and the warm welcome).
Java, 39 35 bytes
n->"".format("%dspooky%dme",n,n+2);
A lambda expression that takes an int and returns a string.
C, 58 bytes
main(a,b)char**b;{printf("%sspooky%dme",*++b,atoi(*b)+2);}
atoi() may be unnecessary.
Simplex v.0.7, 20 bytes
Simplex simply isn't feeling golfy today. >_<
i@R"spooky"&IIR"me"g
i@ ~~ take input and copy to register
R"spooky" ~~ write that string to the strip (increment byte after every character)
&II ~~ write the register (incremented twice) to the strip
R"me" ~~ write that string to the strip
g ~~ output the strip
Gema, 21 characters
*=*spooky@add{$0;2}me
Sample run:
bash-4.3$ echo -n 42 | gema '*=*spooky@add{$0;2}me'
42spooky44me
Gol><>, 21 bytes
I:n"emykoops"6Ro{2+nH
I guess I'm... tied with Perl? Try it online.
I:n Input n, output n
"emykoops" Push chars
6Ro Output top 6 chars (spooky)
{2+n Output n+2
H Output stack and halt (me)
Mouse, 25 bytes
?N:N.!"spooky"2N.+!"me"$
Ungolfed:
? N: ~ Read an integer N from STDIN
N. ! ~ Write N to STDOUT
"spooky" ~ String literals go straight to STDOUT
2 N. + ! ~ Print N+2
"me"
$ ~ End of program
Ruby, 25 bytes
->n{"#{n}spooky#{n+2}me"}
This creates an unnamed lambda that accepts an integer and returns a string. The string is constructed using Ruby's string interpolation.
Julia, 23 bytes
n->"$(n)spooky$(n+2)me"
This creates an unnamed lambda function that accepts an integer and returns a string. The output is constructed using Julia's string interpolation.
dc, 20 bytes
?dn[spooky]P2+n[me]P
TeaScript, 18 bytes
x+`spooky${x+2}me`
Unfortunately this string can't be compressed so this is basically as short as it will get
