Cheddar is a high-level, functional + object-oriented programming language created by our user Downgoat designed to make programming easier, faster, and more intuitive.

What general tips do you have for golfing in Cheddar? I'm looking for ideas which can be applied to problems and which are also at least somewhat specific to Cheddar (e.g. "Remove unnecessary whitespace." is not an answer).


6 Answers 6


Use Functionized Properties

If you ever use just a property in a function:


You can use functionized properties to save some bytes:


You can reference the variable in the functionized property with $0.


Use the String Operator for string sequences

I'm talking about the @" operator which does different things, all of which deal with strings. This has quite a bit of uses but this is one of my favorite uses:

Take a look at this:

@" [103, 111, 97, 116, 115] === "goats"

not that useful but the opposite is:

@"'goats' === [103, 111, 97, 116, 115]
'goats'.bytes // compare the above too

This is especially useful to generate the alphabet:

65@"90    // Uppercase Alphabet
97@"122   // Lowercase Alphabet
65@"90+97@"122 // Both cases
String.letters // Compare 97@"122 to this


No not red curry (what other curry would you be thinking about ¬_¬). I mean this type of curry:


If you have a function taking two arguments. It's shorter to curry than to not:


Note: This is only shorter when you have exactly two arguments.


Use default arguments

Declaring Cheddar variables can be quite the byte-waster:

->{var a=b+1}

luckily, you can (ab)use function default values for creating variables:


Here are some examples of uses:

let f= (a,b=a+1)->b
f(5) // 6

let f= a=Math.rand()->a
f() // 0.8757450950797647

Use Functionized Operators and Bonding

This is a simple one. If you have anything like:


or any similar operation. You can shorten using functionized operators + bonding:


Use the mapping operator

The => maps LHS to RHS, due to it's precedence, this also means you can use it with ranges and use it multiple times:



a=>f=>g           // This is equivilant to...
(a).map(f).map(g) // this

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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