Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
350 changes: 175 additions & 175 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion browser-runtime/browser_env.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function (runtimeContext) {

env.sync();

env.bind(new IronSymbol ('_readfile'), _readfile)
env.bind(new IronSymbol ('_readfile'), _readfile);
env.bind(new IronSymbol ('_readsource'), _readfile);
env.bind(new IronSymbol ('_import'), importfn(env) );
env.bind(new IronSymbol ('_include'), includefn(env) );
Expand Down
2 changes: 1 addition & 1 deletion browser-runtime/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class Package {
head.removeChild(script);
this._loadlock -= 1;
if(this._loadlock===0) this.run();
}
};
loadScript (imp.url, cb);
}
}
Expand Down
18 changes: 9 additions & 9 deletions iron/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import Env from './env.js';
import IronSymbol from './symbol.js';

class Store {};
class Store {}

export class Reference {
constructor (cmd, obj, ...keys) {
Expand Down Expand Up @@ -90,19 +90,19 @@ export class Collection extends Store{
else this.obj = Object.create(null);


this.has = (key) => { return this.obj[key] !== undefined; }
this.has = (key) => { return this.obj[key] !== undefined; };

this.get = (key) => {
if (typeof key !== 'string') return undefined;
if (this.has(key)) return this.obj[key];
return undefined;
}
};

this.set = (key, val) => {
if (typeof key !== 'string') return undefined;
this.obj[key] = val;
return this.obj;
}
};
}

static isCollection (obj) {
Expand All @@ -120,28 +120,28 @@ export class Sequence extends Store{
this.get = (ind) => {
if (parseInt(ind) === Number(ind)) return this.arr[ind];
return undefined;
}
};

this.set = (ind, val) => {
if (parseInt(ind) === Number(ind)) {
this.arr[ind] = val;
return this.arr;
}
return undefined;
}
};

this.push = (val) => {
this.arr.push(val);
return val;
}
};

this.pull = () => {
return this.arr.shift();
}
};

this.pop = () => {
return this.arr.pop();
}
};
}

static isSequence (obj) {
Expand Down
8 changes: 4 additions & 4 deletions iron/evalAsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ export const defaultCallback = () => {
if (err instanceof IError) err.log();
throw err;
}
}
};
};

export const endOfExecution = () => {
return (err) => {
if (!err) console.timeEnd("Runtime");
else throw err;
}
};
};

export function cellToArr (cell, arr, env, cb) {
Expand Down Expand Up @@ -211,7 +211,7 @@ export default function evalAsync (x, env, cb=endOfExecution() ) {
//create a callback for async.map / async.filter
let cbfn = (arg, _cb) => {
nextTick (func, null, env, (err, _env, _, val) => {_cb(err, val);}, arg.val, arg.index);
}
};

if (_map.equal(xarray[0])) mapLimit (arr, 32, cbfn, (err, newarr) => {
if (seqIsSequence) cb( err, env, null, new Sequence(newarr));
Expand Down Expand Up @@ -519,7 +519,7 @@ export default function evalAsync (x, env, cb=endOfExecution() ) {


else if (Stream.isStream(func)) {
func.addcb(cb)
func.addcb(cb);
cb( err, env, null, func.value);
}

Expand Down
10 changes: 5 additions & 5 deletions iron/higher.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ export function fxAsync (f) { // f = ($return, $throw, $catch, $env, ...args) =>
_cb( null, _env, null, retval);
exited = true;
}
}
};

let $throw = (_err) => {
if (!exited) {
_cb( _err, _env, null, null);
exited = true;
}
}
};

let $catch = (catchFn) => {
if (err) catchFn(err);
}
};

let $yield = (retval) => {
_cb( null, _env, null, retval);
}
};

f($return, $throw, $catch, $yield, _env.par, ...args);
}
};
}
4 changes: 2 additions & 2 deletions iron/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function importfn (env) {
});
} , basename(sourcename));
}
}
};
}

export function includefn (env) {
Expand Down Expand Up @@ -130,7 +130,7 @@ export function includefn (env) {
});
}, basename(sourcename));
}
}
};
}


2 changes: 1 addition & 1 deletion iron/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class Lexer {
let ret = [];
for (let x of arr) {
if (isNaN(Number(x))) ret.push(x);
else ret.push(Number(x))
else ret.push(Number(x));
}
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion iron/rho.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Resolution {
class Reduced {
constructor (body, params, args) {
this.body = body;
this.params = params
this.params = params;
this.args = args;
}
}
Expand Down
6 changes: 3 additions & 3 deletions iron/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export default class Stream {
this.value = undefined;

this.callbacks = [];
this.addcb = (cb) => { this.callbacks.push(cb); }
this.addcb = (cb) => { this.callbacks.push(cb); };

this.push = (val) => {
this.value = val;
if (val !== null && val !== undefined) for (let cb of this.callbacks)
nextTick (cb, null, this.env, null, val);
}
};

nextTick (this.core, (val) => {
this.value = val;
Expand All @@ -51,7 +51,7 @@ export default class Stream {
static isStream (obj) {
return obj instanceof Object && obj.__itype__ === 'stream';
}
};
}



Expand Down