I hereby claim:
- I am rtpg on github.
- I am rtpg (https://keybase.io/rtpg) on keybase.
- I have a public key ASD-wP2usgoqaEFBlO3ZpUS96VO7chqGCyzeRsU2gEWsego
To claim this, I am signing this object:
#!/usr/bin/env python3 | |
from black import lib2to3_parse | |
from blib2to3.pytree import Leaf, type_repr | |
func_example = """ | |
def f(x, y): | |
# add two operands | |
return (x + y) # yes just this | |
""" |
""" | |
An implementation of the Fermat's library anagram detection | |
https://twitter.com/fermatslibrary/status/1275066521450975234 | |
Takes a list of line seperated words and uses prime factors to | |
encode letters and identify the equivalency classes. | |
Prints out the top 10 anagram classes for the provided word list | |
""" | |
from collections import defaultdict, Counter |
/** | |
* First, we're going to declare two types to use for tagging validation, with a function to "run" during compile-time | |
* | |
* validate(a: T,b: U) returns Validated<T> if a and b mutually extend each other, if not it returns NotValidated<U> | |
* | |
* (by sending the left value in one case and the right value in another the type system is more likely to give "real" | |
* error messages and tell you what keys you are missing) | |
* | |
* Usage is: | |
* // this should fail at compile time based on the used values |
// this worked in Typescript 3.2.4 | |
// It feels like we should be able to say SameShape<Q extends R, R extends Q>, but this triggers circular reference | |
// detection in Typescript. Somehow going to {[K in keyof Q]: Q[K]} solves this (though maybe this won't catch things | |
// like symbols?) | |
type SameShape<Q extends R, R extends { [K in keyof Q]: Q[K] }> = { | |
[K in keyof Q]: R[K] // re-asserting every key of Q is present in R with the same type | |
} & { // anding the types together will catch any conflicts | |
[K in keyof R]: Q[K] // re-asserting every key of R is present in Q with the same type | |
} |
I hereby claim:
To claim this, I am signing this object:
import Data.Exists (Exists, mkExists, runExists) | |
type Circle = {x:: Int, y:: Int, r:: Int} | |
type Rectangle = {x:: Int, y:: Int, w:: Int, h:: Int} | |
drawCircle :: Circle -> String | |
drawCircle c = "This is a circle!" | |
drawRectangle :: Rectangle -> String | |
drawRectangle r = "This is a rectangle!" |
import Data.Exists (Exists, mkExists, runExists) | |
type Circle = {x:: Int, y:: Int, r:: Int} | |
type Rectangle = {x:: Int, y:: Int, w:: Int, h:: Int} | |
drawCircle :: Circle -> String | |
drawCircle c = "This is a circle!" | |
drawRectangle :: Rectangle -> String | |
drawRectangle r = "This is a rectangle!" |
"use strict" | |
// module App.Models | |
exports.createUser = function(u){ | |
// you might want to put some real implementations here | |
return 3; | |
}; | |
exports.lookupUser = function(u){ |