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
BOARD = [ | |
[7,8,0,4,0,0,1,2,0], | |
[6,0,0,0,7,5,0,0,9], | |
[0,0,0,6,0,1,0,7,8], | |
[0,0,7,0,4,0,2,6,0], | |
[0,0,1,0,5,0,9,3,0], | |
[9,0,4,0,6,0,0,0,5], | |
[0,7,0,3,0,0,0,1,2], | |
[1,2,0,0,0,7,4,0,0], | |
[0,4,9,2,0,6,0,0,7] |
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
#!/usr/bin/env python | |
"""Server site implementation of the product, where users can | |
save URLs and retrieve them later.""" | |
__author__ = "Wiktor Reczek" | |
class UrlService: | |
"""CRUD service without `update`.""" |
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
{-# LANGUAGE RankNTypes #-} | |
module ChurchNumerals | |
( church, unchurch, zero, one, two, three, four, | |
five, six, seven, eight, nine, ten | |
) where | |
-- we define natural numbers of Church | |
type Church a = (a -> a) -> a -> a | |
-- converting functions |
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
module ChurchBooleans | |
(true, false, not', and', or', xor', to_boolean) where | |
-- defining Church values: true and false | |
true :: t1 -> t -> t1 | |
true= \x y -> x | |
false :: t -> t1 -> t1 | |
false= \x y -> y |
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
module Calculation | |
(increment, decrement, add, mul, pow) where | |
-- arithmetic operations, additionally give us the | |
-- view of new, undefined numerals | |
increment :: ((a -> b) -> c -> a) -> (a -> b) -> c -> b | |
increment = \g f x -> f(g(f)(x)) | |
decrement :: (((r -> b) -> (b -> c) -> c) -> |
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
module Pairs | |
(first, second,pair) where | |
--needed for first and second operations, uses true and false | |
-- from ChurchBooleans | |
import ChurchBooleans | |
-- functions that are needed for list operations | |
first :: ((t1 -> t2 -> t1) -> t) -> t | |
first = \f -> f(true) |
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
module Calculation | |
(increment, decrement, add, mul, pow) where | |
-- arithmetic operations, additionally give us the | |
-- view of new, undefined numerals | |
increment :: ((a -> b) -> c -> a) -> (a -> b) -> c -> b | |
increment = \g f x -> f(g(f)(x)) | |
decrement :: (((r -> b) -> (b -> c) -> c) -> |