I hereby claim:
- I am txus on github.
- I am txus (https://keybase.io/txus) on keybase.
- I have a public key ASAbZcf0hjvViWF-qloQU5qxKk4thtbvBjzXBtKRWAeU9wo
To claim this, I am signing this object:
I am attesting that this GitHub handle txus is linked to the Tezos account tz1TSCo7tDXgCEySkrVyyNov7GBLSQPpL2ev for tzprofiles | |
sig:edsigtrsQ4vojJfHQtejr4MFp4xWJnJHe8q7rkfGyM988PZMTQ5Aw74hAUw6RsTZeMkrheSMc83Tyw9rjQG8Z5WqbM8KTedpBKt |
-- This is a starter contract, based on the Game contract, | |
-- containing the bare minimum required scaffolding. | |
-- | |
-- What you should change to something more suitable for | |
-- your use case: | |
-- * The DataScript type | |
-- * The Redeemer type | |
-- | |
-- And add function implementations (and rename them to |
I hereby claim:
To claim this, I am signing this object:
(require '[clojure.string :as str]) | |
(defn parse [s] | |
(->> s | |
str/split-lines | |
(map (fn [line] | |
(let [[action source destination alternative] | |
(str/split (str/trim line) #" +")] | |
[action | |
{:source source |
(ns adts | |
(:require [clojure.string :as str])) | |
(defn type->kw [ty] | |
(keyword (str *ns* "/" ty))) | |
(defn capitalized? [s] | |
(= (str s) (str/capitalize s))) | |
(defn adt? [s] |
(ns small-town.app) | |
;; person | |
(def genders #{:male :female}) | |
(defn make-person [age] | |
{:age age | |
:gender (rand-nth (vec genders)) | |
:dead false}) |
func RandomSubset(containers []*docker.Container, percentage float64) []*docker.Container { | |
r := rand.New(rand.NewSource(time.Now().UnixNano())) | |
length := len(containers) | |
numberOfElementsWeWant := int64(percentage * float64(length)) | |
randomIndices := r.Perm(length)[0:numberOfElementsWeWant] | |
var selected []*docker.Container | |
for _, idx := range randomIndices { | |
selected = append(selected, containers[idx]) |
trait Hey { | |
fn ha(&self) -> u32; | |
} | |
enum Foo<A> { | |
Ret(A), | |
Bar<X: Hey>(Box<Fn(X) -> Foo<A>>) | |
} | |
fn test() -> Foo<u32> { |
What if we treated memory as a side-effect?
Idris lets us track lots of things in the type system, in order to get errors at compile-time rather than at runtime. One of the tools that lets us do this in Idris is called Effects, and they're used to keep track of state, to manage file handlers, and lots more.
In barely 40 lines of Idris (which could be less if I had any idea what I'm