3
\$\begingroup\$

How to write a single-line password generator asks for a solution in "one line".

It seems to me that this is potentially a different class of challenge from , and for the nonce I've tagged it .

What say ye?

  • Is this a different challenge?
  • If so, how do we define "one line"? (Note that this will have to be sensitive to the differences between languages...)
  • How does this interact with languages that prescribe a certain amount of scaffolding (like c requires main), or traditionally don't have a single command invocation from the command line?
\$\endgroup\$
3
  • \$\begingroup\$ In some languages, every program can be considered "one line". \$\endgroup\$ Apr 27, 2011 at 15:17
  • \$\begingroup\$ @Peter: Yep, and some historical "one liner" contests have used arbitrary definitions. There was a apple ][ magazine that ran one which used "256 bytes" and also accepted submissions in assembly (since there was an assembler in the firmware). \$\endgroup\$ Apr 27, 2011 at 15:20
  • \$\begingroup\$ "What say you?", assuming you're going for something Denethor-ish. Also, I don't see anything wrong with int main(){int n=42;while(n--)std::cout<<"You've got a virus.\n";return(0);} \$\endgroup\$ May 3, 2011 at 0:36

1 Answer 1

3
\$\begingroup\$

is fine in my opinion.

As to what constitutes a one-liner, in languages that have a concept of statements, that's straightforward: the whole program should fit into one statement. (Scaffolding does not count as statements.)

In languages that don't have a concept of statement, then it gets pretty blurry. :-(

\$\endgroup\$

You must log in to answer this question.

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