-
-
Save rightfold/e80134c26db303d50840 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) | |
} | |
implementation Seq for Array { | |
def first(this) = global | |
def rest(this) = global | |
def cons(x, this) = global | |
} | |
lazy foo = global | |
def printFoo = first(foo) | |
def square(x) = x * x | |
def cube(x) = square(x) * x | |
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$79a4262f_bdda_4469_8ca4_1604909ec5c3' | |
}, | |
{ | |
name: 'rest', | |
id: 'rest$a401a123_9c21_4f28_a989_3e1986b34b86' | |
}, | |
{ | |
name: 'cons', | |
id: 'cons$c1cf5260_6e6b_43db_9bdd_0cadc7c0ce90' | |
} | |
]); | |
$lasagnascript$module.first = function () { | |
var this$24b63f45_83a1_4ec8_85cd_3bc683408f50 = arguments[0]; | |
return this$24b63f45_83a1_4ec8_85cd_3bc683408f50.first$79a4262f_bdda_4469_8ca4_1604909ec5c3.apply(null, arguments); | |
}; | |
$lasagnascript$module.rest = function () { | |
var this$5291a22c_ecba_4e70_91b4_ef74b5005d53 = arguments[0]; | |
return this$5291a22c_ecba_4e70_91b4_ef74b5005d53.rest$a401a123_9c21_4f28_a989_3e1986b34b86.apply(null, arguments); | |
}; | |
$lasagnascript$module.cons = function () { | |
var this$33e43fa1_51c9_4a9a_99fe_e830429cb8b1 = arguments[1]; | |
return this$33e43fa1_51c9_4a9a_99fe_e830429cb8b1.cons$c1cf5260_6e6b_43db_9bdd_0cadc7c0ce90.apply(null, arguments); | |
}; | |
$lasagnascript$module.Seq.implement($lasagnascript$global.Array, [ | |
{ | |
name: 'first', | |
implementation: function (this) { | |
return $lasagnascript$global; | |
} | |
}, | |
{ | |
name: 'rest', | |
implementation: function (this) { | |
return $lasagnascript$global; | |
} | |
}, | |
{ | |
name: 'cons', | |
implementation: function (x, this) { | |
return $lasagnascript$global; | |
} | |
} | |
]); | |
$lasagnascript$global.Object.createProperty($lasagnascript$module, 'foo', { | |
get: function () { | |
return 'foo$ba2236fe_55d2_48b2_8ecc_0069af34ac4f' in this ? this.foo$ba2236fe_55d2_48b2_8ecc_0069af34ac4f : this.foo$ba2236fe_55d2_48b2_8ecc_0069af34ac4f = $lasagnascript$global(); | |
} | |
}); | |
$lasagnascript$global.Object.createProperty($lasagnascript$module, 'printFoo', { | |
get: function () { | |
return $lasagnascript$module.first($lasagnascript$module.foo); | |
} | |
}); | |
$lasagnascript$module.square = function (x) { | |
return $lasagnascript$global.$lasagnascript$asterisk(x, x); | |
}; | |
$lasagnascript$module.cube = function (x) { | |
return $lasagnascript$global.$lasagnascript$asterisk($lasagnascript$module.square(x), x); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment