Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 5142 days ago | link | parent

Yeah it's an interesting question: Does currying help write programs much smaller than []?

I find myself rephrasing the question as: do we want special syntax for [] when _ occurs only in final position? Did you want something more powerful?

Hey, is your define-partial example correct? I think it should evaluate to

  (t t nil nil nil)
Am I misunderstanding your proposal?


2 points by d0m 5142 days ago | link

wops, the second example should evaluate to (t t nil nil nil)

I thought about making [] more powerful.. but I can't find a way to do it the "arc way".

What I am proposing is: instead of creating a special construct for currying, why not make a convention that all arc functions be currying?

so simply: (< 2) evaluate to [< 2 _] .. No special suggar, just by convention.

And for the cases where we want more powerful currying technics, we can still use the [] syntax.

I.e.: [> _ 2]

-----

1 point by akkartik 5142 days ago | link

I'm sorry, I think I understand what you want, but the examples still aren't making sense:

You originally:

  (map (> 2) '(1 2 3 4 5)) -> (nil nil t t t)

  (map [> _ 2] '(1 2 3 4 5)) -> (nil nil t t t)
My response:

  (map (> 2) '(1 2 3 4 5)) -> (t t nil nil nil)

  (map [> _ 2] '(1 2 3 4 5)) -> (nil nil t t t)
Your response is this, am I right?

  (map (> 2) '(1 2 3 4 5)) -> (nil nil t t t)

  (map [> _ 2] '(1 2 3 4 5)) -> (t t nil nil nil)
But now both seem wrong. You used '<' sometimes; do you mean to use '<' everywhere?

Feel free to edit the original post to make the discussion clearer.

-----

1 point by d0m 5141 days ago | link

What I meant by "second example" was the "second map example". How can I edit the main post?

-----

1 point by akkartik 5141 days ago | link

Perhaps I see edit links longer because PG let me kill spam posts a while ago (they still time out eventually). Feel free to mail me the new version and I'll update the story (email in profile).

Update: Edit link is now gone.

-----