Skip to content

Instantly share code, notes, and snippets.

@bonkydog
Created March 6, 2014 00:03
Show Gist options
  • Select an option

  • Save bonkydog/9379401 to your computer and use it in GitHub Desktop.

Select an option

Save bonkydog/9379401 to your computer and use it in GitHub Desktop.
Gibbon barf
(@color -> case-eq-default 5 [ 'Green' : 10 ])
initial crumbs [["/"]]
locking /
-> <@color> = !12[@color]
-> <@color> = %a2
-> <@color -> case-eq-default 5 [ 'Green' : 10 ]> = %b3
-> <5> = %b3
-> <5> = (numeric)
-> <[ 'Green' : 10 ]> = (list (pair %a2 %b3))
-> <[ 'Green' : 10 ]> = (list %el4)
-> <'Green'> = (string)
-> <10> = (numeric)
-> <'Green' : 10> = (pair <'Green'> <10>)
-> <'Green' : 10> = %el4
:> <@color> = !12[@color]
%> !12[@color] = (string)
>> <@color> = (string)
:> <@color> = %a2
:> (string) = %a2
:> %a2 = (string)
>> %a2 = (string)
:> <@color -> case-eq-default 5 [ 'Green' : 10 ]> = %b3
>> <@color -> case-eq-default 5 [ 'Green' : 10 ]> = %b3
:> <5> = %b3
>> <5> = %b3
:> <5> = (numeric)
:> %b3 = (numeric)
>> %b3 = (numeric)
%> %b3 = (numeric)
%> %b3 = (numeric)
:> <[ 'Green' : 10 ]> = (list (pair %a2 %b3))
%> (list (pair %a2 %b3)) = (list (pair (string) (numeric)))
>> <[ 'Green' : 10 ]> = (list (pair (string) (numeric)))
:> <[ 'Green' : 10 ]> = (list %el4)
:> (list (pair (string) (numeric))) = (list %el4)
:> (pair (string) (numeric)) = %el4
:> %el4 = (pair (string) (numeric))
>> %el4 = (pair (string) (numeric))
:> <'Green'> = (string)
>> <'Green'> = (string)
:> <10> = (numeric)
>> <10> = (numeric)
:> <'Green' : 10> = (pair <'Green'> <10>)
%> (pair <'Green'> <10>) = (pair (string) (numeric))
>> <'Green' : 10> = (pair (string) (numeric))
:> <'Green' : 10> = %el4
%> %el4 = (pair (string) (numeric))
:> (pair (string) (numeric)) = (pair (string) (numeric))
=> <@color> = (string)
=> %a2 = (string)
=> <@color -> case-eq-default 5 [ 'Green' : 10 ]> = (numeric)
=> <5> = (numeric)
=> %b3 = (numeric)
=> <[ 'Green' : 10 ]> = (list (pair (string) (numeric)))
=> %el4 = (pair (string) (numeric))
=> <'Green'> = (string)
=> <10> = (numeric)
=> <'Green' : 10> = (pair (string) (numeric))
setting key: /
unlocking /
=== OPTIMIZING (FOLDR (LIST (PAIR Green 10)) 5 el1 next3 i2 (IF (`===` (QUERY {"field_id":91,"listing_id":12,"_query_type":"access"} $) ([first] el1)) ([second] el1) next3))
inlining FOLDR
subst el1=(PAIR Green 10) next3=5 i2=i (IF (`===` (QUERY {"field_id":91,"listing_id":12,"_query_type":"access"} $) ([first] el1)) ([second] el1) next3)
inlining lookup second of (PAIR Green 10)
inlining lookup first of (PAIR Green 10)
==> (IF (`===` (QUERY {"field_id":91,"listing_id":12,"_query_type":"access"} $) Green) 10 5)
before:
let t3 = Green
let t4 = $
k5 t6:
let t7 = (`===`/2 t6 t3)
k8 t9:
go RETURN t9
k12 :
let t10 = 10
go k8 t10
k13 :
let t11 = 5
go k8 t11
if t7 ->k12 else ->k13
query {"field_id":91,"listing_id":12,"_query_type":"access"} t4 !->FAIL ->k5
eta-reducing k8 with RETURN
reduced to:
let t3 = Green
let t4 = $
k5 t6:
let t7 = (`===`/2 t6 t3)
k12 :
let t10 = 10
go RETURN t10
k13 :
let t11 = 5
go RETURN t11
if t7 ->k12 else ->k13
query {"field_id":91,"listing_id":12,"_query_type":"access"} t4 !->FAIL ->k5
GENERATED:
function compiled($, QUERY, FAIL, RETURN) {
function k5(t6) {
function k12() {
return RETURN(10);
};
function k13() {
return RETURN(5);
};
if ((t6)===("Green")) return k12()
else return k13();
};
return QUERY($, {"field_id":91,"listing_id":12,"_query_type":"access"}, FAIL, k5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment