Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Feature request: Anonymous functions #69

Open
tealeg opened this issue May 9, 2024 · 0 comments
Open

Feature request: Anonymous functions #69

tealeg opened this issue May 9, 2024 · 0 comments

Comments

@tealeg
Copy link

tealeg commented May 9, 2024

Commit: f2107d4

Currently, one must always name a function when defining it, but in the case where we wish to return a function from within a function (or otherwise utilse first class functions) this is inelegant.

Consider the following definition (which will get through codegen, but won't compile - see #68 )

fun areaOfCircle(pie: f64) -> fun(f64) -> f64 {
  fun f(r: f64) -> f64 {
    return pie * (r * r)
  }
  return f
}

Ideally it would look like this:

fun areaOfCircle(pie: f64) -> fun(f64) -> f64 {
  return fun (r: f64) -> f64 {
    return pie * (r * r)
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant