Samuel
06/21/2025, 7:30 PMval (a, b) = if (s) (true, "actual ") else (false, "deny ")
I mean I guess I could use listOf
but is there a better way?
EDIT: Ohhh Pair
is what I should be using it seemsStephan Schröder
06/21/2025, 8:44 PMPair
is the idiomatic thing to use.
but don't write Pair(true, "actual ")
but true to "actual "
to is an infix function returning a instance of Pair 🤓Samuel
06/21/2025, 8:51 PMSamuel
06/21/2025, 8:51 PMloke
06/23/2025, 5:12 AMto
should only be used where there is a relation between them (as in a key/value relationship). If the two values are, for example, the width and height of a rectangle, 2.5 to 9.9
doesn't make sense.hho
06/23/2025, 9:14 AMto
is mostly for map literals.
I think the Pair
constructor is fine.loke
06/23/2025, 9:41 AMto
literally compiles down to a call to Pair()
anyway, so there is no technical difference other than style.Stephan Schröder
06/23/2025, 8:11 PMto
uses 4 chars (don't forget the 2 spaces),
Pair(, )
uses 8 chars!loke
06/24/2025, 5:49 AMloke
06/24/2025, 5:49 AMPair(x,y)
. 🙂loke
06/24/2025, 8:27 AM≡∘⌽
Stephan Schröder
06/24/2025, 6:41 PM