Open
Description
I have code like this:
collatzStep :: Integer -> Integer
collatzStep = (x) => (Math.mod(x, 2) != 0 ? 3 * x + 1 : toInteger(x / 2))
collatz :: Integer -> List Integer
collatz = (step) => (step == 1 ? [1] : [step, ...collatz(collatzStep(step))])
And if possible I'd like for the auto-formatter to make it look like this instead:
collatzStep :: Integer -> Integer
collatzStep = (x) => (
Math.mod(x, 2) != 0
? 3 * x + 1
: toInteger(x / 2)
)
collatz :: Integer -> List Integer
collatz = (step) => (
step == 1
? [1]
: [step, ...collatz(collatzStep(step))]
)
I'm open on the indent part, because that can make for nested nested nested ternaries looking extra crazy. (Though usually nested nested nested ternaries are a codesmell)
Metadata
Metadata
Assignees
Labels
No labels