« first day (640 days earlier)      last day (2009 days later) » 

12:02 AM
I'm trying to use apl.js
is there a way to return functions for future use, or call apl code?
like can I input to apl code, can I get results from one and send it to another?
are there examples of apl.js applications?
like apl('{⍵}')(3) or apl('{⍵}', 3)
for my uses it would be beneficial to be able to define functions using apl, and then save the result in a variable which could be passed to another apl function
is that possible?
f = apl('...')
result = f(3)

f1 = apl('...')
f1(result)
 
 
4 hours later…
4:20 AM
here's maybe an answerable question
I have a 3rd party .net library
where do I put it so I can "using externalLib" in apl?
 
4:39 AM
furthermore, I'm having a hell of a time declaring classes.... I'm in the .net documenation following things verbatim and getting "illegal character" or some noise.......................... I thought the whole point of APL was its simplicity and elegance, but then you find that every little thing has its own way of doing this or that and there is ultimately no consistency or intuitive path to follow for making any sort of appliccation
I'm reaching my point of exhaustion. I want to write a fucking applicaiton in APL, but I keep getting stuck
 
5:32 AM
using the gui poly methods is clearly not meant for interactive graphics, as things are moved and updated at fixed distances, like a snap-to. in other words, there doesn't seem to be a possibility for smooth animation
furthermore, attempting to ⎕USING←'System.Windows.Controls'
I try to create an instance of Canvas, but I get "Undefined Name Canvas"
I'm not seeing any further information regarding the htmlrenderer to get a context to a canvas to do things that way
and I'm not seeing how I can pass values in an out of APL defs using apl.js
why is it that the thing that APL seems strongest suited for, namely vectors, there is no simple way to draw with them?
 
 
2 hours later…
ngn
7:33 AM
@nathanrogers you can't pass in an argument directly but you could do this:
var ws=apl.ws()
ws('f←{...}')
ws('result←f 3')
ws('f1←{...}')
var result1=ws('f1 result')
@nathanrogers what are your uses? ngn/apl is slow and not really fit for anything more than trying out simple one-liners
 
 
3 hours later…
11:03 AM
@nathanrogers I've been making a Processing interface for my APL. Currently it's pretty slow & not fix for real use, but I hope to change that one day. A simple graphics interface for Dyalog is something I've wanted too
talking about speed, yay!
unfortunately, the speed of scalar functions has been halved, as now it's gotta go trough every array and convert them to Num objects as that's what the implementation asks for. :|
 
ngn
@dzaima is that really millis or seconds?
 
@ngn that's millis per one execution
 
ngn
 \t:10000 &1 0 200 200 205 6000
29
 
@ngn and that's what?
 
ngn
@dzaima total milliseconds
 
11:16 AM
@ngn eh, 10x worse performance than C++, I call that good :p
 
ngn
maybe we should test on the same machine :)
 
(well, ⍸1 0 takes 0.0073 millis already)
@ngn well, TIO still has the old version
oh right, my isn't even optimized for DoubleArrs :|
oh, right, 1 0 200 200 205 6000 doesn't even result in a DoubleArr ಠ_ಠ
 
ngn
@dzaima it's not c++, it's c without libraries optimised to the best of my (well, not so great) abilities; 10x worse sounds very good
@dzaima is your new code in the repo?
 
@ngn not yet, as way too many things are still probably broken, but I'll make a branch
94 staged files :D
@ngn there
this is all 2 different commits :D
 
ngn
11:42 AM
> 10000 ⎕htime '⍸1 0 200 200 205 6000'
0.2484925704 millis
^ it improved on the third run
 
@ngn that's java for you
 
ngn
@dzaima that's more like cpu architecture, caches, etc...
 
well that too of course
 
ngn
in my perf tests i measure 5 times and use the median
 
@ngn I just take the fastest because there's no reason for the others to be slower :p
 
ngn
11:46 AM
@dzaima that makes sense too
i noticed sometimes i get inexplicable occasional small speed-ups, so i wanted to cut them off
 
