Stream: Beginner Questions

Topic: Functions output


view this post on Zulip Salvatore Francesco Rossetta (Jan 24 2024 at 08:43):

Hi, I have this example function

fun fnct :: " nat ⇒ nat ⇒ (nat × nat)" where
  "fnct x y = (
  let s = x+y;
  d = x-y in (s, d))"

If I don't want to use tuples, the only way to return objects is with a record, right? Or is it somehow possible to return more objects with functions? Something like this, I mean

fun fnct :: " nat ⇒ nat ⇒ (nat ⇒ nat)" where ...

view this post on Zulip Mathias Fleury (Jan 24 2024 at 09:18):

In general: record or datatype.


Last updated: Apr 28 2024 at 12:28 UTC