« first day (637 days earlier)      last day (2004 days later) » 

1:08 AM
116 char drawing program with undo support :D
 
 
6 hours later…
6:45 AM
@dzaima :D how do I run that?
rip shopt -s globstar errors
 
 
3 hours later…
9:33 AM
@Cowsquack oh I was afraid that'd happen to someone.. Literally any method of compiling java should work in place of that though
 
also I need java 10 or whatever is the version that has vars
 
@Cowsquack the whole point of convert.py is to remove those :p
 
ngn
@dzaima you could use $(find APL -name '*.java') instead of APL/**/*.java
 
@ngn yeah, i'm a shell noob
 
also I had to change the shebang of convert.py to #!/usr/bin/env python3
 
9:43 AM
^^ .
 
 
1 hour later…
10:56 AM
I wanted to try to make a grapher similar to the android app one in my APL but remembered that linkedlists & priority queues are very unAPLy..
is there any other way to implement the idea that efficiently though?
 
11:34 AM
oh right my stupid priority queue is backed by a linked list and has insertion being O(n) (because I wanted O(1) removing), time to learn heaps first i guess ಠ_ಠ
 
ngn
12:12 PM
@dzaima what do you use those linked lists and priority queues for?
 
@ngn there's a linkedlist of the points to draw left-to-right, and a priority queue of the distances between adjacent points so I'd know where I need to add precision (or remove it in the case of zooming out)
the nodes of both link back to each other so it's pretty easy to remove & add points
APL isn't well suited at all for doing any log(n) operations though
 
ngn
@dzaima so, you start by evaluating the function at equally-spaced xs and wherever |f(x[i])-f(x[i+1])| is too great, you insert more xs inbetween?
 
@ngn I start by evaluating the leftmost and rightmost ones on the screen and evaluate the greatest gaps, so at every point in time the point density everywhere is about the same
 
ngn
12:28 PM
@dzaima so, at each step you pop out the interval with the greatest |f(x[i])-f(x[i+1])| and you add back its two half-intervals?
 
@ngn yep
 
ngn
12:43 PM
@Adám does dyadic use binary search?
@dzaima theoretically a heap data structure could be implemented with in-place updates - indexed assignment and ,← but i don't know how complicated the code will end up
 
oh wait I'm not removing any specific point, just the max/min ಠ_ಠ
oh wait but a double-ended priority queue does need removing of arbitrary points
 
ngn
@dzaima er... what's a double-ended priority queue?
 
@ngn this, apparently. I didn't know it existed a couple minutes ago too.
 
ngn
@dzaima why do you need it to be double ended? aren't you only interested in the largest gap?
 
@ngn I also want to remove very small gaps so that if I'm zooming out constantly it's not accumulating another n points to draw for every 2x zoomout
 
ngn
12:59 PM
@dzaima sounds too complicated for my little brain
 
:D
 
ngn
how wide can a screen be in pixels? a few thousand, no?
just evaluate them all
 
@ngn that doesn't work well for slow functions & constant moving around, and most importantly, that's no fun :p
 
@ngn Only in 18.0.
 
1:37 PM
wait really the path needed to take in a binary heap to find the place to create a new node at is the reverse of the bijective base 2 of the size before adding? :D
 
1:53 PM
hey dzaima, about the building, with the env change, it now errors after error count: 0, so I think that would be when ./build8 is called
 
@Cowsquack what are the errors? I'm not getting any errors beyond failure to delete old files on 1st run
ok maybe it's not just 1st run, but it still works correctly
oh I get errors switching javac to java 8
 
shopt globstar errors
so the * have to be changed
 
@Cowsquack oh right I removed the usage of it but not the config line ಠ_ಠ
 
also javac complains on -release
 
@Cowsquack right, that's that
 
2:03 PM
@dzaima I thought you said you were using Java 10 though
 
@J.Sallé convert.py converts it to java 8, and it should really work without java 10
 
Ah, I see
and you're 100% sure everything you made can be converted from java 10 to 8?
 
@J.Sallé it already works and is running on my phone, so yeah.
 
In that case idk :p
 
I understand why it's erroring, I just don't have a clue how to make it work with javac 10 & 8 both
i.e. I have it successfully compiling now on java 8
 
