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 |
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
//TASK: https://cw.felk.cvut.cz/courses/a4b33alg/task.php?task=chocolate | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
#ifdef WIN32 | |
int getchar_unlocked() { return getchar(); } |
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
// TASK: https://cw.felk.cvut.cz/courses/a4b33alg/task.php?task=videocard | |
#include <vector> | |
#include <cstdio> | |
#include <queue> | |
#include <algorithm> | |
using namespace std; | |
#if defined(WIN32) && !defined(UNIX) |