3 ms·
This challenge is the first real life program I wrote with Haskell. https://github.com/Mgccl/mgccl-haskell/blob/master/random/unshredder.hs https://github.com/
by Mgccl 15y ago
This challenge is the first real life program I wrote with Haskell.
https://github.com/Mgccl/mgccl-haskell/blob/master/random/unshredder.hs https://github.com/Mgccl/mgccl-haskell/blob/master/random/un...
(so it seems I don't like to specify the type of my functions...)
Explanation is here: http://chaoxuprime.com/2011/11/a-solution-to-Instagram-engineering-challenge-the-unshredder-in-haskell http://chaoxuprime.com/2011/11/a-solution-to-Instagram-engin...
- tikhonj 15y agoHeh, I did the same thing. It took me much too long to figure out that I needed to call ilInit...
- nandemo 15y agoVery nice. Care for some unsolicited hlint-like suggestions? Why not simply this: img <- readImage "file.png" -- instead of this? t <- readImage "file.png" let img = t Why not this: map (y!!) x foldr ((:).(y!!)) [] x -- instead of this? Note that a way of reading fold g [] is that replaces the list constructor (:) (aka cons) with g. So (:) as argument of fold is probably not idiomatic, since foldr (:) [] is the same as id.
- Mgccl 15y agoThanks. hlint-like suggestions are always welcome. I have no idea what was in my mind when I wrote foldr ((:).(y!!)) [] x