Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 12 characters in body
Source Link
Etheryte
  • 3.9k
  • 2
  • 21
  • 26

Japt, 6(削除) 6 (削除ここまで) 5 bytes

As far as I know, Japt does not support taking functions as inputs, or at least I couldn't find a way that actually works. To sidestep this problem, I've moved the blackbox functions into the code header while excluding them from the byte count. Their definition or form is not important for the implementation itself. Hope this is valid, otherwise I don't think Japt can compete.

The functions are to be stored in AV and BW respectively.

NmAmV rBrW 
N mV // TakeMap the array of input numbers,
 mA  // map it through AV
 rBrW // then reduce the result with BW.

Try it online! Shaved off a byte thanks to Shaggy by taking the input as an array instead.

Try it online!

Japt, 6 bytes

As far as I know, Japt does not support taking functions as inputs, or at least I couldn't find a way that actually works. To sidestep this problem, I've moved the blackbox functions into the code header while excluding them from the byte count. Their definition or form is not important for the implementation itself. Hope this is valid, otherwise I don't think Japt can compete.

The functions are to be stored in A and B respectively.

NmA rB 
N  // Take the array of input numbers,
 mA  // map it through A
 rB // then reduce the result with B.

Try it online!

Japt, (削除) 6 (削除ここまで) 5 bytes

As far as I know, Japt does not support taking functions as inputs, or at least I couldn't find a way that actually works. To sidestep this problem, I've moved the blackbox functions into the code header while excluding them from the byte count. Their definition or form is not important for the implementation itself. Hope this is valid, otherwise I don't think Japt can compete.

The functions are to be stored in V and W respectively.

mV rW 
mV // Map the array of input numbers through V
 rW // then reduce the result with W.

Shaved off a byte thanks to Shaggy by taking the input as an array instead.

Try it online!

Source Link
Etheryte
  • 3.9k
  • 2
  • 21
  • 26

Japt, 6 bytes

As far as I know, Japt does not support taking functions as inputs, or at least I couldn't find a way that actually works. To sidestep this problem, I've moved the blackbox functions into the code header while excluding them from the byte count. Their definition or form is not important for the implementation itself. Hope this is valid, otherwise I don't think Japt can compete.

The functions are to be stored in A and B respectively.

NmA rB 
N // Take the array of input numbers,
 mA // map it through A
 rB // then reduce the result with B.

Try it online!

AltStyle によって変換されたページ (->オリジナル) /