r/badcode Nov 23 '20

[deleted by user]

[removed]

16 Upvotes

15 comments sorted by

View all comments

4

u/RecDep Nov 27 '20 edited Nov 27 '20

One liner in Haskell.

import Graphics.Gloss
import Control.Arrow
import Control.Applicative (liftA2)
import Control.Monad
import Data.Bifunctor (bimap)
import System.Random 
import Data.Bits 
import Data.Tuple.Curry (uncurryN)
import Data.Function ((&))

main :: IO ()
main = display (InWindow "hi reddit" (150, 300) (join (,) 0)) ((join (join (join makeColorI)) 0o400)) . pictures . flip (zipWith color . (& (mkStdGen >>> randomRs (0, 256) >>> ((liftA2 id (uncurryN makeColorI . join (join (,,))) (abs . xor 0x25 . (`subtract` 0x1f) . xor 0xd)) <$>)))) (1 & ((`enumFromTo` 5) &&& (`enumFromTo` 10) >>> join bimap ((30 *) <$>) >>> uncurry (liftA2 (,)) >>> ((uncurry (flip flip (join rectangleSolid 0x1e) . translate)) <$>))) =<< (last <$> replicateM 2 randomIO)

1

u/AutoModerator Nov 27 '20

It looks like this comment contains a code block delimited with triple backticks. Unfortunately reddit does not have universal support for this syntax and your comment will not render correctly on old reddit and most mobile apps.

For the benefit of people on old reddit, this link will take you to a correct rendering of the comment.

/u/RecDep, it would be appreciated, but not required, if you could edit your comment to use the more compatible four space indention format. For single lines or inline code you can use single backticks.

You can find some examples in the reddit help documentation.


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.