Moved to https://github.com/kbilsted/Functional-core-imperative-shell/blob/master/README.md
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 requests | |
import re | |
def main(): | |
print("starting") | |
# Set the admin cookie before doing anything else | |
my_cookie = { | |
"name":"admin", | |
"value":"true" |
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
/** Fixed point combinator: The essence of recursion */ | |
def fix[T, R](f: (T => R) => (T => R)): (T => R) = new Function1[T, R] { | |
def apply(t: T): R = f(this)(t) | |
} | |
/** Factorial definition with fixed point */ | |
def factorial(recursive: Long => Long) = (x: Long) => x match { | |
case 1 => 1 | |
case x => x * recursive(x-1) | |
} |