module curry
----
Function to curryfy a diadic function
----
function curry = |f| -> |a| -> |b| -> f(a, b)
@curry
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
\lstdefinelanguage{http}{% | |
morekeywords=[1]{HTTP,% | |
GET,POST,PUT,HEAD,DELETE,PATCH,OPTIONS,CONNECT,TRACE,% | |
OK,Precondition,Failed,Not,Modified,Acceptable,% | |
Created,Found,Accepted,No,Content,Gone,Multiple,Choices,See,Other,Method,Allowed,% | |
Unsupported,Media,Type,Required% | |
},% | |
morekeywords=[2]{% | |
Accept,Accept-Encoding,Accept-Language,Alternates,% | |
Content-Type,Content-Language,Content-Encoding,Content-Location,Content-Length,% |
the unit test framework itself
module gololang.unittest
struct TestCase = {
desc,
verbose,
failed,
errors,
improved
module memoizedeco
import java.lang.System
function memoizer = {
var cache = map[]
return |fun| {
more functional, generic and dsl-ish version of https://gist.github.com/k33g/1dfb5bf477b7e121422d ;D
module prepostdeco
import java.lang.Math
# Decorator: apply checkers to parameters and result
function checkThat = |preTests...| {
return |postTest| {
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
# Decorator | |
def checkparams(*checkers): | |
def _deco_(fun): | |
def _wrapped_(*args): | |
print("I check {} params".format(fun.__name__)) | |
assert all(f(v) for f,v in zip(checkers, args)) | |
return fun(*args) | |
return _wrapped_ | |
return _deco_ |
NewerOlder