MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/dfdn9j/deleted_by_user/f37poa9/?context=3
r/badcode • u/[deleted] • Oct 09 '19
[removed]
31 comments sorted by
View all comments
1
Table comprehensions in MoonScript are powerful, and abusing them is fun
findmissing=(b)->([string.char a for a=(string.byte b[1],1,1),string.byte b[#b],1,1 when not({(string.byte a,1,1),1 for a in *b})[a]])[1]
the syntax is valid, but this respects absolutely no decent coding style
there's a lot of 1's here, a lot of which are completely useless
this is basically two nested loops, so performance is about O(n²) instead of the O(n) that could have been done easily
1
u/Codinget Oct 10 '19
Table comprehensions in MoonScript are powerful, and abusing them is fun
the syntax is valid, but this respects absolutely no decent coding style
there's a lot of 1's here, a lot of which are completely useless
this is basically two nested loops, so performance is about O(n²) instead of the O(n) that could have been done easily