@dzaima (well i don't really do perf tests)
 
ngn
@dzaima you don't do tests at all :)
 
:p
yeah, really should since intellij literally has alt+enter enter enter to create tests :p
 
ngn
@dzaima mine are not as sophisticated as that - i have a file in which every line is an expression and a comment with the expected result
in the beginning of the file there's a little k code that parses its own file and checks the result of every expression
 
@ngn I guess that'd be simpler to use, but can't really handle testing all the different array types
(unless I make forced casts which I should anyway)
 
ngn
11:57 AM
every expression is run in a separate process, and still all ~330 tests complete in ~100ms
@dzaima you don't have to test absolutely everything...
 
The most errors I'd expect is some function working fine for DoubleArrs but not HArrs though
 
ngn
@dzaima what is HArrs?
 
@ngn non-unitype arr
e.g. I just fixed ⎕COND←'01' not working since it was expecting a HArr but got ChrArr
I stupidly did the refactoring so every Arr got replaced with HArr, making many places have arr instanceof HArr instead of arr instanceof Arr
 
ngn
oops, i forgot to switch to your branch...
 
@ngn oh, I didn't even pay attention to the 0 count there :p
 
ngn
12:05 PM
> 10000 ⎕htime '⍸1 0 200 200 205 6000'
0.0208457843 millis
^ best after about a dozen attempts
 
@ngn yeah, about what I get now too
ooh now I can make VarArr be an instance of Arr and remove all the annoying conversions :D
 
@dzaima On tio, 1⊤10 gives an infinite loop
 
@H.PWiz with a scalar ⍺ ≡ ⊥⍣¯1. Should make it error though.
o.O 1(⊥⍣¯1)1 gives 0 0 in Dyalog
@H.PWiz or should that return 10? or 1 1 1 1 1 1 1 1 1 1?
 
ngn
@dzaima in base 1 the only digit should be 0
 
12:20 PM
@ngn so, domain-error for ⍵>0?
 
ngn
@dzaima i don't know
 
 
1 hour later…
ngn
@dzaima oh! you're doing it the fast way?? as we discussed yesterday? nice :D
 
I have 2 options: deal with, or hook up C macros to java
@ngn what did you expect? :p
I mean, only - has the optimized cases & every other vectorizing function is 10x slower, but it's progress
 
ngn
@dzaima a few months of hesitation :p
 
@ngn I've had like exactly nothing else to do for the last couple of days :p
 
ngn
@dzaima another option is a switch(x.type){...} or a series of if(x instanceof DoubleArr)...etc
 
1:45 PM
@ngn I do that in the vectorizer
 
ngn
@dzaima java's static typing is getting in the way :)
 
oh right 1 2 3-2 58 4 0 :|
@ngn in what way? The casts there seem very logical to be there
and static typing is the thing that makes intellij able to to so many awesome things
@dzaima ಠ______ಠ I implemented - as +
 
ngn
@dzaima don't mind me... i should read your code in more detail before i say anything
@dzaima now that you have DoubleArr, do you really need Num?
 
@ngn DoubleArr can't be scalar
 
ngn
@dzaima why not?
empty shape can mean scalar
 
1:56 PM
the check for being a simple scalar is instanceof Primitive, and Primitive and Arr are distinct
 
ngn
@dzaima it's either rework that check or duplicate all arith ops in both classes
the check could be: is the shape empty ∧ is the array non-generic
 
I'd rather keep Num around. Is there much benefit of not having it?
 
ngn
@dzaima ok, i don't want to hinder your progress
@dzaima the benefit is having only one impl of each operation
 
@ngn I'd still need to special-case either side having scalars though
@ngn no, if you've got good reasoning, keep trying to force me to do stuff differently :p
 
ngn
@dzaima what is Rank0Arr for? couldn't it be just an Arr with an empty shape?
 
2:10 PM
@ngn yes it could, it's just a quick constructor, and doesn't bother storing an array with items as it only has 1
same with Shape1Arr & EmptyArr
> 1 2 3
3 2 1
ಠ_______ಠ
 
ngn
@dzaima :D
@dzaima huh... isn't it better to process things in a uniform way
like, always have an array of values, which sometimes just happens to consist of 1 (or 0) elements?
 
@ngn there's no universal item array for Arr, because DoubleArr shouldn't store the individual numbers.
of course, those 3 special classes could very easily be instances of HArr, but I decided to not because I have the ability to
the three also store their shapes as static final arrays, so the instances doesn't waste more space on that more than a pointer to it
(not that that'd change much in any point of time)
@dzaima interesting how the only thing I noticed wrong there at first was that the mismatched lengths work just fine. 1-2 = 8 ¯\_(ツ)_/¯
's why you do tests
 
ngn
@dzaima empty arrays being reused - that's a small gain for the added complexity
 
@ngn it really adds no complexity. Nobody except the class knows about the class
the only references to Rank0Arr & Shape1Arr & EmptyArr are only constructors of them
they're just fancy replacements for new HArr(new Value[]{val}, new int[]{1}) & new HArr(new Value[]{val}, new int[]{}) & new HArr(new Value[]{}, new int[]{0}) and save a little space.
 
ngn
2:27 PM
ok, maybe i should look at the impl of a function, e.g. +, to understand how this works...
 
@ngn the default way to get an item from an Arr is get(int). The Arr instance decides what to do with those requests
@ngn this is what you should be looking at (and the other alike functions in the file)
 
ngn
@dzaima so for a vector of length n you're calling .get(i) n times?
 
@ngn for the general case, yes.
(or you call values() and play around with the returned Value[], or use iterators)
 
ngn
@dzaima what about 1 2 3+4 5 6 (both sides are simple numeric vectors)? does it still go through .get(i)?
 
@ngn no, that's special-cased by the 1st 3 lines in scalarNum
 
ngn
2:35 PM
@dzaima ok, that sounds good then :)
 
@ngn the idea is provide sub-optimal defaults and the option to optimize things when there's the need
 
ngn
@dzaima you're so thrifty about the empty arrays, yet you have .rank and .ia in Value.java ;)
 
@ngn I know I know :p
rank could easily be removed but ia has to be there if you don't want to be multiplying the shape together extremely often
@ngn really the reason those classes exist are the quick-to-type constructors. The space savings are just a little bonus
 
ngn
@dzaima well, .ia is .values.length in those subclasses in which you have something like .values
 
@ngn but there's no default .values
and I do indeed in constructors of those do ia = arr.length
 
ngn
2:43 PM
@dzaima yeah, that's a bit of a problem in java... Value[], char[], and double[] have no common supertype
 
@ngn I don't want to be forcing any array on the subclasses either, i.e. a ArrayOfOnes class should be able to hold 2**31 ones :p
more usefully, a univalue array type would be cool
 
ngn
you could have .getIA() and not waste a field for .ia
further down you have transient private Value[] vs; - what is that for?
 
@ngn ia gets queried so often I think that'd be a major speed decreaser
@ngn a cached result of values() :p
1 2 3-5-4 0 0 huh
oh copy paste error
 
ngn
2:58 PM
oh, you fixed it already :)
@dzaima if i were you, i'd make DyNumVecFun.call()'s args double-s and double[]-s instead of Nums and DoubleArrs, to avoid repetition
 
