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 Revisions

2 of 2
Commonmark migration

05AB1E, 13 bytes

ÅAIÅ»+;}θ‚ÂÆa

Outputs as a triplet [mean, progressive-mean, trend].

Try it online or verify all test cases.

Explanation:

ÅA # Calculate the arithmetic mean of the (implicit) input-list
I # Push the input-list again
 Å» # Left-reduce it by:
 + # Add the two values together
 ; # And halve it
 }θ # After the reduction, leave only the last value
‚ # Pair it with the earlier calculated arithmetic mean
 Â # Bifurcate this pair; short for Duplicate & Reverse copy
 Æ # Reduce it by subtraction
 a # And append this trend to the pair
 # (after which the result is output implicitly)
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

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