Skip to main content
added 91 characters in body
Source Link
Emigna
  • 53k
  • 5
  • 43
  • 162

05AB1E, 25 bytes

0¸«¥X;D"+(ÿ±ÿ)*("ý¹g<')×J

Try it online!

Explanation

0¸«                        # prepend a 0 to input list
   ¥                       # calculate delta's
    X;D                    # push 0.5 twice
       "+(ÿ±ÿ)*("          # push this string and interpolate 0.5 where "ÿ" is
                 ý         # merge the list of delta's with this string as a separator
                  ¹g<')×J  # add the closing parenthesis

Might be shorter to buildBuilding the expression from the right.
Need to have a look unfortunately ends up at that the same byte count with
0¸«¥¤s¨RvX;Dy"ÿ+(ÿ±ÿ)*(ÿ). The 8 bytes used for the setup is the big waste here.

05AB1E, 25 bytes

0¸«¥X;D"+(ÿ±ÿ)*("ý¹g<')×J

Try it online!

Explanation

0¸«                        # prepend a 0 to input list
   ¥                       # calculate delta's
    X;D                    # push 0.5 twice
       "+(ÿ±ÿ)*("          # push this string and interpolate 0.5 where "ÿ" is
                 ý         # merge the list of delta's with this string as a separator
                  ¹g<')×J  # add the closing parenthesis

Might be shorter to build the expression from the right.
Need to have a look at that.

05AB1E, 25 bytes

0¸«¥X;D"+(ÿ±ÿ)*("ý¹g<')×J

Try it online!

Explanation

0¸«                        # prepend a 0 to input list
   ¥                       # calculate delta's
    X;D                    # push 0.5 twice
       "+(ÿ±ÿ)*("          # push this string and interpolate 0.5 where "ÿ" is
                 ý         # merge the list of delta's with this string as a separator
                  ¹g<')×J  # add the closing parenthesis

Building the expression from the right unfortunately ends up at that the same byte count with
0¸«¥¤s¨RvX;Dy"ÿ+(ÿ±ÿ)*(ÿ). The 8 bytes used for the setup is the big waste here.

Source Link
Emigna
  • 53k
  • 5
  • 43
  • 162

05AB1E, 25 bytes

0¸«¥X;D"+(ÿ±ÿ)*("ý¹g<')×J

Try it online!

Explanation

0¸«                        # prepend a 0 to input list
   ¥                       # calculate delta's
    X;D                    # push 0.5 twice
       "+(ÿ±ÿ)*("          # push this string and interpolate 0.5 where "ÿ" is
                 ý         # merge the list of delta's with this string as a separator
                  ¹g<')×J  # add the closing parenthesis

Might be shorter to build the expression from the right.
Need to have a look at that.