Skip to content

Instantly share code, notes, and snippets.

@rdm
rdm / purple-triangle.ijs
Created January 12, 2023 07:39
Where would console.log go?
webgl_close=: {{ wd'pclose'}}
wd bind{{)n
pc webgl; cc w webview;
pmove 0 0 300 300;
pshow;
set w html *
<html><head><title>test</title></head>
<script>
function run(){
console.log('hi');
@rdm
rdm / vm+instr.ijs
Created February 4, 2023 15:10
"Thinking in states" using slightly more idomatic J
NB. a rephrase of the J implementation at https://www.metalevel.at/tist/
instrs=: 9 33 1 1 2 1 4 1 3 0 2 1 12 30 3 1 3 0 7 4 1 3 0 2 1 6 4 0 9 8 3 1 15 2 4 13 2 14 0
st=: 0 {:: ]
is=: 1 {:: ]
pc=: 2 {:: ]
fp=: 3 {:: ]
next=: (>:&pc { is)
readmanifest=: {{
coerase([cocurrent)cocreate ''
0!:100 y
(;".)every nl 0
}}
manifests=: <@readmanifest"0 (#~ '/manifest.ijs' +./@E.S:0 ]){."1 dirtree '~addons'
manifestget=: {{ ({:"1 y){::~({."1 y) i. boxopen m }} (L:1)
addon=: 'FOLDER' manifestget
description=: 'DESCRIPTION' manifestget
entering /mnt/c/cygwin64/home/15712/jsoftware/jsource/make2
jplatform64=linux/j32
CC=clang
compiler=/usr/lib/llvm-11/bin/clang
CFLAGS= -fPIC -fvisibility=hidden -fno-strict-aliasing -Werror -Wextra -Wno-unknown-warning-option -Wsign-compare -Wtautological-constant-out-of-range-compare -Wuninitialized -Wno-char-subscripts -Wno-consumed -Wno-delete-non-abstract-non-virtual-dtor -Wno-empty-body -Wno-implicit-float-conversion -Wno-implicit-int-float-conversion -Wno-int-in-bool-context -Wno-missing-braces -Wno-parentheses -Wno-pass-failed -Wno-pointer-sign -Wno-string-plus-int -Wno-unknown-pragmas -Wno-unsequenced -Wno-unused-function -Wno-unused-parameter -Wno-unused-value -Wno-unused-variable -ggdb -O0 -m32 -DPYXES=1 -DREADLINE -DUSE_LINENOISE -I../../../../mpir/include -m32 -msse2 -mfpmath=sse
clang -c -o state.o ../../../../libbacktrace/state.c -fPIC -fvisibility=hidden -fno-strict-aliasing -Werror -Wextra -Wno-unknown-warning-option -Wsign-compare -Wtautological-constant-out-of-ra
@rdm
rdm / tabledit.ijs
Created July 30, 2023 18:55
jqt: tab separated values file editor
NB. file editor
NB. design favors convenience over crispness
NB. (on close can restart and pick up where left off if J session remains active)
require'tables/dsv'
NB. default directory for file open
getfilename=: {{wd 'mb open1 "Select TABle file" *',y}}
NB. get/set commands