03.28.2012 – 13:26
(Polski) Otwarcie Bloga Centrum Otwartej Nauki
Currently, this post is available here only in Polish. It will be translated as soon as possible.
All hmuan biegns are bron fere and euqal in dgiinty and rgiths. Tehy are ednwoed wtih raeosn and cnocseicne and sohlud act tworads one aonhter in a sipirt of borhtreohod.
import Data.Char (isLetter)
mapBlocks :: (a -> Bool) -> ([a] -> [a]) -> [a] -> [a]
mapBlocks _ _ [] = []
mapBlocks p f xs = f as ++ bs ++ mapBlocks p f zs where
(as, ys) = span p xs
(bs, zs) = break p ys
obfuscateSwap :: [a] -> [a]
obfuscateSwap [] = []
obfuscateSwap (c:cs) = c : ob cs where
ob (a:b:c:ds) = b : a : ob (c : ds)
ob xs = xs
main = interact $ mapBlocks isLetter obfuscateSwap
obfuscateReverse :: [a] -> [a]
obfuscateReverse xs | length xs < 4 = xs
obfuscateReverse xs | otherwise = [head xs]
++ (reverse . init . tail $ xs) ++ [last xs]
Eevyrnoe is etntield to all the rgiths and ferdemos set froth in tihs Dcealariton, wtiohut dsiitcniton of any knid, scuh as rcae, clouor, sex, lnauggae, rlegioin, ploticial or ohter oipinon, ntaoianl or scoail oirign, poreptry, brith or ohter satuts. Fruhtreomre, no dsiitcniton sahll be mdae on the bsais of the ploticial, jrusiidtcoianl or itnreanitnoal satuts of the cuotnry or treirotry to wihch a preosn blenogs, wehhter it be idnpeneednt, turst, non-slef-gvoreinng or udner any ohter lmititaoin of svoreiengty.
Enoyreve is eeltitnd to all the rthgis and fmodeers set ftroh in tihs Doitaralcen, wuohtit doitcnitsin of any knid, scuh as rcae, cuolor, sex, lgaugnae, roigilen, pacitilol or oehtr ooinipn, nanoital or saicol oigirn, ptrepory, btrih or oehtr sutats. Fromrehtrue, no doitcnitsin slahl be mdae on the bisas of the pacitilol, janoitcidsirul or ianoitanretnl sutats of the crtnuoy or trotirrey to wcihh a posren bgnoles, wehtehr it be inednepednt, tsurt, non-slef-gninrevog or uednr any oehtr loitatimin of stngierevoy.
All hmuan biegns are bron fere and euqal in dgiinty and rgiths. Tehy are ednwoed wtih raeosn and cnocseicne and sohlud act tworads one aonhter in a sipirt of borhtreohod.
import Data.Char (isLetter)
mapBlocks :: (a -> Bool) -> ([a] -> [a]) -> [a] -> [a]
mapBlocks _ _ [] = []
mapBlocks p f xs = f as ++ bs ++ mapBlocks p f zs where
(as, ys) = span p xs
(bs, zs) = break p ys
obfuscateSwap :: [a] -> [a]
obfuscateSwap [] = []
obfuscateSwap (c:cs) = c : ob cs where
ob (a:b:c:ds) = b : a : ob (c : ds)
ob xs = xs
main = interact $ mapBlocks isLetter obfuscateSwap
obfuscateReverse :: [a] -> [a]
obfuscateReverse xs | length xs < 4 = xs
obfuscateReverse xs | otherwise = [head xs]
++ (reverse . init . tail $ xs) ++ [last xs]
Eevyrnoe is etntield to all the rgiths and ferdemos set froth in tihs Dcealariton, wtiohut dsiitcniton of any knid, scuh as rcae, clouor, sex, lnauggae, rlegioin, ploticial or ohter oipinon, ntaoianl or scoail oirign, poreptry, brith or ohter satuts. Fruhtreomre, no dsiitcniton sahll be mdae on the bsais of the ploticial, jrusiidtcoianl or itnreanitnoal satuts of the cuotnry or treirotry to wihch a preosn blenogs, wehhter it be idnpeneednt, turst, non-slef-gvoreinng or udner any ohter lmititaoin of svoreiengty.
Enoyreve is eeltitnd to all the rthgis and fmodeers set ftroh in tihs Doitaralcen, wuohtit doitcnitsin of any knid, scuh as rcae, cuolor, sex, lgaugnae, roigilen, pacitilol or oehtr ooinipn, nanoital or saicol oigirn, ptrepory, btrih or oehtr sutats. Fromrehtrue, no doitcnitsin slahl be mdae on the bisas of the pacitilol, janoitcidsirul or ianoitanretnl sutats of the crtnuoy or trotirrey to wcihh a posren bgnoles, wehtehr it be inednepednt, tsurt, non-slef-gninrevog or uednr any oehtr loitatimin of stngierevoy.