« first day (1235 days earlier)      last day (1419 days later) » 

11:17 AM
For AoC fans, now completed 2016 in Dyalog APL: nbviewer.jupyter.org/github/xpqz/AoCDyalog/blob/master/…
 
RGS
@xpqz +← 1
Good job
Hello @MortenKromberg , what brings you here in this fine Saturday? :D
 
The place to be, clearly.
 
 
12 hours later…
11:01 PM
Does APL2 allow functions to return functions, or is that strictly the province of experimental APLs like NARS2000 and extended-beyond-the-standards APLs like Dyalog?
 
RGS
@JeffZeitlin (I don't think Dyalog APL allows functions to return functions)
(Unless I misunderstood what you mean)
 
I'll concede the point if we insist on distinguishing between user-defined functions and user-defined operators.
 
RGS
@JeffZeitlin ah ok, didn't mean to be pedantic; but if I may, even then operators don't really return functions
from my experiences with trying to do functional programming in APL, I think operators are "closer" to being "functions who might take functions as arguments" than to being "functions who return functions"
 
But I can assign e.g. f←<<result of passing functions to an operator>> and f is then a function, no?
Or am I overlooking something?
 
RGS
@JeffZeitlin c.f. this message of mine and the next 2 or 3 replies from Adám
(you can safely ignore other people's messages and read mine and Adám's in sequence)
if you want, I can try to give another argument based off of something I was trying to do today; are you at all familiar with Haskell?
 
11:17 PM
Hmmm...
No, I've heard of Haskell, and about its main learning book with the ungrammatical title, but that's the extent of my knowledge...
 
RGS
@JeffZeitlin nvm, I don't need Haskell for this :P if you look closely at any operator you write, you always call the functions you define inside the operator
do you understand what I mean?
 
I could ask for clarification...
 
RGS
sure; imagine you wanted to write an op that expects a monadic function and that returns the "square" of that function, i.e. the function applied after itself
(pretty much f⍣2)
 
RGS
prior to the conversation I just linked I would've expected this to work: _Dup ← {⍵⍵∘⍵⍵}
**1 gives 15.15426 but (*_Dup)1 gives SYNTAX ERROR
 
11:24 PM
But you didn't specify a left operand, you specified a right operand - that should have been _Dup*, no?
 
RGS
xD It's late here
but after you fix my mistake you get the same error
so (*_Dup)1 or f ← *_Dup ⋄ f 1 still give SYNTAX ERROR
 
OK, that's confirmed.
 
RGS
In defining _Dup you still have to explicitly use the arguments, so it is more of a type of currying than actually returning functions. I.e. *_Dup feels somewhat like doing 2∘+
but hey, I'd love Dyalog APL to be able to return functions from operators
I hope I was able to get my point across; I haven't mastered this aspect of APL so I won't be able to argue much further :P
 
Hmmm... I think I see, and yeah, that needs to be an enhancement.
And not just operators, actual functions, too.
 
RGS
@JeffZeitlin I would like that :)
 
11:32 PM
On a whole 'nother topic...
How's your javascript?
 
RGS
@JeffZeitlin I know some javascript but I can't promise I'll be able to help you :P
(be careful about what you are about to ask/say, Adám might reprehend us for being off-topic)
 
The reason I'm asking is because I'm looking to hack an "enhancement" into the IBM5110 emulator I've pointed to before, to allow "changing diskettes". To do that, I need to be able to write a variable to disk, and read it back into memory, and it's got to be treated as a BLOB, a pure sequence of bytes.
 
RGS
'kay, I follow
 
I'm not sure how to do that; I can probably figure out how to "hook" it to (a local copy of) the page code; it's the actual load/save that I don't have.
 
RGS
what exactly is it that you are asking about? how to create BLOBs? where to save those BLOBs? how to gather everything that exists in the session and how to restore those later on?
 
11:44 PM
The emulator allows me to )LOAD and )SAVE workspaces (and the equivalent in BASIC), but the disk images that I'm loading from or saving to are strictly in memory. I'm looking to be able to write those images to disk and read them back. They're stored in variables, so I need to be able to write the variable into a host disk file, and read the file back into the variable. I don't need to be able to "merge" the data on disk with the extant disk image in memory, or anything like that.
 
RGS
@JeffZeitlin so let me see if I get this correctly: you'd like a button you could push and it would download to your computer a file with the workspace; smth you could send my by email. I'd then be able to press another button that would open, say, a file explorer; I would navigate to the file you sent me and be able to load your saved session into the emulator; is that it?
 
In GWBASIC, it would more-or-less be the equivalent of BSAVE diskfile,PTR(variable),LEN(variable), where diskfile is the file on disk, and variable is the variable in which the disk image is held.
More or less, yes.
But not a workspace, per se, a "diskette" with one or more files on it.
IOW, in the emulator, I )SAVE WS1, work more )SAVE WS2, then push the button; the file created is a disk image with both WS1 and WS2 in it.
 
RGS
does this help? the top comment links to another Q and the other Q links to another Q
 
YOu push the other button on yoour copy of the emulator, and then you can )LOAD WS1 or )LOAD WS2...
 
@JeffZeitlin (@RGS) Neither APL2 nor NARS2000 allows returning a function. And Dyalog only allows it from tradfns/tradops, though it is an undocumented feature/bug.
 
RGS
11:51 PM
@Adám meaning it might stop working because it is a bug or will it be left as-is, as a feature?
 
I'd hardly call that a "bug". I'll accept "unanticipated feature", and it should be formally accepted and documented!
(I'd have sworn I saw some code doing it in NARS2000, but I'll allow that I may be misremembering something that I misread...)
 
@RGS I doubt it will be removed, as it is relied upon by some existing code. In fact, we even tell people to use this method.
So, yeah, this works:
     ∇ r←(f _Pow)x
       r←f⍣x
     ∇
      (1∘+_Pow 3)10
13
And even
      1(+_Pow 3)10
13
 
RGS
@Adám +← 1
 
Would that let me do P←+_Pow 3, and then 1 P 10?
 
@JeffZeitlin Yes, of course. (You know you can just try it, right?)
 

« first day (1235 days earlier)      last day (1419 days later) »