var arr1 = [ {foo:1, bar:2},
{foo:3, bar:4},
{foo:5} ]
\
| var __objectInheritanceCalculated = []; | |
| while((function() | |
| { | |
| /* There is a object class that has not been processed */ | |
| var __t = 0; | |
| for (var m in objectclasses) { __t++; } | |
| if (__t <= __objectInheritanceCalculated.length) return false; | |
| return true; | |
| })()) | |
| { |
| // Split colon-separated parts, unescaping (but not splitting on) any \: | |
| function split(str) { | |
| return str.match(/(?:\\:|[^:])+/g).map(function(part) { | |
| return part.replace(/\\:/g, ':') | |
| }); | |
| } | |
| // Eg. |
| function a(a1, callback) { | |
| // ...does stuff | |
| callback("a", "b", "c") | |
| } |
| js> function inspect(obj) {var res = []; for (var k in obj) res.push([k, typeof (o = obj[k]) == 'boolean' ? o : typeof o].join(":")); return "{ " + res.join(", ") + " }"} | |
| js> print(Object.getOwnPropertyNames(this).map(function(n) {return [n, inspect(Object.getOwnPropertyDescriptor(this, n))].join(Array(24-n.length).join(" "))}).join("\n")) | |
| Function { value:function, writable:true, enumerable:false, configurable:true } | |
| Object { value:function, writable:true, enumerable:false, configurable:true } | |
| eval { value:function, writable:true, enumerable:false, configurable:true } | |
| PerfMeasurement { value:function, writable:true, enumerable:false, configurable:true } | |
| version { value:function, writable:true, enumerable:false, configurable:true } | |
| revertVersion { value:function, writable:true, enumerable:false, configurable:true } | |
| options { value:function, writable:true, enumerable:false, configurable:true } | |
| load { |
| local Base = require('library').Base | |
| local Person = Base { | |
| -- missing properties: name | |
| speak = function (self) | |
| return "Hello, I am " .. self.name | |
| end | |
| } | |
| local Programmer = Person { |
| JS: The Hip Parts. | |
| Chapters = | |
| [ Comma-First is Comma Right | |
| , !function Expressions! | |
| , <!--Comments with Style--> | |
| , Blow it Out Your Semi-Colon ] |
| #include <stdio.h> | |
| #include "xorlist.h" | |
| int main(void) { | |
| struct Node *list = NULL; | |
| for (int i=1; i<=15; i++) { | |
| push(i, &list); | |
| } |
| function foo(bar) { | |
| return bar === baz? 'hello' | |
| : bar === quux? 'hey' | |
| : /*otherwise*/ 'hi' | |
| } |
| define { | |
| -- { drop } | |
| foldl { | |
| --{ x0 xs f → v, fold list with function } | |
| dequote | |
| choose{ | |
| rearrange{B}{_ B _} | |
| }{ |