┌──────────────────────────────────────────────────────────────────┬────────────┐
│ fn1 fn2.. ←buttons are functions defined in x.k as xkfn1:{[]..} │ save x.k │
├──────────┬───────────────────────────────────────────────────────┴────────────┤
│i│a │b │←table header │
│0│abc│1.23│ │
│1│def│4.56│ ┌~─────────────┐ │
│2│ghi│7.89│ │ editor .. │ │
│ │...│ │ │ k-output .. │ │
│ │ │ │ │ plot area .. │ drag│
│ │ │ │ └─────────────~┘ ↓│
│ │ │ ├────────────────────────────────────────────────────────────────────┤
│ │ │ │ │
│ │ │ │←drag │
├─┴───┴────┴─────┬────────────────────────┬─────────────────────────────────────┤
│A B + ← tables │ (select by k-expr) │ k-console input │
└────────────────┴────────────────────────┴─────────────────────────────────────┘
a,b,c,z, i,s,f,r,a 0,abc,1.2,1.2,30 1,de,3.4,4.5,336.8
┌────┬─symtab───────────────────────┐ │i32 │read next n bytes for symtab │ │u8 │symbols(utf-8) 0-joined │ symbols are indexes into this array │i32 │number of tables nt │ ├────┼─table────────────────────────┤←──────┐ │i32 │table name(as a symbol index) │ │ │i32 │number of columns nc │ *nt│ │i32 │number of rows nr │ │ │i32*│header symbol vector #nc │ │ ├────┼─column───────────────────────┤←─┐ │ │u8 │column type: one of c i f z │ │ │ ├────┼─data─────────────────────────┤ │*nc │ │* │(i32│f64)*nr z:2*nr real/imag│ │ │ ├────┼─k program────────────────────┤──┘────┘ │i32 │ number of bytes nk │ │u8* │ program source │ └────┴──────────────────────────────┘a js implementation is in the page source (see wbin), or a Go implementation in xk.go.
tables
{A:{...}}
tables.A
{top:0, sel:'!0', h:Array(4), t:Array(4), d:Array(4), n:1078, name:"A", sel:'!0', isel:Int32Array(0)}
tables.A.h //header
['class', 'temp', 'pressure', 'vel']
tables.A.t //column type
['s', 'f', 'i', 'z']
tables.A.d //data
[Array(1078), Float64Array(1078), Int32Array(1078), Float64Array(2156)]
+ in the bottom left corner next to the table list.id:s
add rows, enter the number of rows to add.store built-in.
explode built-in) and assigned to global variables, e.g.
&b>5 can be used to select rows with values of column b > 5.
Columns of other tables must be reference by their name, e.g. C`a
selections can be used to restrict an analysis to a subset of rows. e.g. for k, the selected index list of table A is stored in a variable called Asel.
selections are also used to interactively edit multiple rows at a time: select rows then right click on the table to switch to the data edit ui.
x.k in the top right corner to show it in the editor, double-click x.k for full screen editing.
double-click on a function button to show the k program with the xk-function highlighted.
k is restarted at each button click, and all code runs after the tables are assigned to variables.
ui functions are prefixed with "xk" and are niladic, e.g. xkone:{[]1} shows up as a button with title one.
when the code is modified, the title bar updates automatically.
store to update the ui.
plot see plot
image shows an image in a canvas, 3 methods rows^I rows^C rows^F
I stores rgb values in an integer, C uses a grayscale and F a built-in colormap between zmin,zmax (see plot/axis)
explode explode t explodes columns of table t and assigns each column vector to a global variable. it also assigns i:!#t
store store`T overwrites table T within the js data from k, e.g. add a column: T::T,'+`f!,?#T;store`T
store is the only command that modifies data from k. everything else does not persist.
1+ \!10 or with a label: 1+`seq \!10
plot 0 i current plot index, they are displayed side-by-side plot`polar s plot type: `xy`bar`polar`ampang`square plot`xlabel`ylabel`title S labels plot(x;y0;y1;..) L x:i|f|I|F y:I|F|Z multiple lines (atom x:sampling rate) plot 0 1 -10 10 I|F axis limits, length 1..6: y1 x0,x1 x0,x1,y1 x0,x1,y0,y1 x0,y1,y0,y1,z0,z1 plot".oO" c|C point/line style, cyclic per line. points(.oO08) lines(-=#) arrow(>) /or use each (multiple calls to a list, add a line each time): plot'(`time`distance;(x;3+cos x);(x;5+sin x:0.1*!10);0 1 0 10)plot functions have side effects, state is stored in js until the next button is clicked. all plot functions return the plot index, thus can be chained and e.g. index into a multi-dimensional data structure.
the return value from a function that plots as a side-effect is displayed in a listbox under the plot.
if the value is a table or keytable that has the same number of rows as there are lines, they are connected:
click on the row to highlight the associated line (see the tby example).
save to download the current state of the application xk.html.
the file contains everything: data+code+k.wasm+plot.js embedded in the html file.
file size may be <100kb for little data.
it runs in a browser from a file url, e.g. double-click in a file manager.