2:09 PM
but it breaks when you switch to 10?
 
@J.Sallé exactly.
 
I'd probably blame java
 
how did you compile it on java 8? simply remove the -release 8?
 
@Cowsquack and add mkdir build before that
and remove the shopt line
 
nice it works now :)
how do you communicate between APLP5 and your apl
 
2:15 PM
@Cowsquack I have my APL added as a library to the Processing sketch and I set a variable to the global Scope object that's a custom APLMap object with its own getters & setters
 
how does {P.LM.P:←l,←P.mpos⋄×≢l:a⊢←⍵⋄l⊢←⍬} work?
from drawgolfed
 
@Cowsquack P.LM.P:← if left mouse button is pressed, return l,← mouse position. (Otherwise), then if ×≢l (aka does l have any elements), set a to the right argument. After that, set l to
the right argument to that is the result of G.ln a,⊂l - a,⊂l
I sat on that for way too long, having started with 123 chars :D
 
2:37 PM
@dzaima what is the result of that?
 
@Cowsquack a,⊂l
oh without themes it's hard to see that the - is not a part of the codeblock
 
@dzaima what is the significance of the first in that line
 
@Cowsquack it means "return"
i.e. {1: ⎕←'a' ⋄ ⎕←'b'}⍬ prints both a and b, whereas {1:← ⎕←'a' ⋄ ⎕←'b'}⍬ - only a
 
2:42 PM
@dzaima ah, I thought the minus was a typo :P
@dzaima oh it's not like dyalog's
 
@Cowsquack :← is like dyalog's, : is not.
@dzaima oh, that's not added to differences.txt :|
 
also why not G.bg¯1 instead
 
@Cowsquack because that shouldn't really be a thing since I haven't decided what to do with number color arguments
Processing does it very strangely with 0-255 being grayscale & everything else being RGB, so a segment of transparent colors is not actually transparent and I don't like that
 
3:07 PM
"so a segment of transparent colors is not actually transparent" what do you mean by that?
 
@Cowsquack 0x80FF0000 is a 50% transparent red color. 0x00FF0000 is 100% transparent red color. 0x00000000 should be a 100% transparent black color, but instead is black. 0x00000080 is also gray, not transparent
 
ngn
3:20 PM
@dzaima can you say that in apl? :)
 
@ngn oh good question. No idea how to do that without loops
 
ngn
@dzaima i'm trying to figure out what you mean by "bijective base 2"
 
@ngn 's like regular base, but with extra +1s/-1s
the point of them is that leading 0s mean stuff, and there's exactly one way to encode a given number
 
so you're using 0 and 1 instead of 1 and 2 as your digits?
 
ngn
@dzaima that makes some sense - the heap representation I'm familiar with is one in which a[i]'s children are a[1+2×i] and a[2+2×i] (0-indexing)
with ⎕io←1 those would be a[2×i] and a[1+2×i], so it might be a better fit for binary representation
 
3:30 PM
@Cowsquack for what?
 
for the bijective base 2, but nvm you're using a slightly different way of encoding it
 
ngn
so, when adding the n-th element to a heap, the update path to the root is: 2⊥¨,\2⊥⍣¯1⊢n (⎕io=1)
 
Ven
Hi!
 
Hello!
 
Ven
The tryapl page seems to get a little crazy when I hover a primitive in the Primer
 
That was fast
 
Ven
Amazing, I've been waiting for that for a bit :)!
 
@dzaima also no idea why did I special-case the last number there, the while loop could just be while (n.gt(0)) :|
 
There are still a few issues with that though, for example some descriptions go over the top of the page and you can't view them
 
@Quintec you can move the description windows though
 
3:40 PM
@dzaima What do you mean
I know you can scroll down, but not up
 
ngn
@dzaima "toBijective" looks like a mutant "encode in base b" :)
 
@ngn Well, that's essentially what it is, isn't it? :P
 
Ven
oh, I guess I missed the last student competition I could've done.
 
ngn
@Quintec yeah, but why not do a clean encode (which may be useful in other places too) and adjust the args/result?
 
Ven
well, you need to be actually good at APL, so.
 
