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
## based on airbnb proto interview | |
def rev(s): | |
return s[::-1] | |
# a .. b | |
# (a,b) .. (b,a) | |
def mir(a,b): | |
i = a | |
j = b |
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
;;; ala python string formatting | |
;;; | |
;;; (let ((some "Object") (i 1)) (f "<{some}... [{i}:{i}>")) => "<Object... [1:1]> | |
;;; | |
;;; todo: {...} parser | |
;;; todo: wrapping defmacro | |
;;; todo: wrapping defun | |
;;; | |
;;; state: alpha² |
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
(cl-flet ((fun (x) (1+ x))) | |
(fun 0)) | |
(let ((fun (lambda (x) (1+ x)))) | |
(fun 0)) | |
(defmacro lem (bs &rest body) | |
(cl-flet ((fun? (form) | |
(and (listp form) | |
(eq (length form) 3) |
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
import urllib.request as rq | |
class ConfusedThreader(Exception): | |
pass | |
class Fun: | |
def __getattr__(self,attribute): | |
def aux(o): | |
return getattr(o,attribute)() | |
return aux |
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
(defmacro progm (body) | |
(if (null body) | |
'() | |
`(cons ,(car body) | |
(progm ,(cdr body))))) | |
(defmacro progb (&rest pair) | |
(let ((a (car pair)) | |
(b (cadr pair))) | |
`(cons ,a (cons ,b nil)))) |
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
" | |
HN async: port of a port of a script from a reddit that turns an HN article into an org-mode file | |
@TODO: full eager graph walk of the json sub-structures | |
@TODO: full lazy walk at depth d | |
@TODO: org-mode overlay to intercept subtree unfolding as async GET | |
" | |
(setq lexical-binding t) |
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
// fantom type-ish in kotlin | |
// class res | |
// class open:res | |
// class close:res | |
// class file<res> | |
// fun open file<close> -> file<open> | |
// fun close file<open> -> file<close> | |
// fun read file<open> -> file<open> list<string> |
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
;;; kotlin-mode-overlay.el --- Missing bits for kotlin -*- lexical-binding: t; -*- | |
(defvar *kotlin-linter* "ktlint") | |
(defvar *kotlin-interpreter* "kotlin") | |
(defvar *kotlin-build-dir* "build") | |
(defvar *kotlin-main-args* "gest.xml") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN. | |
(defun kotlin/test () |
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
def dec(*a, **k): | |
print(a,k) | |
return a[0] if a else lambda self: self | |
def debug(f, pre='[debug]', indent='.', inc=1): | |
depth = 0 | |
def _(*a,**k): | |
nonlocal indent | |
nonlocal depth |
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
# function:defaults code:argcount code:varnames can be used for precise curry | |
def vars(fun): | |
defaults = fun.__defaults__ | |
argcount = fun.__code__.co_argcount | |
varnames = fun.__code__.co_varnames | |
return defaults, argcount, varnames | |
def cu(f): |