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
| public class ErrorHandlingMiddleware | |
| { | |
| private readonly RequestDelegate _next; | |
| public ErrorHandlingMiddleware(RequestDelegate next) | |
| { | |
| _next = next; | |
| } | |
| public async Task Invoke(HttpContext context) |
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
| -- http://math.feld.cvut.cz/demlova/teaching/jag/cjag812.pdf cviceni 12.1 | |
| automat :: String -> Bool | |
| automat input = automat_h input 0 False | |
| automat2 :: String -> Bool | |
| automat2 input = automat_h2 input ['z'] 1 | |
| automat_h :: String -> Int -> Bool -> Bool | |
| automat_h ('a':xs) count False = automat_h xs (count + 1) 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
| $apiKey = "your api key" | |
| $gitlabhost = "https://gitlab.yourcompany.com" | |
| $headers = @{ | |
| 'PRIVATE-TOKEN'="$apiKey" | |
| "Accept-Charset" = "utf-8" | |
| "Accept" = "application/json" | |
| "Content-Type" = "application/json; charset=utf-8" | |
| } |
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
| harmonicMean :: [Double] -> Double | |
| harmonicMean list = (doubleLength list) / sumo where | |
| sumo = (sum twisted) | |
| twisted = (map inv list) | |
| geometricMean :: [Double] -> Double | |
| geometricMean list = (product list) ** (1/(doubleLength list)) | |
| arithmeticMean :: [Double] -> Double | |
| arithmeticMean list = (sum list) / (doubleLength list) |
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 QueueStacks where | |
| type Stack v = [v] | |
| push :: v -> Stack v -> Stack v | |
| push value stack = value:stack | |
| pop :: Stack v -> Stack v | |
| pop [] = [] | |
| pop (_:newStack) = newStack |
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
| (define first car) | |
| (define second cadr) | |
| (define rest cdr) | |
| (define (third list) (car (cddr list))) | |
| (define fourth cadddr) | |
| (define (push v st) | |
| (cons v st)) |
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 KeyVal a b = (a, b) | |
| type Map a b = [KeyVal a b] | |
| test = initmap ["a","b","c"] [1,2,3] | |
| myZip (k:ks) (v:vs) = [(k,v)] ++ myZip ks vs | |
| myZip [] [] = [] | |
| get_key (a, b) = a | |
| get_val (a, b) = 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
| (define first car) | |
| (define second cadr) | |
| (define rest cdr) | |
| (define (third list) (car (cddr list))) | |
| (define fourth cadddr) | |
| (define initmap '()) | |
| (define test | |
| (list (list 'a 1) (list 'b 3)) |
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
| ; list of actions | |
| ; - n počet disků | |
| ; move tower to c | |
| ; last stage to 2 | |
| (define (hanoi n a b c) | |
| (cond | |
| ((eq? n 1) (list(cons a b))) ; jedno patro dám rovnou na b | |
| (#t (append (hanoi (- n 1) a c b) (list(cons 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
| -- board type definition for game board | |
| type Board = [Int] | |
| initBoard :: Board | |
| initBoard = [5,4,3,2,1] | |
| -- player tpye definition | |
| data Player = P1 | P2 deriving Show | |
| nextP :: Player -> Player | |
| nextP P1 = P2 | |
| nextP P2 = P1 |