Skip to content

Instantly share code, notes, and snippets.

@joemfb
Created July 20, 2017 05:23
Show Gist options
  • Save joemfb/b2eb9b1b6a8ea6a6663c90c8200391e0 to your computer and use it in GitHub Desktop.
Save joemfb/b2eb9b1b6a8ea6a6663c90c8200391e0 to your computer and use it in GitHub Desktop.
testing ;~ expansions
!: :- %say |= * :- %noun
=/ one
|*({a/gate b/gate} [;~(a b) b])
=/ two
|* {a/gate b/gate c/gate}
:- ;~(a b c)
|* arg/*
(a (b arg) c(,.+6 arg))
=/ tre
|* {a/gate b/gate c/gate d/gate}
:- ;~(a b c d)
|* arg/*
%+ a (b arg)
=+ arg=arg
|% +- $ (a (c arg) d(,.+6 arg)) --
:: |* shadow/_arg
:: (a (c shadow) d(,.+6 shadow))
=/ bunt |*({a/* b/gate} [%bunt a (b)])
=/ glue |*({a/* b/gate} [%glue a (b a)])
:~ :+ %one
%- test [(- "foo") (+ "foo")]:(one bunt crip)
%- test [(- "foo") (+ "foo")]:(one glue crip)
:+ %two
%- test [(- "foo") (+ "foo")]:(two bunt crip some)
%- test [(- "foo") (+ "foo")]:(two glue crip dec)
:+ %tre
%- test [(- "foo") (+ "foo")]:(tre bunt crip some head)
%- test [(- "foo") (+ "foo")]:(tre glue crip dec trip)
==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment