This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insertInOrder :: Int -> Tree -> Tree | |
insertInOrder x Leaf = Node x Leaf Leaf | |
insertInOrder x node@(Node y _ _) | |
| x == y = node | |
insertInOrder x (Node y left@(Node ly _ _) Leaf) | |
| x > ly && x < y = Node x left Leaf | |
| x < ly = Node y (insertInOrder x left) Leaf | |
| x > y = Node y left (insertInOrder x Leaf) | |
insertInOrder x (Node y Leaf right@(Node ry _ _)) | |
| x > y && x < ry = Node x Leaf right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fltr = f :: (a -> Bool) -> [a] -> [a] where f _ [] = []; f p (x:xs) = if (p x) then x:(f p xs) else f p xs in fltr (<5) [2,44,1,32] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let length = l where l [] = 0; l (x:xs) = 1 + l xs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Random | |
starman :: Int -> IO () | |
starman n = do | |
let allWords = ["cat", "dog"] | |
index <- randomRIO(0, (length allWords) - 1) | |
let word = allWords !! index | |
turn word ['-' | x <- word] n | |
turn :: String -> String -> Int -> IO () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ai = (function() { | |
var ai = { | |
phrases: {}, | |
phraseIds: {}, | |
nextPhraseId: 1, | |
authors: {}, | |
authorIds: {}, |