4:05 PM
@dzaima :( why are the clearly superior tabs unknown tokens
 
@Cowsquack because I didn't think of adding them
 
4:18 PM
also looks like ? doesn't work on matrices
 
@Cowsquack ? (sorry)
 
oh its indexing with a matrix on the inside
like vec[mat]
 
@Cowsquack it's a regular scalar function, no idea why it should be special
 
you mean indexing is scalar?
 
@Cowsquack ? is a scalar
 
4:25 PM
I meant vec[?mat] borks
but it turns out that borks because vec[mat] borks
? turns out to be fine
 
@Cowsquack oh I just haven't bothered implementing arr[]
TIO :D
3
 
then vec⌷⍨⊂indicies?
@dzaima yay
 
@Cowsquack or indices⊇vec
 
 
2 hours later…
6:39 PM
how can I find an exact sequence of characters in a string? Ideally I'd like a function such as 'ab'∊'abc' to return 1 instead of 1 1 and 'ab'∊'acb' return 0.
 
@J.Sallé ∨/'ab'⍷'abc'
 
@dzaima not entirely sure if that's what I need, but I'll check
 
is literally "find"
 
Yeah I think I was using it wrong
 
 
1 hour later…
7:47 PM
hey. any ideas how one would do this?
!-12.0
is DOMAIN error
i can do
!-12+⎕CT
but that isn't very satisfying
nevermind, i forgot that it does not make sense for non-negative integers
 
heh, (×/,2⊃1∘+)⍣¯12⊢1 1 gives a rank error
 
ngn
8:24 PM
@AttilaVrabecz you mean negative integers. by the way, you know this parses as !-(12+⎕CT), right? negatives in apl use the high minus: ¯12; and there's no difference between 12.0 and 12
 
8:36 PM
0
Q: How can I format a number vector and a string vector? (Dyalog APL)

zeynelI've been studying APL only a few weeks but I really like it. I tried to write simple functions to practice what I learn. This one tells me how much money I'm left with next 13 months if I withdraw W every month from initial capital of T. R←T Money W M←1 2 3 4 5 6 7 8 9 10 11 12 13 Months←'No...

 
yeah i meant to say non-positive
i guess as a k programmer just 12.0 and 12 being the same is just not something im used to
 
ngn
@AttilaVrabecz !0 is allowed
 
yeah, that's why non-positive integers are the only-problems
i mean just ignore me altogether
;)
i think i had a math professor once who philosophically considered zero positive, but i might be misremembering things
 
ngn
@AttilaVrabecz interesting fact: in france and some french-speaking countries they define "positif" as ≥0 :)
as for 12.0 vs 12 - dyalog represents small integers as the smallest c type in which they fit - byte, short, or 32-bit int (all signed), but uses double for larger ones and fractional numbers
there's also ⎕FR←1287, but that's another story...
so (ignoring ⎕FR) "integers" are limited to 2^53
the transitions between byte/short/etc representations are transparent to the user - it's like having a single numeric type, not separate integer/floating point types like in k
oh, and i forgot to mention bit-booleans before "byte"
 
9:02 PM
yeah i know but i forget
j definitely see the appeal
but not with my database hat on
 
ngn
yeah, for maximum performance you probably want to avoid automatic transitions between representations
 
 
2 hours later…
11:34 PM
a←¯3⌽¯3⊖10 10 ↑5 5↑3 3⍴ 0 0 1, 1 0 1, 0 1 1
{⍵∨.∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}a
why am I getting a length error?
copied straight from here
 
You need a 1 ⍵ on the left. Not
 
oh. i was dyslexic with that
what does the 1 mean?
1 ⍵ is a list of 1 and the right argument?
what on earth does that mean?
in fact what does everything to the left of 3 4 mean?
 
11:50 PM
@nathanrogers {⊃∨/1 ⍵∧3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵} would be a more understandable dfn of that. If both arguments to . are vectors, A f.g B ←→ ⊃f/ A g B
(and if both arguments to . aren't vectors, it's magic, but that's unrelated to this)
 
bwah?
why not
life←{⊃+/3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵}
 

« first day (637 days earlier)      last day (2004 days later) »