@ngn true, probably no real use-case to not
I guess it makes sense to have the shape restoring outside of the call function
 
ngn
this is also my cunning plan to rid you of some usages of .ia :)
 
:O :p
right, that also makes the copy-paste error before impossible too
should the result be forced to be double/double[] though?
also removes the stupid new Num calls in the defaults :D
 
ngn
@dzaima well, i would say yes - do it the simpler way, though some arith fns in apl can return complex numbers even when their args are reals
 
@ngn oh complex functions.. I'll leave those for way later
when time comes for them I'll probably make concatenated array types where I can add doubles hoping for the best and once a complex comes in I can switch to a complex number array type & join the two parts together in the output
oh I'll even move the result double[] creation out of the implementation :D
 
ngn
3:18 PM
@dzaima ah, right, for arith fns the result's length is computed in the same way
 
ngn
@dzaima well, by java standards :)
 
@ngn a line in java = a char in APL :p
 
ngn
public double call(double a, double w) { ... }
@dzaima ^ if you represented scalars as DoubleArrs with an empty shape, you wouldn't need that :)
 
@ngn eh true, but I could also manually wrap them in double[] in the vectorizer
 
ngn
3:32 PM
@dzaima true
 
really that line should be of Nums because it should never be used in any other way
 
ngn
@dzaima looks like is broken
 
@ngn huh.
oh yep, it expects the argument to be HArr otherwise it works like on a primitive
also scatter set was broken
also a←1 2 ⋄ a[1]
 
 
1 hour later…
4:49 PM
@ngn I just need simple animation/translation of shapes on a canvas. I'm trying to follow along a genetic algorithm / cellular automation course which involves drawing to visualize results, but I can't figure out how I'm supposed to draw anything sensible with APL
I'll give that ws function a shot and see if I can use it the way I want
@ngs copying from your example I get "apl is undefined"
ok I got the problem resolved. I'm able to declare a variable and modify it elsewhere. @ngn my question now is how do i get values out of the "APLarrays"
 
