This file contains hidden or 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
is_gelijk :: String String -> Bool | |
is_gelijk s1 s2 | |
| size s1 == size s2 = is_gelijk_h s1 s2 | |
= False | |
is_gelijk_h :: String String -> Bool | |
is_gelijk_h "" "" = True | |
is_gelijk_h s1 s2 | |
| head s1 == head s2 = is_gelijk_h (tail s1) (tail s2) | |
= False |
This file contains hidden or 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
is_deel :: String String -> Bool | |
is_deel a b = size a <= size b && (is_gelijk a "" | |
|| | |
head a == head b && is_deel (tail a) (tail b) | |
|| | |
is_deel a (tail b) | |
) |
This file contains hidden or 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
is_gelijk :: String String -> Bool | |
is_gelijk a b | |
|not(size a == size b) = False | |
is_deelstring :: String String -> Bool | |
is_deelstring a b | |
|size a > size b = False | |
|size a == size b = a == b |
This file contains hidden or 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
foldr :: (a b -> b) b [a] | |
foldr op e [] = e | |
foldr op e (x:xs) = op x (foldr op e xs) | |
foldr op 0 [1,2] = op 1 (foldr op 0 [2]) | |
= op 1 (op 2 (foldr op 0 [])) | |
= op 1 (op 2 0) | |
This file contains hidden or 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
thom@Lethe ~/Music/SortedMusic/Kavinsky - Outrun [2013] $ du -h *.mp3 01\ Pre<0301>lude.flac | |
3,3M v0.mp3 | |
1,1M v9.mp3 | |
13M 01 Prélude.flac |
This file contains hidden or 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
:: Type = Ding Int Int | GeenFiets | |
linkerkantvanding :: Type -> Int | |
linkerkantvanding (Ding a b) = a | |
linkerkantvanding GeenFiets = abort "MAGNIE" | |
iseending :: Type -> Bool | |
iseending (Ding _ _) = True | |
iseending _ = False |
This file contains hidden or 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
:: Expr = NR Int | |
// ... | |
instance toString Expr where | |
toString (NR a) = toString a | |
// .... |
This file contains hidden or 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
module test | |
import StdEnv | |
testfunctie :: Int -> (Int Int -> Int) | |
testfunctie 1 = (+) | |
Start = (testfunctie 1) 2 3 // output: 5 |
This file contains hidden or 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_uitvoeren :: Naam Expr Expr -> Expr | |
let_uitvoeren naam e1 (VAR a) | |
| a == naam = e1 | |
| otherwise = e2 | |
let_uitvoeren naam e1 (OP e1 op e2) = -- hier iets recursiefs doen | |
-- enz |
This file contains hidden or 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
/* | |
I decided to add 3 hulp functions to solve this. I wanted to keep track of what values the children | |
should be smaller than and what values the children should be larger than. I did this by using 2 lists | |
one for smaller one for larger. | |
As such a child should either be smaller than certain parents and larger than certain parents. The lists | |
keep track of what values the child should be smaller / larger than. | |
A Leaf is always ordered, so is a node with no parents. Than there are 3 other cases: | |
Left & Right child is a node |