Skip to content

Instantly share code, notes, and snippets.

View AeroNotix's full-sized avatar
💭
🇺🇦

Aaron France AeroNotix

💭
🇺🇦
View GitHub Profile
def decorizzle(**outerkwargs):
def takekwarg(f):
def inner(*args, **kwargs):
kwargs.update(outerkwargs)
return f(*args, **kwargs)
return inner
return takekwarg
@decorizzle(foo="LOL")
def decorizzle(foo=None):
def takekwarg(f):
def inner(*args, **kwargs):
kwargs['foo'] = foo
if len(args):
return f(args[0], *args[1:], **kwargs)
return f(*args, **kwargs)
return inner
return takekwarg
def decorizzle(foo=None):
def takekwarg(f):
def inner(*args, **kwargs):
kwargs['foo'] = foo
return f(*args, **kwargs)
return inner
return takekwarg
@decorizzle(foo="LOL")
package main
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"io/ioutil"
)
module type S = sig
type 'a t
val fold : 'a t -> init:'acc -> f:('acc -> 'a -> 'acc) -> 'acc
end
module MyFolder = struct
type 'a t = (int * 'a) list
let fold (a : 'a t) ~init ~f =
let rec aux prev = function
(defn recursive-reverse [coll]
(loop [ [x & xs] (seq coll)
acc '()]
(if (nil? x)
acc
(recur xs (cons x acc)))))
open Core.Std
module T = Core.Time
module Message = struct
exception Invalid_message_format of string
type msg = {
channel : string
open Core.Std
type json =
| String of string
| Int of int
| Float of float
| Bool of bool
| Array of json list
| Object of (string * json)
open Core.Std
let maybe_list this that =
match this with
| Some l ->
(List.append l [that]);
| None -> [that]
let group_by f l =
open Core.Std
let maybe_list this that =
match this with
| Some l ->
Some (List.append l [that]);
| None -> Some [that]
let group_by f l =