ngn
@nathanrogers would ascii art be sufficient?
@nathanrogers after var x=apl("...");, x.a is an Array or Array-like object (e.g. Float64Array), so you can get the data directly from there
x.s is the shape
@zeynel did you manage to configure the mac keyboard?
 
5:27 PM
no ascii art is not sufficient
ws('⍳10 10')
this returns nested custom datatypes, and there is no .a property or .s
 
ngn
@nathanrogers x.a[i] are similar objects with their own .a and .s
 
that was my question, there's not "toJsArray" or anything included in the result?
I have to map it?
 
ngn
@nathanrogers correct
 
:(
i suppose for simple vectors that should matter much
does the js object that is returned resemble how APL is actually interpreted?
10 10⍴0 is actually a single 1 value with a shape property of 10 10?
 
ngn
@nathanrogers i'm not sure what you mean?
 
5:37 PM
data: [0]
offset: 0
shape: (2) [10, 10]
stride: (2) [0, 0]
__proto__: Object
10 10 ⍴ 0 , that is the result from ws
I suppose I have a recursive reshape function, but that is defeating the purpose of having it written in APL if I have to digest the result manually. I could just call [0].reshape(10, 10)
 
ngn
@nathanrogers that looks like a very old version of ngn/apl, where did you get it from?
 
npm install apl
 
ngn
@nathanrogers oh...
i should find a way to remove that
better get it from here: gitlab.com/n9n/apl
or even better, use a more serious array language implementation - dyalog, J, k :)
@nathanrogers regarding your cellular automata - is the output a static image or an animation?
 
animation, and it isn't just cellular automation. it's other kinds of automation as well which involve animation
but we're starting with cellular, so I'm trying to figure out that part
 
ngn
@nathanrogers so you need something like iKe? (i might have posted this link before, sorry if i'm repeating myself)
 
5:50 PM
@ngn that's really cool
only I don't know K
is there documentation for ike?
 
ngn
@nathanrogers and here is some documentation about k (oK): github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md
 
is there nothing like this for APL?
 
@nathanrogers there's my APLs Processing integration, but that's not for browsers
 
ngn
@nathanrogers i'm not aware of such a thing, other than dzaima's; Adam might know more
 
6:06 PM
well, I guess I got 3 options. I can use @ngn apl.js inside P5, which might be an option, or I can do iKe with K, but I'm the least familiar k, or I can try to learn J with openGL
or if someone has some idea of how to use the .Net Canvas with APL? I spent all night trying to import it and Ic ouldn't figure it out
though, I've also tried interacting with an HTML canvas, to no avail. not sure how that dynamic works
 
ngn
@nathanrogers i'm always happy to chat about k; i don't know much about J or openGL or .Net
@nathanrogers i've used canvas for small experiments. where did you get stuck?
 
the whole point of this endeavor was to learn APL, so I would prefer to stick with APL
 
ngn
as you wish
 
so I can create a canvas, but I'm uncertain how to get the handle to draw
and if I did, I'm uncertain how to iterate with the whole "requestAnimationFrame" to make it animate
 
ngn
@nathanrogers there's the mozilla canvas tutorial if you want a quick intro
 
6:13 PM
I meant in APL
you get the canvas, you get the context, now with context you can move to, line to, etc.
but how do I get that context in apl to do the drawing
 
ngn
@nathanrogers is that with MiServer?
 
with htmlrenderer
are you saying that I should look at MiServer?
 
ngn
@nathanrogers i don't know much about it :(
@nathanrogers did you have a chat with Brian?
 
i think so
he told me about how to make guis
I don't need to make guis
 
currently 2⍴⍬ gives 0 0 and 2⍴'' gives " ", just by relying on the classes
 
ngn
6:26 PM
@dzaima perfect :)
 
2⍴!⍬ gives 2 javanulls though as I haven't made ! work for DoubleArr :p
 
 
3 hours later…
9:47 PM
@ngn :D
oh replacing {⍵⊃cols}¨ with cols⊇ makes it run 60fps for is←...⍳200 too :D
 
ngn
@dzaima how can i run this?
 
@ngn I've yet to commit the changes to APLP5, gimme a bit
, & & & & all convert the DoubleArr to HArr, so there's way more optimizing to do for that
@ngn this; The default example is that code aleady
 
