Skip to main content

Timeline for Finding Local Extremes

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
Feb 27, 2014 at 14:04 comment added undergroundmonorail @wrz I can't figure out how to edit a comment that's already been edited (the pencil icon seems to replace the edit button. is this by design?). I just wanted to add that, if I was smart, I'd have realized that my one-line function didn't need the \n in the declaration at all! That would have saved two characters, but the inclusion of return still makes it not worth it.
Feb 27, 2014 at 14:00 history edited undergroundmonorail CC BY-SA 3.0
Implemented suggestions from commenters
Feb 27, 2014 at 13:53 comment added undergroundmonorail @v-x Oh, I like that a lot. Thank you :) edit: Actually you can save more than that! Since (l[i]-l[i-1])*(l[i]-l[i+1]) is 1 if l[i] is a local extreme and 0 otherwise, I don't need to use >0. I can just let python interpret it as a bool. :)
Feb 27, 2014 at 13:53 comment added undergroundmonorail @wrz Ah, you're right. I was thrown off by the fact that def e(l):\n is the same number of characters as e=lambda l:, but I forgot that you don't need to use the return keyword. Thanks!
Feb 27, 2014 at 13:25 comment added V-X if(l[i]-l[i-1])*(l[i]-l[i+1])>0 would reduce the code by 11 characters...
Feb 26, 2014 at 23:15 history edited Victor Stafusa CC BY-SA 3.0
Syntax coloring
Feb 26, 2014 at 22:10 history answered undergroundmonorail CC BY-SA 3.0