-
-
Save rightfold/fb4d5a7de9cc9f755089 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Seq { | |
def first(this); | |
def rest(this); | |
def cons(x, this); | |
} | |
implement Seq for Array { | |
def first(xs) = global; | |
def rest(xs) = global; | |
def cons(x, xs) = global; | |
} | |
extern product; | |
extern tail; | |
extern range; | |
def factorial(n) = product(tail(range(n))); | |
lazy largeNumber = factorial(10); | |
protocol Map { | |
def map(this, f); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$lasagnascript$module.Seq = $lasagnascript$global.$lasagnascript$protocol([ | |
{ | |
name: 'first', | |
id: 'first$21ac8d3d_0968_4d9f_9554_c6100104cc4d' | |
}, | |
{ | |
name: 'rest', | |
id: 'rest$20a4d8fc_6213_497c_ad8b_ff01e4a446c7' | |
}, | |
{ | |
name: 'cons', | |
id: 'cons$34cced3d_3d3a_44ec_b666_d9cd002d06da' | |
} | |
]); | |
$lasagnascript$module.first = function () { | |
var this$c292b2d7_2973_4b9b_80fa_0441763f191b = arguments[0]; | |
return this$c292b2d7_2973_4b9b_80fa_0441763f191b.first$21ac8d3d_0968_4d9f_9554_c6100104cc4d.apply(null, arguments); | |
}; | |
$lasagnascript$module.rest = function () { | |
var this$80ac2993_6688_4d08_bfd7_2eb2ae618203 = arguments[0]; | |
return this$80ac2993_6688_4d08_bfd7_2eb2ae618203.rest$20a4d8fc_6213_497c_ad8b_ff01e4a446c7.apply(null, arguments); | |
}; | |
$lasagnascript$module.cons = function () { | |
var this$af450617_fb5f_4952_9c19_fec5fb403fe6 = arguments[1]; | |
return this$af450617_fb5f_4952_9c19_fec5fb403fe6.cons$34cced3d_3d3a_44ec_b666_d9cd002d06da.apply(null, arguments); | |
}; | |
$lasagnascript$module.Seq.implement($lasagnascript$global.Array, [ | |
{ | |
name: 'first', | |
implementation: function (xs) { | |
return $lasagnascript$global; | |
} | |
}, | |
{ | |
name: 'rest', | |
implementation: function (xs) { | |
return $lasagnascript$global; | |
} | |
}, | |
{ | |
name: 'cons', | |
implementation: function (x, xs) { | |
return $lasagnascript$global; | |
} | |
} | |
]); | |
var product$41a5f157_6be0_4888_a7d0_1ef4087152de = product; | |
var tail$05ee3b02_d0af_469d_85b6_deb29499fb1b = tail; | |
var range$6b804e5d_9f96_45b2_8223_7139891f132f = range; | |
$lasagnascript$module.factorial = function (n) { | |
return product$41a5f157_6be0_4888_a7d0_1ef4087152de(tail$05ee3b02_d0af_469d_85b6_deb29499fb1b(range$6b804e5d_9f96_45b2_8223_7139891f132f(n))); | |
}; | |
$lasagnascript$global.Object.createProperty($lasagnascript$module, 'largeNumber', { | |
get: function () { | |
return 'largeNumber$915b8807_7778_49ed_aa94_dff9e3e5939d' in this ? this.largeNumber$915b8807_7778_49ed_aa94_dff9e3e5939d : this.largeNumber$915b8807_7778_49ed_aa94_dff9e3e5939d = $lasagnascript$module.factorial(10); | |
} | |
}); | |
$lasagnascript$module.Map = $lasagnascript$global.$lasagnascript$protocol([{ | |
name: 'map', | |
id: 'map$0430b2b3_f1d5_4ab2_afea_d471813cb92c' | |
}]); | |
$lasagnascript$module.map = function () { | |
var this$6fe5b28a_f798_4489_a18a_a5716d2617a7 = arguments[0]; | |
return this$6fe5b28a_f798_4489_a18a_a5716d2617a7.map$0430b2b3_f1d5_4ab2_afea_d471813cb92c.apply(null, arguments); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment