# Are fixed input allowed if the bytes count? [closed]

E.g. requiring to call by f(4), and add 1 to the byte count

Or maybe when inputting a choice, require input f!#% or f&^%, and add 6 to the byte count?(Related)

Cuz we allow filename storage as long as its byte counted(Related)

• No. We don't allow filename storage either. Also, this looks like JS; declaring variables is like 3 extra bytes... – ASCII-only Mar 12 '18 at 1:51
• codegolf.meta.stackexchange.com/a/1072/76323 don't allow only when not count bytes – l4m2 Mar 12 '18 at 1:55
• Hmm, I guess that's true. But yeah, you're not allowed to assume the user inputs part of the data for you when they're calling the function. – ASCII-only Mar 12 '18 at 2:15
• A comment doesn't really work as a consensus, even if it's got many votes (comments can't be downvoted). Can you provide another answer/meta post for that? – Rɪᴋᴇʀ Mar 12 '18 at 2:36
• It's not very clear what you're asking. – Peter Taylor Mar 12 '18 at 16:28

# In some cases

In programming languages where functions are curried by default this is already allowed. For example here I define the function % as so:

(a:b)!(c:d)|a==c=1+b!d
_!_=0
a%c@(e:d)=maximum[a!c,""%d,(a++[e])%d]
_%_=0


but my actual solution requires the empty string to be passed as input. I add the bytes

(""%)


(if you are not familiar with Haskell this partially applies % to the empty string) to create a anonymous function. This is basically passing a static argument to the function from earlier. It is even clearer if we rename % to f:

(a:b)!(c:d)|a==c=1+b!d
_!_=0
f a c@(e:d)=maximum[a!c,f""d,f(a++[e])d]
f _ _=0


In which case we add the extra bytes

f""


Since anonymous functions are already allowed, and partial application create returns a function, this is allowed and the way to count bytes is rather obvious.

This only works if the original function was named (not anonymous) because it has to be called. If my function were already anonymous I would have to add to its definition or name it.

# But not in other cases

If your function is not curried, it can't use the same format. Alternative solutions would include

• Define a new function (anonymous or named) that calls on the old one (assuming the old one was named).
• If your function is not recursive, you could also pay to define a new constant with the value you wish to access.
• If your language has a builtin way to do partial application you could do that to create a new anonymous function.
• (that is equivalent to "no, the submission must be a function" + "function submission can be anonymous) – user202729 Mar 12 '18 at 11:05
• @user202729 Not that same. It seems allow to reduce a pair of () – l4m2 Mar 12 '18 at 15:02
• @l4m2 Haskell doesn't use () for function calls. user202729 is correct. – Post Rock Garf Hunter Mar 12 '18 at 15:34
• If you didn't point exact language and say "sometimes" – l4m2 Mar 12 '18 at 15:35
• @l4m2 I'm not sure what you are trying to say. Haskell is an example of a language that supports partial application, JavaScript also supports partial application on curried functions. This answer is not specific to Haskell if that is what you mean. – Post Rock Garf Hunter Mar 12 '18 at 17:34