Skip to main content

Timeline for Find the maximum operation

Current License: CC BY-SA 3.0

28 events
when toggle format what by license comment
Aug 30, 2014 at 19:17 history edited ThreeFx CC BY-SA 3.0
deleted 24 characters in body
Aug 30, 2014 at 19:07 history edited ThreeFx CC BY-SA 3.0
deleted 2 characters in body
Aug 30, 2014 at 18:56 comment added proud haskeller @TreeFx shouldn't the example be [2,1,4]?
Aug 30, 2014 at 18:54 comment added proud haskeller @ThreeFx my tips for this version: make h infix. Use a>0 instead of a==1. You should swap the order of the definitions of h, which allowed you to replace [] with _ and this will enable you to use remove the -1 from lengh x-1, unless i'm mistaken.
Aug 30, 2014 at 18:46 comment added proud haskeller The best i could think of instead of your sequence trick is iterate(>>= \x->[0:x,1:x])!!lengh x but yours is shorter. Nice!
Aug 30, 2014 at 18:19 comment added proud haskeller Nice use of sequence!
Aug 30, 2014 at 15:21 history edited ThreeFx CC BY-SA 3.0
added 8 characters in body
Aug 30, 2014 at 15:21 comment added ThreeFx @Brilliand Fixed.
Aug 30, 2014 at 15:14 history edited ThreeFx CC BY-SA 3.0
deleted 14 characters in body
Aug 30, 2014 at 14:19 history edited ThreeFx CC BY-SA 3.0
deleted 512 characters in body
Aug 30, 2014 at 14:10 history rollback ThreeFx
Rollback to Revision 7
Aug 30, 2014 at 14:04 history edited ThreeFx CC BY-SA 3.0
deleted 66 characters in body
Aug 30, 2014 at 6:22 comment added ThreeFx @proudhaskeller The problem is that I realised that it is broken and fist of all I want to fix that
Aug 30, 2014 at 0:48 comment added proud haskeller @ThreeFx just realized that you could redefine f this way: f=r.tail.group.sort.map abs.(0:). This works by making sure the list has a 0 by adding 0 to it, and ignoring the first group which must be all zeros instead of using filter(/=0).
Aug 30, 2014 at 0:40 comment added proud haskeller @ThreeFx i see there that you didn't use all my tips, was i not clear enough?
Aug 29, 2014 at 20:58 comment added ThreeFx @Brilliand Yes, I realised too, I will see what I can do.
Aug 29, 2014 at 20:56 comment added Brilliand Your algorithm gives the wrong answer for [3,3,3,2,2,2,1,1,1]. I ran your code, and it returns 216 (the largest result I was able to come up with was 729).
Aug 29, 2014 at 20:38 history edited ThreeFx CC BY-SA 3.0
added 23 characters in body
Aug 29, 2014 at 18:48 comment added proud haskeller my advice for golfing this - 1) inline every function that is used just once (unless it uses pattern matching or guards). 2) you can implement d as d n=[0,2,1]!!n or d n=mod(3-n)3. 3) make o and g take the length of the list instead of taking the list itself, as they only depend on the length (obviously this stands only as long as they aren't inlined). 4) replace otherwise with 0<1. 5) make the last definition of r be r$o x:y. 6) remove the a@ and replace a with x:y. good luck with your golfing!
Aug 29, 2014 at 17:13 comment added ThreeFx @proudhaskeller I had no idea how to brute force this so I had to come up with something else :D
Aug 29, 2014 at 16:39 history edited ThreeFx CC BY-SA 3.0
added 144 characters in body
Aug 29, 2014 at 16:31 comment added proud haskeller can you please write newlines instead of ; when possible? it doesn't change the byte count but helps the readability troumendously
Aug 29, 2014 at 16:31 history edited ThreeFx CC BY-SA 3.0
added 144 characters in body
Aug 29, 2014 at 16:26 history edited ThreeFx CC BY-SA 3.0
added 144 characters in body
Aug 29, 2014 at 16:02 history edited ThreeFx CC BY-SA 3.0
edited body
Aug 29, 2014 at 16:01 comment added proud haskeller this seems like quite a performance-driven solution.
Aug 29, 2014 at 15:53 history edited ThreeFx CC BY-SA 3.0
added 890 characters in body
Aug 29, 2014 at 15:40 history answered ThreeFx CC BY-SA 3.0