Hacker News new | ask | show | jobs
by joomy 148 days ago
"fark" here takes two arguments, the first (the minuend) is in instrumental case (-le), the second (the subtrahend) is in genitive case (-in). Now, because of the suffixes of the cases, regardless of the order in which you give the arguments, the type system can figure out which one is supposed to be the minuend and which the subtrahend.

If it helps, you can think of it like named arguments where the name is inferred from the case.

2 comments

Essentially you could write equivalent code as (vähennä 5:ttä 3:lla) in Finnish
How do you express |a - b| ?
(bu tam-sayının) mutlak-değeri, (bunun 0'dan büyüklüğü) doğruysa, bu, değilse, bunun -1'le çarpımıdır.

(5'in mutlak-değerini) yaz.

(-5'in mutlak-değerini) yaz.

You can try it in the playground.