ngn
n@h:~/gh/dzapl/app$ ./convert.py
copied
replaced
error count: 86
error count: 10
error count: 3
error count: 2
error count: 0
rm: cannot remove 'APLApp/code/APL8.jar': No such file or directory
mkdir: cannot create directory ‘build’: File exists
 
@ngn yeah
 
ngn
@dzaima ^ did it fail or succeed?
oh, ok
@dzaima i don't understand step "2. run APLP5 in Processing"
is "Processing" something i have to install?
 
10:04 PM
@ngn 1) get processing.org 2) file->open that
@ngn it's the whole graphics backbone to the thing
I'll link that in the readme
 
ngn
yay! :)
i can use this to hypnotise the cat
@nathanrogers ^ you might be able to use it for something a bit more serious :)
 
⍸?
how do I do stuff?
i have processing already
 
@nathanrogers this
 
wew
i'll check it out
 
10:23 PM
though if you're doing cellular automation, warning, isn't implemented
 
idk what that even does
 
@nathanrogers it's a built-in for cellular automation :p
 
:D
so hey
I ran convert
copied
replaced
error count: 0
error count: 0
error count: 0
error count: 0
error count: 0
rm: cannot remove 'APLApp/code/APL8.jar': No such file or directory
rm: cannot remove 'src/build/APL': No such file or directory
./build8: line 7: javac: command not found
./build8: line 9: jar: command not found
cp: cannot stat 'APL.jar': No such file or directory
mv: cannot stat 'APL.jar': No such file or directory
is that normal?
or java needs to be installed?
 
@nathanrogers yeah that.
Either java 8 or 10, but 8 requires removing --release 8 from some files
also I'm gonna disappear in 5 mins so there's that
 
i warn you, I know nothing about java
:(
 
10:27 PM
@nathanrogers you don't need to:)
 
i might have a slew of questions for your return
 
ngn
@dzaima stupid question: why do you need Processing for this? it looks like plain awt/swing would do
 
what I mean I always jack up something with the jre/jdk/wtf/roflmao
 
you just get processing open, open APLP5 and run it.
@ngn because that'd take extra work
 
cannot find class NULL
:(
APLMap does not exist
error count: 0
error count: 0
error count: 0
error count: 0
error count: 0
rm: cannot remove 'APLApp/code/APL8.jar': No such file or directory
rm: cannot remove 'src/build/APL': No such file or directory
./build8: line 7: javac: command not found
./build8: line 9: jar: command not found
cp: cannot stat 'APL.jar': No such file or directory
mv: cannot stat 'APL.jar': No such file or directory
still getting that after install java
oh actually, I didn't install it in my WSL
whoops
doing all this installation and the suspense is killing me
i hope it works :P
APL.errors.ValueError: tying to get value of non-existing variable idea
 
10:53 PM
yeah, something isn't working
I got java installed, processing, opened APLP5 in processing and I'm getting errors when I try to run it
 
11:08 PM
i need intelliJ idea?
 
ngn
@nathanrogers no
 
then what's this "non-existing variable idea"
i've installed java, jre/jdk. I tried the android setup he mentioend inthe read me, but then it says no devices found
 
ngn
i've no idea. i don't have intellij and it worked for me
 
what did you do?
are you on windows?
 
ngn
@nathanrogers i already had the jdk, i just downloaded processing, unpacked it, ran it, opened APLP5 and pressed the play button
@nathanrogers no, i'm on debian
 
11:11 PM
APL.errors.ValueError: tying to get value of non-existing variable idea
 
ngn
@nathanrogers oh, i think i know what's happening :)
 
ngn
do this: git checkout speed
dzaima created a new branch and this "iKe example" ended up there
 
git clone https://github.com/dzaima/APL/tree/speed
Cloning into 'speed'...
fatal: repository 'https://github.com/dzaima/APL/tree/speed/' not found
 
ngn
@nathanrogers haven't you cloned the repo already? just switch to the "speed" branch
@nathanrogers the url you're trying to clone now looks wrong
 
11:19 PM
i had downloaded it with zip
yes I cloned the repo just now
reran conert.js
convert.py I mean
same error, missing variable idea
 
ngn
did you do "git checkout speed"?
 
git clone APL -> git checkout speed
 
ngn
hm... i don't know, i don't get such an error
 
11:59 PM
@zeynel Did you check you the macOS tab at the bottom of this page?
 

« first day (640 days earlier)      last day (2009 days later) »