Skip to content

Instantly share code, notes, and snippets.


Ted Blackman belisarius222

View GitHub Profile
belisarius222 / mung.hoon
Last active Jul 3, 2020
mung: better mug (inspired by @frodwith)
View mung.hoon
:: +mung: 31-bit non-zero murmur3-32 based merkle hash
++ mung
~/ %mung
=/ syd 0xcafe.babe
|= n=*
^- @
?^ n
$(n (con $(n -.n) (lsh 0 31 $(n +.n))))
belisarius222 / cone.hoon
Last active May 21, 2020
$cone: a definition of type for Nock trees, surjective from hoon $type's with no cores
View cone.hoon
+$ cone
$@ %noun
$% [%back ix=@ud]
[%loop =cone]
[%cell p=cone q=cone]
[%face p=term q=cone]
[%atom =aura]
[%mote =aura val=@]
belisarius222 /
Last active Mar 30, 2020
Uruk interpreter in Rust
extern crate num;
use num::bigint::{BigUint, ToBigUint};
use std::rc::Rc;
#[derive(Clone, Debug, Eq, PartialEq)]
enum Ur { S, K, J, D }
#[derive(Clone, Debug, Eq, PartialEq)]
enum Exp {
View monads.hoon
++ mebe
|* a=mold
+$ form (unit a)
++ pure
|= arg=a
^- form
++ bind

Ford Pinto - Smaller and Less Explosive


Overview and Rationale

Ford Turbo, the current incarnation of Ford, has some exciting features. In retrospect some of those features were the result of irrational exuberance. Many have been in Ford since the beginning.

Ford Pinto is an attempt to take a more measured look at which features Ford actually needs and to support only those features. The overall plan involves passing through Ford Pinto into Ford Focus, which will include performance tuning targeted at the major Ford use cases.

What is Ford actually used for? Building files, and doing mark operations, basically. The primary simplification I'm making to Ford in this revision is to separate those two interfaces. Ford runes other than simple imports have been removed, and there is now a strict layering where building a source file does not depend on mark builds.

View state-monad.hoon
=< (do-some-stack-ops ~[1 2 3])
++ do-some-stack-ops
=/ liz (list @)
=/ st (stack @)
=/ m (stat liz @)
^- form:m
;< empty=? bind:m is-empty:st
?. empty
belisarius222 / static-ford.hoon
Last active Apr 29, 2021
Ford prototype (Fiesta-style) with !<
View static-ford.hoon
:: $plan: ford build, at the current beak
+$ plan
$% [%'/.' data=vase]
[%'//' =spur] :: produces !>(*(unit [mark contents]))
[%'/*' =hoon]
[%'/=' face=@tas value=plan]
[%'/:' head=plan tail=plan]
[%'/>' with=plan rest=plan]
belisarius222 / w.hoon
Created Aug 26, 2019
Algorithm W for Hindley-Milner type inference
View w.hoon
+$ exp
$~ [%lit %int 0]
$% [%var =var]
[%lit =lit]
[%app fun=exp arg=exp]
[%abs =var bod=exp]
[%let =var val=exp bod=exp]
belisarius222 / fords.hoon
Created Sep 7, 2018
Sketch of an interpreter for new Ford runes
View fords.hoon
+$ op
$@ $? %bail :: error out
%call :: =+ gate=pop =+sample=pop (gate sample)
%cons :: =+ head=pop =+ tail=pop [head tail]
%copy :: duplicate top of stack
%done :: halt (successfully)
%eval :: eval top of stack as schematic against next top as subject
%numb :: catch error
%swap :: swaps top two elements of stack
belisarius222 / type-no-hoons.hoon
Created Aug 28, 2018
Hoon type that doesn't include hoon ASTs -- untested
View type-no-hoons.hoon
:: $type: a hoon type, represented in noun form
:: Instead of lazily evaluating the type of a hoon when compiled against a
:: subject type, use the special value %loop to recurse back up to the
:: nearest %hold.
+$ type
$@ ?(%noun %void %loop)
$% [%atom p=term q=(unit @)]
[%cell p=type q=type]