« first day (141 days earlier)      last day (1822 days later) » 

6:29 AM
18
Q: Repeat after me!

Super ChafouinGiven a string as argument, output the length of the longest(s) non-overlapping repeated substring(s) or zero if there is no such string. You can assume the input string is not empty. Examples abcdefabc : the substring abc is repeated at positions 1 and 7, so the program should output 3 abcab...

That question has no Haskell answer yet.
I'd be interested to see what people come up with.
 
7:16 AM
Well here's my answer. Hopefully people can beat that.
 
 
5 hours later…
12:17 PM
@BMO I think this particular find is interesting enough to warrant an answer. Do you want to write it up?
 
BMO
12:46 PM
@Laikoni: I agree, but I think it should be yours to post.
 
 
2 hours later…
2:31 PM
@BMO Ok, posted.
 
BMO
3:18 PM
Thx, for mentioning me :)
 
 
2 hours later…
BMO
5:05 PM
TIL Haskell allows record syntax with multiple constructors o.O
This just feels horrible..
It looks so innocent and I just checked -Wall doesn't even give a warning.
 
5:40 PM
@BMO It throws an exception No match in record selector partial1
 
BMO
That's what I mean, it fails at runtime without giving a warning
The equivalent gives a compiler warning and you can tell that it's a partial function..
Well, now I can tell for the other one as well :)
 
Ah, now I see what you mean.
Yeah, warning would be nice in such a case.
 
BMO
I guess they didn't think anyone would be so stupid to do this, hehe
 
BMO
6:00 PM
Actually maybe it could make a bit sense, in certain cases: Try it online!
But I'd probably write partial1 explicitly in that case, not sure
 
6:16 PM
Is there a better way to do fromInteger.toInteger?
Ah its called fromIntegral
 
 
2 hours later…
BMO
7:47 PM
@WheatWizard: Maybe read.show could work as mentioned in this tip?
(or rather the comment below)
 
Oh yeah, that could work
 

« first day (141 days earlier)      last day (1822 days later) »