Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial Application Discussion #12

Open
weswigham opened this issue Mar 6, 2014 · 1 comment
Open

Partial Application Discussion #12

weswigham opened this issue Mar 6, 2014 · 1 comment
Labels

Comments

@weswigham
Copy link
Contributor

Let's talk about syntax for partial application of functions. Blame Steve. I disagree with Steve entirely, and believe it should be square brackets - and that the operation should potentially be over-loadable on a per-function basis via a meta-function.

thingy(x,y,z)
#Can be (fully) partially applied as
thingy[x][y][z]

This makes it very clear when you partially apply a tuple argument without the need for further grouping symbols.

thingy2((x,y),z)
#Can be (fully) partially applied as
thingy2[x,y][z]

I think this is sensible - especially if tuples are implicit during declaration or return without grouping symbols, for example:

T -> J -> (T, J)
fn thingy(x, y)
    x, y

fn letter
    let | x = 23, 24
    thingy2[x](25)
@toroidal-code
Copy link
Member

Tuples are probably not going to be implicitly defined on either LHS or RHS.

So far it's

fn thingy(x, y)
  (x, y)
end

fn letter
  let x = (23, 24) in
    thingy2[x](25)
 end
end

fn other_letter(some_tuple)
  let (x, y) = some_tuple in
    x
  end
end

fn another_letter(some_vector)
  let [x, y] = some_vector in
    y
  end
end

This way we can use the destructuring rules in the grammar for both let forms and pattern matches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants