I hereby claim:
- I am poetix on github.
- I am poetix (https://keybase.io/poetix) on keybase.
- I have a public key ASDdtm9fCHu0-fJArrQzHByuiG-rDxBbi1TeELZ3YLElBwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| module Main where | |
| import Prelude | |
| import Control.Plus (empty) | |
| import Data.Array as A | |
| import Data.Set as S | |
| import Control.Monad.Eff.Console (log) | |
| import Data.Foldable (minimum, maximum) | |
| import Data.Maybe (fromMaybe) | |
| import Data.String (joinWith, fromCharArray) |
| package com.codepoetics.kontinuous | |
| import java.sql.Connection | |
| import java.sql.PreparedStatement | |
| import java.sql.ResultSet | |
| data class Foo(val a: String, val b: Int, val c: Double) | |
| interface RowN { | |
| val selectSql: String |
| import qualified Data.Map as Map | |
| type SubPaths = Map.Map String Node | |
| data Node = Content SubPaths | NoContent SubPaths deriving (Show) | |
| content :: [(String, Node)] -> Node | |
| content kvs = Content $ Map.fromList kvs | |
| nocontent :: [(String, Node)] -> Node | |
| nocontent kvs = NoContent $ Map.fromList kvs |
| import java.util.function.*; | |
| public final class Tunnel<E extends Exception> { | |
| public static <E extends Exception, R> R call(Class<? extends E> exceptionClass, Function<Tunnel<E>, R> f) throws E { | |
| try { | |
| return f.apply(new Tunnel<>()); | |
| } catch (TunnelledException e) { | |
| throw exceptionClass.cast(e.getCause()); | |
| } |
| public class RotationalHash { | |
| public static int hash(String beads) { | |
| byte[] buf = beads.getBytes(); | |
| int hash = hashBytes(buf); | |
| int i = 0; | |
| int j = buf.length - 1; | |
| while (i < j) { | |
| buf[i] ^= buf[j]; | |
| buf[j] ^= buf[i]; |
| @FunctionalInterface | |
| public interface Judiciously<T> { | |
| class WrappedException extends RuntimeException { | |
| public WrappedException(Throwable cause) { | |
| super(cause); | |
| } | |
| } | |
| static <T> T attempt(Judiciously<T> f) { |
| public interface Nonchalantly<T> { | |
| static <T, E extends Throwable> T invoke(Nonchalantly<T> f) throws E { | |
| try { | |
| return f.run(); | |
| } catch (Throwable e) { | |
| throw (E) e; | |
| } | |
| } | |
| T run() throws Throwable; | |
| module Main | |
| forLoop : List a -> (a -> IO ()) -> IO () | |
| forLoop [] f = return () | |
| forLoop (x :: xs) f = do f x | |
| forLoop xs f | |
| syntax for {x} "in" [xs] ":" [body] = forLoop xs (\x => body) | |
| spaces : Nat -> String |
| import random | |
| def memoize(f): | |
| cache = {} | |
| def memoized(*arg): | |
| if arg in cache: | |
| return cache[arg] | |
| result = f(*arg) | |
| cache[arg] = result | |
| return result |