Skip to main content
added 186 characters in body
Source Link

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional, unless they cause an error/crash, in which case they should not be output.

Some additional notes:

  • White space and comments do not count as part of an expression - e.g. 2 or 2#a in Python are one-character expressions, so they shouldn't be printed.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional, unless they cause an error/crash, in which case they should not be output.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional, unless they cause an error/crash, in which case they should not be output.

Some additional notes:

  • White space and comments do not count as part of an expression - e.g. 2 or 2#a in Python are one-character expressions, so they shouldn't be printed.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

added 76 characters in body
Source Link

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional, unless they cause an error/crash, in which case they should not be output.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional, unless they cause an error/crash, in which case they should not be output.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

added 142 characters in body
Source Link

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

All\$^{\dagger}\$ 3-character expressions

\$^{\dagger}\$with some exceptions

In your golfing language of choice, given no input, output all valid 3-character expressions in that language, with the conditions described below.

An expression, for the purposes of this challenge, is a string of characters that can be evaluated to some result. An example of an expression in many languages is 1+2, which evaluates to 3. If evaluation causes an error/exception/crash (e.g. 1/0 in Python), then it should not be printed.

Expressions can also have side effects (modify the state of the program), e.g. y=2 in Ruby. These are allowed to be output but are not required. (In other words, you only need to print out referentially transparent expressions.) Similarly, any expressions that rely on the evaluation of previous expressions, e.g. a+2 (which requires that the value of a be set), are optional.

Any language that does not have the concept of expressions, or has no expressions that are 3 characters long meeting the above requirements, cannot be used for this challenge.

As per usual code golf, the shortest program (in bytes) wins.

Sandbox Questions

(This is my first challenge, so I don't really know what I'm doing, and feedback is greatly appreciated.)

I'm not sure how to deal with expressions that change the results of other expressions or change what counts as a valid expression, particularly in the case of side effects. For example, if in the language, evaluating any expressions causes an "answer" variable to be set, then all expressions have side effects and the challenge is moot.

I was considering having the condition for passing be "Your program satisfies the challenge if, after running, there are no other expressions you can evaluate.", but I'm unsure if that's a good requirement.

added 26 characters in body
Source Link
Loading
deleted 233 characters in body
Source Link
Loading
Source Link
Loading