Skip to main content
deleted 1 character in body
Source Link
randomra
  • 20.9k
  • 4
  • 46
  • 111

J, 23 22 chars

   (+/ .*&2 3 4 1@(+<./))

Example:

   test =. 3 5 4 3
   (+/ .*&2 3 4 1@(+<./)) test
70

Try it here.

(2423 long explicit function definition: v=:3 :'+/+/\.3&|3|.y+<./y')

J, 23 22 chars

   (+/ .*&2 3 4 1@(+<./))

Example:

   test =. 3 5 4 3
   (+/ .*&2 3 4 1@(+<./)) test
70

Try it here.

(24 long explicit function definition: v=:3 :'+/+/\.3&|.y+<./y')

J, 23 22 chars

   (+/ .*&2 3 4 1@(+<./))

Example:

   test =. 3 5 4 3
   (+/ .*&2 3 4 1@(+<./)) test
70

Try it here.

(23 long explicit function definition: v=:3 :'+/+/\.3|.y+<./y')

added 8 characters in body
Source Link
randomra
  • 20.9k
  • 4
  • 46
  • 111

J, 2323 22 chars

   (+/@(2 .*&2 3 4 1&*@1@(+<./)))

Example:

   test =. 3 5 4 3
   (+/@(2 .*&2 3 4 1&*@1@(+<./))) test
70

Try it here.

(24 long explicit function definition: v=:3 :'+/+/\.3&|.y+<./y')

J, 23 chars

   (+/@(2 3 4 1&*@(+<./)))

Example:

   test =. 3 5 4 3
   (+/@(2 3 4 1&*@(+<./))) test
70

Try it here.

(24 long explicit function definition: v=:3 :'+/+/\.3&|.y+<./y')

J, 23 22 chars

   (+/ .*&2 3 4 1@(+<./))

Example:

   test =. 3 5 4 3
   (+/ .*&2 3 4 1@(+<./)) test
70

Try it here.

(24 long explicit function definition: v=:3 :'+/+/\.3&|.y+<./y')

added 70 characters in body
Source Link
randomra
  • 20.9k
  • 4
  • 46
  • 111

J, 23 chars

   (+/@(2 3 4 1&*@(+<./)))

Example:

   test =. 3 5 4 3
   (+/@(2 3 4 1&*@(+<./))) test
70

Try it here.

(24 long explicit function definition: v=:3 :'+/+/\.3&|.y+<./y')

J, 23 chars

   (+/@(2 3 4 1&*@(+<./)))

Example:

   test =. 3 5 4 3
   (+/@(2 3 4 1&*@(+<./))) test
70

Try it here.

J, 23 chars

   (+/@(2 3 4 1&*@(+<./)))

Example:

   test =. 3 5 4 3
   (+/@(2 3 4 1&*@(+<./))) test
70

Try it here.

(24 long explicit function definition: v=:3 :'+/+/\.3&|.y+<./y')

Source Link
randomra
  • 20.9k
  • 4
  • 46
  • 111
Loading