Hacker News new | ask | show | jobs
by asimpletune 244 days ago
Functions can accept/return multiple values though?

// In typescript const [a, b, c] = foo(d, e, f)

You could even pass this to itself

foo(…foo(d, e, f))

Also one definition of a function is a map from a domain to a range. There’s nothing that forbids multiple values, or is there?

1 comments

The range can be a product type, as can the domain. Most languages are expressive enough that you can create the product type (struct). You're right on point.