Scala Programming Language
  1. Scala Programming Language
  2. SI-5073

Partial application of curried functions using infix

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: Scala 2.9.0-1, Scala 2.9.1
    • Fix Version/s: None
    • Component/s: Misc Compiler
    • Labels:

      Description

      We get a compiler error when trying to partially apply a /: (left fold)

      def f(xs: List[Int]) = (0 /: xs) _

      <console>:15: error: missing arguments for method /: in trait TraversableOnce;
      follow this method with `_' if you want to treat it as a partially applied function

      Here are some workarounds:

      def f(xs: List[Int]) = xs.foldLeft(0) _
      def f(xs: List[Int]) = xs./:(0) _
      def f(xs: List[Int]): ((Int, Int) => Int) => Int = (0 /: xs)

      http://stackoverflow.com/q/7735736/770361

        Issue Links

          Activity

          Hide
          Paul Phillips added a comment -

          This is essentially a duplicate of SI-1980 because they're both caused by the odd desugaring performed on right associative operations. Maybe I can get both.

          Show
          Paul Phillips added a comment - This is essentially a duplicate of SI-1980 because they're both caused by the odd desugaring performed on right associative operations. Maybe I can get both.

            People

            • Assignee:
              Unassigned
              Reporter:
              Luigi Plinge
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development