Arc Forumnew | comments | leaders | submitlogin
6 points by pg 5924 days ago | link | parent

Surely it would lead to all sorts of problems if you didn't use distinctive syntax. When you passed too few arguments to a fn, instead of generating an error, it would just yield a curried version.

Or is this one of those things (like defmacro in a Lisp1) that sounds like it would lead to problems, but doesn't in practice?



6 points by drcode 5924 days ago | link

According to your essays, a major paradigm of arc is to let hackers do as much as possible, without giving errors when the compiler is worried things are "too dangerous". Partial application/function currying is my #1 request for arc right now... I would love it if any arc function given too few non-optional parameters would perform an implicit curry.

-----

7 points by almkglor 5924 days ago | link

Incidentally, [...] syntax helps amortize the problem of non-existent curry: curried (map fn) == [map fn _]

Adding curry support will also require us to define flipped parameters, i.e.

  (def flip (f x y)
    (f y x))
Or better:

  (mac flip ( (f x . ys) )
    (if
      (no ys)
        (w/uniq p
          `(fn (,p) (,f ,p ,x)))
      (is 1 (len ys))
        `(,f ,(car ys) ,x)
        (ero "flip: more than two parameters in call")))
which allows us to use:

  (flip:map seq)

-----

2 points by binx 5924 days ago | link

When parameters are too many, for example, in:

(def f (x) (fn (y) (g x y)))

According to currying, (f x y) should mean ((f x) y). This feature can't be expressed by [...] syntax.

-----

4 points by almkglor 5924 days ago | link

http://www.google.com/search?q=define%3Aamortize

I didn't say it completely eliminates the need for currying - I said it "amortizes" or PARTLY eliminates the need.

-----

8 points by binx 5924 days ago | link

In haskell and all ML children, when you pass too few arguments to a fn, it would just yield a curried version. Of course, they have static type systems to reduce errors caused by passing too few arguments. but I guess Arc's goal is to be good for quick prototyping, not good at elimating run-time errors...

-----

8 points by pg 5924 days ago | link

Ah, so that's what people mean when they say that in Haskell, the Curry is implicit.

-----

3 points by lojic 5924 days ago | link

That is one of the features of Haskell I really like. I'm not sure of all the implications for attempting it with Arc, but if it's possible to do it well, I think it's worth the research.

-----

3 points by binx 5924 days ago | link

In addition, a whole-program flow analyzer can find most of such bugs in a dynamically-typed language.

-----