16
\$\begingroup\$

I honestly can't believe this challenge does not already exist.

The challenge

Write a function.

The specifics

  • Your program must define some sort of callable function. This includes anything commonly known as a function, a lambda function, or a subroutine. All of these types of callables will be referred to as a "function" in this post.

    1. Input to the function is optional and not required.

    2. A return value from the function is also optional and not required but control must return to the calling program.

  • The function must be assigned to some sort of variable so that it is possible to be accessed at a later time. This includes indirect assignment (in most common languages where declaring a named function automatically adds the name into the current scope) and direct assignment (assigning an anonymous function to a variable directly).

  • The function does not need to be named.

  • The function must be created by you - you cannot just assign a default function from the language to a variable.

  • None of the standard loopholes, please.

This is , so lowest score in bytes wins.

\$\endgroup\$
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – James Jul 10 '19 at 15:09
  • 3
    \$\begingroup\$ I don't get why this was reopened when none of the reasons it was closed in the first place have been addressed, just hidden away by mods in a chat \$\endgroup\$ – Jo King Jul 17 '19 at 4:42
  • 2
    \$\begingroup\$ Also, since when can you vote to reopen your own post?? \$\endgroup\$ – Jo King Jul 17 '19 at 4:52
  • 7
    \$\begingroup\$ You need to be a lawyer rather than a programmer to compete in this challenge. \$\endgroup\$ – anatolyg Jul 21 '19 at 17:36
  • 2
    \$\begingroup\$ This should definitely not have been reopened in its current state. \$\endgroup\$ – Mego Aug 11 '19 at 23:32

62 Answers 62

1 2
3
0
\$\begingroup\$

BFASM / asm2bf, 9 bytes

lbl 1
ret

It builds to following brainfuck code (omitting boilerplate):

]>+<<+<<[>>->+<<<-]>>>[<<<+>>>-]<[->+<<[>>>-<<+<-]>[<+>-]>>[<->[-]]<[<<<+>>>-
]<]>>[-]<<<<[>>+>+<<<-]>>[<<+>>-]>[[-]>>>>>><<<<<<<<<[-]>[-]>>>>>>>>>>>>>>>[-
]>[>>]<<->[<<<[<<]>+>[>>]>-]<<<[<<]>[<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>-]<<<<<<<
[-]<<<<<<]<<<[>>+>+<<<-]>>[<<+>>-]>[[-]
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Zsh, 5 bytes

Anonymous function... Try it online!

()(1)
| improve this answer | |
\$\endgroup\$
1 2
3

Not the answer you're looking for? Browse other questions tagged or ask your own question.