2
\$\begingroup\$

like for languages that need a starting point, like c++, c#, java and kotlin.

I always post my answers in the function form instead of also calling it from the starting point. If we need to actually call it from the starting point, then that's a huge waste of bytes. what are the standard guidelines for that? or say, one could define that function as an extension function rather than a normal function that takes in the input as parameters if it saves bytes, what's the matter for this as well?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Hi there! The general consensus for including "boilerplate" (that's the starting point you're talking about) is that you don't need to count it in your score if you are submitting a function. You only need boilerplate if you are submitting a full program. Hopefully that helps :) \$\endgroup\$
    – lyxal
    Jan 28 at 11:34
  • 2
    \$\begingroup\$ Does this answer your question? When do I have to include things like Java's public static void main \$\endgroup\$
    – lyxal
    Jan 28 at 11:35
  • \$\begingroup\$ @lyxal yep it exactly does! but what about the extension function part? \$\endgroup\$
    – logic
    Jan 28 at 11:35
  • \$\begingroup\$ Do you have an example of what you mean by extension function? \$\endgroup\$
    – lyxal
    Jan 28 at 11:39
  • \$\begingroup\$ fun Int.returnOneMore() {return this+1} and it would be called by intVariable.returnOneMore() or 1.returnOneMore() \$\endgroup\$
    – logic
    Jan 28 at 11:40
  • \$\begingroup\$ huh, I can't find any existing consensus on extension functions. Guess we'll see \$\endgroup\$
    – lyxal
    Jan 28 at 11:43

1 Answer 1

-1
\$\begingroup\$

Extension Functions should be treated as helper functions

That is to say, they shouldn't be the main submission function, but they shouldn't need boilerplate.

For example:

Int.returnOneMore() {return this+1}

on it's own wouldn't be a valid submission, but:

Int.returnOneMore() {return this+1}
fun f(){/* something that calls the defined extension function */}

would be.

\$\endgroup\$
2
  • \$\begingroup\$ is there a consensus on this? \$\endgroup\$
    – logic
    Jan 28 at 12:27
  • 3
    \$\begingroup\$ I don’t see why they should be treated as helpers, they’re just functions with different syntax. (I’ll post an answer to this myself once I’m on my laptop) \$\endgroup\$
    – user
    Jan 28 at 12:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .