From 1d7dbc4dbe92ea3f7fcf603318baf522881660a8 Mon Sep 17 00:00:00 2001 From: zgrep Date: Tue, 14 Aug 2018 19:24:26 -0400 Subject: [PATCH] Modify all the things! --- ok/ircconvert.js | 74 ++++++++++++++++++++++++++++++++++++++++++++++++ ok/ircrepl.js | 26 ++++++++--------- ok/readme.md | 17 +++++++++++ 3 files changed, 104 insertions(+), 13 deletions(-) create mode 100644 ok/ircconvert.js diff --git a/ok/ircconvert.js b/ok/ircconvert.js new file mode 100644 index 0000000..1607e6c --- /dev/null +++ b/ok/ircconvert.js @@ -0,0 +1,74 @@ +//////////////////////////////////// +// +// A companion to oK which bridges +// the gap between k-values and +// native JavaScript types. +// +// John Earnest +// +//////////////////////////////////// +// +// See ok-license.txt for the license. +// Modified by zgrep because zgrep is just that annoying. + +"use strict"; + +function tok(v) { + if (typeof v == 'number') { + return { t:0, v:v }; + } + if (v === false) { return { t:0, v:0 }; } + if (v === true) { return { t:0, v:1 }; } + if (typeof v == 'string') { + var r = []; + for(var z=0;z ircoK.js ``` Now use `ircrepl.js` for a repl. + +--- + +Differences and similarities with ok: + +- `0:` reads from a URL. +- `1:` does the same, but decodes json. +- Has trig functions! `sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, tanh2` +- Has other functions! `abs, pow` +- Supports `n\n`. +- Has whatever's in the [okrc](https://zgrep.org/taxreturns/okrc.txt) as a thing by default too. +- `2+2` is 5 (unless it's within some other computation, I'm not that mean). +- Some useful "commands": + - `reset` resets variables and stuff. + - `manual` links to [this manual](https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md). + - `reference` or `ref` links to http://kparc.com/k.txt + - `okrc` or `rc` links to the okrc file.