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 ListADT where | |
| import Data.List | |
| data List a = Cons a (List a) | |
| | Nil | |
| -- instance (Show a) => Show (List a) where | |
| -- show xs = "MyList[" ++ (intersperse ',' . map show) (toList xs) ++ "]" |
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
| fib :: Integer -> Integer | |
| fib 0 = 0 | |
| fib 1 = 1 | |
| fib n = fib (n-1) + fib (n - 2) | |
| fibs1 :: [Integer] | |
| fibs1 = map fib [0..] | |
| fibs2 :: [Integer] |
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
| import Data.List | |
| fun1 :: [Integer] -> Integer | |
| fun1 = product . map (subtract 2) . filter even | |
| fun2' :: Integer -> Integer | |
| fun2' 1 = 0 | |
| fun2' n | even n = n + fun2' (n `div` 2) | |
| | otherwise = fun2' (3 * n + 1) |
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
| {- | |
| Exercise 1 Hopscotch | |
| Your first task is to write a function | |
| skips :: [a] -> [[a]] | |
| The output of skips is a list of lists. The first list in the output should | |
| be the same as the input list. The second list in the output should | |
| contain every second element from the input list. . . and the nth list in |
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
| {-# OPTIONS_GHC -Wall #-} | |
| module LogAnalysis where | |
| import Log | |
| parseMessage' :: [String] -> LogMessage | |
| parseMessage' ("E":severity:timestamp:rest) = LogMessage (Error (read severity)) (read timestamp) (unwords rest) | |
| parseMessage' ("I":timestamp:rest) = LogMessage Info (read timestamp) (unwords rest) | |
| parseMessage' ("W":timestamp:rest) = LogMessage Warning (read timestamp) (unwords rest) | |
| parseMessage' x = Unknown (unwords x) |
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
| toDigits :: Integer -> [Integer] | |
| toDigits n | |
| | n <= 0 = [] | |
| | n < 10 = [n] | |
| | otherwise = (toDigits (n `div` 10)) ++ [n `mod` 10] | |
| toDigitsRev :: Integer -> [Integer] | |
| toDigitsRev n = reverse $ toDigits n |
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
| import System.Directory | |
| import System.FilePath | |
| import Control.Monad | |
| import Control.Exception | |
| import GHC.IO.Encoding | |
| -- Gets a root directory and a callback, | |
| -- calls callback for root directory and every subdirectory recursively | |
| -- callback signature root -> files -> dirs -> IO () | |
| walkDirectory :: String -> (String -> [String] -> [String] -> IO ()) -> IO () | |
| walkDirectory rootDir callback = do |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Text.RegularExpressions; | |
| namespace MiniWebFramework | |
| { | |
| public enum JSONValueType |
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
| #include <stddef.h> // NULL | |
| #include <stdint.h> | |
| #include <stdlib.h> // calloc | |
| #include <string.h> // memset | |
| #include <stdio.h> | |
| /* | |
| * Bir kodun en fazla 15 bit olmasına izin vereceğiz. | |
| * Bu nedenle code için 16 bit veri yapısı yeterli. | |
| */ |
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
| 0x08048464 <+0>: push ebp | |
| 0x08048465 <+1>: mov ebp,esp | |
| 0x08048467 <+3>: sub esp,0x14 | |
| 0x0804846a <+6>: mov eax,gs:0x14 | |
| 0x08048470 <+12>: mov DWORD PTR [ebp-0x4],eax | |
| 0x08048473 <+15>: xor eax,eax | |
| 0x08048475 <+17>: lea eax,[ebp-0x10] | |
| 0x08048478 <+20>: mov DWORD PTR [esp],eax | |
| 0x0804847b <+23>: call 0x8048360 <gets@plt> | |
| 0x08048480 <+28>: lea eax,[ebp-0x10] |