I hereby claim:
- I am andymatuschak on github.
- I am andymatuschak (https://keybase.io/andymatuschak) on keybase.
- I have a public key whose fingerprint is 289E CB4D BCC9 5D3A 71BD 6795 14CB 9F07 992C D348
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import Data.List (sort) | |
import Data.Array (Array, array, (!)) | |
deckSize = 52 | |
eachColor = 26 | |
-- Some convenience types: | |
type History = (Int, Int) -- # of red cards seen, # of black cards seen | |
data Choice = Stop | Continue deriving (Show, Eq) | |
data Decision = Decision { choice :: Choice, expectedWin :: Double } deriving (Show, Eq) |
# Suppose I want to the user to enter names one at a time, until the user enters a blank line, | |
# then tell each name that they're awesome. | |
# Yeah, I don't have really a better way of doing that, and that bothers me. I'd do: | |
a = [] | |
until (str = gets.chomp?).empty? | |
a << str | |
end |
# In Ruby, every expression (even ifs) has a value! | |
print 'What is your name? ' | |
name = gets.chomp | |
name_response = if name == 'Suzanne' | |
then 'Oh man, ' + name + ' you are awesome' | |
else 'You, ' + name + ', are not nearly as cool as Suzanne.' | |
end | |
print name_response |
qsort [] = [] | |
qsort (x:xs) = qsort less ++ [x] ++ qsort more | |
where less = filter (<x) xs | |
more = filter (>=x) xs |
module Main where | |
import qualified Data.Set as Set | |
import qualified Data.Heap as Heap | |
import qualified Data.IntMap as IntMap | |
import Data.List | |
import Control.Monad | |
import Maybe | |
import System.Environment (getArgs) | |
import System.Process |
# What's wrong with List's "insert" method if called from multiple threads? | |
# How would you fix it? | |
class Node: | |
def __init__(self, value): | |
self.value = value | |
self.next = None | |
class List: | |
def __init__(self): |
# | |
# uncrustify config file for objective-c and objective-c++ | |
# | |
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs | |
output_tab_size = 4 # new tab size | |
indent_columns = output_tab_size | |
indent_label = 2 # pos: absolute col, neg: relative column | |
indent_align_assign = FALSE |
type Call = Call { funcName :: String, | |
funcParams :: [Integer] } | |
parser :: Parser Call | |
parser = do | |
name <- ident | |
params <- commaSep integer | |
return (Call name params) |
Salad of braised leek, persimmon, prosciutto, pine nuts, and parmesan, with a sherry vinaigrette | |
Spiced sous vide duck breast, roasted butternut squash, orange confit, sauteed oyster mushrooms | |
Marinated idiazábal, olives, roasted almonds | |
Gingerbread cookie + caramel ice cream sandwiches, poached pears with vanilla compote |