Environmental awareness as part of algorithmic accountability
arxiv.org2 pointsby m0nastic1 comments
To begin at the beginning:
It is Spring, moonless night in the small town, starless and bible-
black, the cobblestreets silent and the hunched, courters'-and-
rabbits' wood limping invisible down to the sloeblack, slow, black,
crowblack, fishingboat-bobbing sea.
The houses are blind as moles (though moles see fine to-night in the
snouting, velvet dingles) or blind as Captain Cat there in the muffled
middle by the pump and the town clock, the shops in mourning, the
Welfare Hall in widows' weeds. And all the people of the lulled and
dumbfound town are sleeping now.
Hush, the babies are sleeping, the farmers, the fishers, the tradesmen
and pensioners, cobbler, schoolteacher, postman and publican, the
undertaker and the fancy woman, drunkard, dressmaker, preacher, \
policeman, the webfoot cocklewomen and the tidy wives. Young girls lie
bedded soft or glide in their dreams, with rings and trousseaux,
bridesmaided by glow-worms down the aisles of the organplaying wood.
The boys are dreaming wicked or of the bucking ranches of the night and
the jollyrogered sea. And the anthracite statues of the horses sleep in
the fields, and the cows in the byres, and the dogs in the wet-nosed
yards; and the cats nap in the slant corners or lope sly, streaking and
needling, on the one cloud of the roofs.
You can hear the dew falling, and the hushed town breathing.
Only your eyes are unclosed to see the black and folded town fast, and slow, asleep.
And you alone can hear the invisible starfall, the darkest-before- dawn
minutely dewgrazed stir of the black, dab-filled sea where the
Arethusa, the Curlew and the Skylark, Zanzibar, Rhiannon, the Rover,
the Cormorant, and the Star of Wales tilt and ride.
Listen. It is night moving in the streets, the processional salt slow
musical wind in Coronation Street and Cockle Row, it is the grass
growing on Llareggub Hill, dewfall, starfall, the sleep of birds in
Milk Wood.
Listen. It is night in the chill, squat chapel, hymning in bonnet and
brooch and bombazine black, butterfly choker and bootlace bow, coughing
like nannygoats, suckling mintoes, fortywinking hallelujah; night in
the four-ale, quiet as a domino; in Ocky Milkman's lofts like a mouse
with gloves; in Dai Bread's bakery flying like black flour.
It is to-night in Donkey Street, trotting silent, with seaweed on its
hooves, along the cockled cobbles, past curtained fernpot, text and
trinket, harmonium, holy dresser, watercolours done by hand, china dog
and rosy tin teacaddy. It is night neddying among the snuggeries of
babies. qsort [] = []
This means that if you hand the qsort function an empty list, you get an empty list ([] is the empty list in Haskell). qsort (x:xs) = qsort smaller ++ [x] ++ qsort larger
Ok, so this means that we are making a list out of three parts: (qsort smaller, x, and qsort larger). The '++' operator is just concatenation. where
smaller = [a | a <- xs, a <= x]
larger = [b | b <- xs, b > x]
Here we're defining what "smaller" and "larger" are. They're list comprehensions. "Smaller" returns a list that is made up of pulling out all the numbers that are less than or equal to x. "Larger" pulls out all the numbers that are greater than x. Then it does it again. qsort [3, 5, 1, 4, 2]
= {applying qsort}
qsort [1, 2] ++ [3] ++ [5, 4]
= {applying qsort}
(qsort [] ++ [1] ++ qsort [2]) ++ [3] ++ (qsort [4] ++ [5] ++ qsort[])
= {applying qsort}
([] ++ [1] ++ [2]) ++ [3] ++ ([4] ++ [5] ++ [])
= {applying ++}
[1,2] ++ [3] ++ [4,5]
= {applying ++}
[1,2,3,4,5]
That "step-by-step procedure" is an algorithm. qsort [] = []
qsort (x:xs) = qsort smaller ++ [x] ++ qsort larger
where
smaller = [a | a <- xs, a <= x]
larger = [b | b <- xs, b > x]
Nothing about this algorithm requires side-effects, it doesn't mutate any state, it doesn't make use of counters. You can implement it anywhere inside of a Haskell program.