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

Timeline for Calculate all the squares up to x using only addition and subtraction

Current License: CC BY-SA 4.0

10 events
when toggle format what by license comment
S Mar 28, 2024 at 15:52 history suggested Kai Burghardt CC BY-SA 4.0
meanwhile math formulas can be rendered by the site [no pre‐rendered external images necessary anymore], use short URL format for site‐internal URLs
Mar 28, 2024 at 13:30 review Suggested edits
S Mar 28, 2024 at 15:52
Apr 13, 2017 at 12:39 history edited Community Bot
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Mar 21, 2014 at 17:26 history edited Heiko Oberdiek CC BY-SA 3.0
"shift" replaced by "pop"
Mar 21, 2014 at 17:00 comment added skibrianski And you can save another 2 chars by using pop() instead of shift() since there's only one argument.
Mar 21, 2014 at 16:57 comment added skibrianski Right, but that's on the caller. There are entries in other languages that define anonymous subs, so I think you're safe =)
Mar 21, 2014 at 12:06 history edited Heiko Oberdiek CC BY-SA 3.0
Making it an anonymous function.
Mar 21, 2014 at 12:05 comment added Heiko Oberdiek @skibrianski: An anonymous function is also a function. The downside is that the calling of the function is a little more cumbersome.
Mar 19, 2014 at 18:14 comment added skibrianski I see no reason why you need to name your sub. IOW "sub{map{$a+=$_+$_-1}1..shift}" seems legit to me, and saves you two chars.
Feb 25, 2014 at 8:01 history answered Heiko Oberdiek CC BY-SA 3.0

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