instance Monad m => Monad (Iteratee a m) where return x = yield x (Chunks ) m0 >>= f = ($ m0) $ fix $ \bind m -> Iteratee $ runIteratee m >>= \r1 -> case r1 of Continue k -> return (Continue (bind . k)) Error err -> return (Error err) Yield x (Chunks ) -> runIteratee (f x) Yield x extra -> runIteratee (f x) >>= \r2 -> case r2 of Continue k -> runIteratee (k extra) Error err -> return (Error err) Yield x' _ -> return (Yield x' extra)
Obviously “inspired” by this post on 4chan which has been making the rounds around hn and reddit and so on all day.
import Control.Monad import Control.Concurrent import Control.Concurrent.Chan import System.IO import System.Environment main = do nums <- fmap (map read) getArgs :: IO [Int] chan <- newChan forM_ nums $ \n -> forkIO $ do threadDelay (n * 100000) writeChan chan n replicateM (length nums) (readChan chan >>= print)
I have no idea who Richard Dreyfuss is, but it turns out he owns.
Lake Nyos, located in the Northwest Region of Cameroon, Africa, carried a folklore of danger, and tales were spoken of an evil spirit which emerged from the lake to kill all those who lived near it.
[…] Villages nearby the lake had almost no chance of survival, and in the nearby Nyos only six out of 800 survived. (Those that did survive usually did so by quickly escaping to higher ground on motorcycles.) […] every flame and fire was immediately extinguished, a sign of the doom descending all around Lake Nyos.
[…] Nearby villagers who came out of their houses to find out what the sound they had heard was […] fell dead at their doorsteps. People taking naps were killed without their relatives even realizing anything had happened
[…] In all, 1,746 people were killed. The villages of Nyos, Kam, Cha, and Subum were left all but wiped out. And, more than 3,500 livestock perished in a matter of minutes. The lake itself turned from a clear blue to a deep red
[…] Also worrying is nearby Lake Kivu, a lake over 1,000 times larger than Nyos and in a much more populous area, which has been shown to have a historical record of causing creatures in the lake to go extinct approximately every thousand years.” —Lake Nyos, Atlas Obscura
This was a good use of my time.
about what kind of pointless bullshit is going to appear in this space, if anything.
import Control.Monad.ST import Data.Char import Data.STRef import System.Environment import qualified Data.Map as M count s = runST $ go s M.empty >>= flatten where flatten = mapM readPair . M.toList readPair (c, ref) = readSTRef ref >>= \v -> return (c, v) go  acc = return acc go ((toUpper -> c):cs) acc | not (isAlpha c) = go cs acc | Just ref <- M.lookup c acc = readSTRef ref >>= (writeSTRef ref $!) . succ >> go cs acc | otherwise = newSTRef 1 >>= go cs . flip (M.insert c) acc main = do [file] <- getArgs text <- readFile file print (count text)
Those of you unfortunate enough not to be reading or hearing this in Marain may well be using a language without the requisite number or type of personal pronouns, so I’d better explain that bit of the translation.
Marain, the Culture’s quintessentially wonderful language (so the Culture will tell you), has, as any schoolkid knows, one personal pronoun to cover females, males, in-betweens, neuters, children, drones, Minds, other sentient machines, and every life-form capable of scraping together anything remotely resembling a nervous system and the rudiments of language (or a good excuse for not having either). Naturally, there are ways of specifying a person’s sex in Marain, but they’re not used in everyday conversation; in the archetypal language-as-moral-weapon-and-proud-of-it, the message is that it’s brains that matter, kids; gonads are hardly worth making a distinction over.
So, in what follows, Gurgeh is quite happily thinking about the Azadians just as he’d think about any other (see list above)… But what of you, O unlucky, possibly brutish, probably ephemeral and undoubtedly disadvantaged citizen of some unCultured society, especially those unfairly (and the Azadians would say under-) endowed with only the mean number of genders?!
How shall we refer to the triumvirate of Azadian sexes without resorting to funny-looking alien terms or gratingly awkward phrases not-words?
… Rest at ease; I have chosen to use the natural and obvious pronouns for male and female, and to represent the intermediates - or apices - with whatever pronominal term best indicates their place in their society, relative to the existing sexual power-balance of yours. In other words, the precise translation depends on whether your own civilisation (for let us err on the side of terminological generosity) is male or female dominated.
(Those which can fairly claim to be neither will of course have their own suitable term.)
Anyway, enough of that.” —Iain M. Banks, The Player of Games