« first day (1695 days earlier)      last day (945 days later) » 

2:20 AM
@alwalo the second line should be replaced by the last one, that resolves the INDEX ERROR. if WS FULL, it could be your MAXWS isn't large enough, mine is set at 512M. (Unlike J which can dynamically allocate memory via malloc, APL has to decide the max amount of memory available when the program startup)
 
 
6 hours later…
8:05 AM
@tjjfvi pretty much, he's a dyalog employee
 
@tjjfvi He's the bar keep of this establishment.
 
 
7 hours later…
2:41 PM
i'm working on a hamming code implementation in APL and i've stumbled upon a somewhat annoying problem
{⊃⍸(⍵≤1-⍨⊢-⍨2*⊢)¨⍳⍵} - this is my dfn for computing the amount of redundant bits
basically, my approach is, given m as omega, we find the first solution (r) to 2 ^ r - r - 1 >= m when iterating from 0..m
 
@KamilaSzewczyk ¨ there is unnecessary fwiw
 
but iterating over the entire set sounds a little wasteful, and as much as this is only a small problem, more important problems occur when i try to compute the value of this function for a larger m
for 1626, the function should return 11
meanwhile it DOMAIN ERRORs, because it goes through the entire range unnecessarily
that's like, 1615 values computed unnecessarily and it errors to top it off
is there an relatively elegant and relatively fast way to do short-circuiting here?
 
{⊃⍸(⍵≤1-⍨⊢-⍨2*⊢)⍳1023⌊⍵} should go through only 1023 items, and you won't get any more in 64-bit floats anyway
 
You can reduce the upper bound to 1+ceil(log(2,m))
 
hmm
how did you derive this?
 
2:46 PM
or 2+
Just because 2^r is much larger than r+1
 
oh.. right
 
Or if you know roughly how large m can be at max, you can construct a vector of 2^r-r-1 for up to some hardcoded r, and just do binary search on it in the function
Also I have written some APL solutions to hamming code problems on CGCC, might worth checking it out
 
 
3 hours later…
5:57 PM
So I was informed that one can now run dyalog files as scripts? @Adám where can I find the docs on that + what version should I be running?
 
6:12 PM
@nathanrogers it's version 18.0, the feature is describe in "Dyalog Version 18.0 Release Notes.pdf" in the document set.
 
I don't see any mention of script in that file, or the version 18 release page
 
it is named "Load on page 12"
 
6:28 PM
For how to invoke dyalog with custom parameters, reference "Dyalog for Microsoft Windows Installation and Configuration Guide.pdf" even you are not using Windows.
 
 
2 hours later…
8:55 PM
@nathanrogers not properly until 18.1
 
9:35 PM
@Adám TryAPL's down again
 
9:47 PM
@tjjfvi Something like that, yes.
 
9:57 PM
@dzaima Up again, but this is very mysterious.
 
when is 18.1?
@Adám is there a way to execute a ⎕LX containing workspace, and exit dyalog when the function is complete?
 
@nathanrogers Just add ⋄⎕OFF to ⎕LX
 
@Adám
NOT PERMITTED: Illegal token
      ⎕OFF
     ^
 
@nathanrogers When it is ready :-) Hopefully this year.
 
and how about when loading the ws, the function ⎕LX←'main' is not actually called
instead it just showed the definition of the function rather than executing it
or does the ⎕LX funciton need to be a tradfn?
 
11:00 PM
⎕LX is an expression, not a function name. If you want to call a (non-niladic) function, you've got to give it 1/2 argument(s).
 
oh I see, it needs to be an expression. If 'main' is a function then ⎕LX←'main 0'
 
There's a good reason it is called the Latent eXpression.
 
@nathanrogers unless main is niladic
 
oh no
 
which I assume a lot of people do
 
11:01 PM
dyalog LOAD="test.dws"
does not put any output to stdout
:C
I wonder if I can still capture it
 
@nathanrogers What generates the output?
 
⎕LX calls main
main is just {⎕←3+4⋄⎕OFF}
but the issue is that it isn't returned or printed as result of the command
its printed to the session and then the session exits
 
Hm, that's odd.
Wait, are you using -script on the command line?
Or maybe -s – I can never remember which.
 
Try it.
 
11:05 PM
dyalog --script LOAD="test.dws"
does that look right?
:O
dyalog -s LOAD="test.dws"
that does the trick, thanks adam
 
○7
 
nathan
 
how would I define a function who's body is the contents of a file?
main←{ ⎕FIX ⎕NGET 'filename'}??
or something like that, idk
wait
 
2⎕FIX'file://path/to/filename.aplf'
 
11:14 PM
but that doesn't actually set the body of a function to the contents of a file
I probably want a ⍎⎕NGET 'file' or something?
main←{⍎⎕NGET'file'} idk...
 
What exactly do you mean by "body"?
 
as in I want main to be a function that can be called to evaluate the contents of a file
rather than importing names or classes or whatever
 
What is the contents of the file?
 
⎕LX←'main' ⋄ main←{⍎'do the contenst of the file'}
some apl program
but the file is always the same
 
@nathanrogers there are many forms of APL programs...
 
11:16 PM
Hey @nathanrogers please tell me what the contents of the file will look like.
I don't need all the gory details, just the first and last line, I think.
 
is it like ⍺+⍵? like {⍺+⍵}? does it just not take arguments at all? do you expect it to be evaluated in some specific scope? does it return anything?
 
@nathanrogers Is there a reason you want to wrap the file contents and call it main, rather than just calling the file's function directly?
 
no
there's no point
but I want the contents of the file to be evaluated on ⎕LX
 
!
 
⎕LX←'some expression to evaluate the contents of a file'
@Adám it would be APL expressions
 
11:19 PM
OK, I can help you with this, IF YOU TELL ME WHAT THE FILE CONTENTS LOOKS LIKE!
 
small, few line examples of APL
contents of the file could be
⍳10
could be
 
OK, thank you. Sorry for yelling.
 
:C
could be
f←{
⍝ something
idk←⍵+3
⍝ some comment
idk
}

f 3
most of the time its just one lines
other times it could be something more substantial, hard to whittle that down
 
@nathanrogers That's not "runnable" code.
 
11:21 PM
That's a function definition.
 
how about that
 
OK, that's fine.
 
not with f 3 at the end.
 
So I think ⍎⎕FX(⊂'main'),⊃⎕NGET'path/to/filename.txt'1 will do the trick.
 
11:59 PM
@nathanrogers Did ^ work for you?
 

« first day (1695 days earlier)      last day (945 days later) »