Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8-beta-1
    • Fix Version/s: 1.8-beta-2
    • Component/s: None
    • Labels:
      None

      Description

      It would be useful to support something like F#'s compose '>>' operator for Closures, e.g.:

      def twice = { a -> a * 2 }
      def inc = { b -> b + 1 }
      def f = inc >> twice
      def g = { x -> twice(inc(x)) } // longhand equivalent
      assert f(10) == 22
      assert g(10) == 22
      
      def string2char = { it.chars[0] }
      def p = Integer.&toHexString >> string2char >> Character.&toUpperCase
      assert p(15) == 'F'
      
      def multiply = { a, b -> a * b }
      def identity = { a -> [a, a] }
      def sq = identity >> multiply
      assert (1..5).collect{ sq(it) } == [1, 4, 9, 16, 25]
      

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Paul King
            Reporter:
            Paul King
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development