What about the following? ( '()',')(' ) stringreplace|. '1 + (2 * 3) + (4 * (5 + 6))' ((6 + 5) * 4) + (3 * 2) + 1
On Fri, Dec 18, 2020 at 1:21 PM 'Michael Day' via Programming < programm...@jsoftware.com> wrote: > Unlike in the K forum, the J-wires have been virtually silent on this > year's Advent of Code... > > Anyway, today's problem, number 18, might interest J & APLers as part > 1 is ALMOST > plug-it-in to J/APL; there's just one twist, so to speak, namely we > need to reverse an > arithmetic expression, eg > 1 + (2 * 3) + (4 * (5 + 6)) > needs to be evaluated as > ((6 + 5) * 4) + (3 * 2) + 1 > > -- (B=) <-----my sig Brian Schott ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm