« first day (155 days earlier)      last day (2339 days later) » 

12:02 AM
Uh, no clue.
 
There are a couple of ways to handle it. But Mego mentioned that your framework is robust.
You could prepend some more lines:
:Trap 0
⍝ USER CODE HERE
:Else
1⊃⎕DM
:EndTrap
 
what if someone does an :EndTrap in the user code?
 
@Conor. I was just about to press enter about that.
 
oh haha
 
Then again, what do you do with malicious users?
E.g. ⎕SH'format c:'
Or plain ⎕OFF (closes APL)
Or →⎕LC (infinite loop)
 
12:16 AM
Well, format c: doesn't do anything on Linux, but the user that runs the code doesn't have write access to the filesystem. Closing APL should only interfere with the user's own code, so there's no need to worry about that. Infinite loops get killed after the 60 second time limit.
 
You can add the line ⎕TRAP←(0 1000)'E' '1⊃⎕DM ⋄ ⎕OFF 255⌊⎕EN'
 
What does that do?
 
This will print the error message, and quit APL with a matching exit code (though max 255)
Still, this doesn't prevent the user from reassigning ⎕TRAP, but you can either attempt to catch that, or just leave him waiting for a minute if he really wants to play foul tricks.
 
I don't think APL requires any additional security measures. TIO also has Bash, C, Assembly, and raw ELF files.
 
Right, worst case, it costs a minute. Do you allow calling external programs?
 
12:22 AM
@Adám I believe so although all the children would be killed with the parent
(if I'm understanding how his selinux setup works)
 
Dyalog has ⎕NA which allows calling functions in shared libraries.
 
Yes, calling external programs is allowed. Every user submission runs in its own MCS range though, and the entire range is purged after the program finishes or the time limit expires.
 
Sounds like you have it under control. I just wanted to make you aware of some pitfalls. TryAPL.org is extremely limited due to precautions.
Maybe we can learn something from you.
 
It seems quite solid so far. Unlike the previous version of TIO (which I had to hard-reset every couple of weeks), there have been no hiccups so far.
 
Great.
APL*PLUS/PC had ⎕POKE for arbitrary memory writes. It was pretty easy to crash the computer...
 
12:30 AM
Ouch.
 
DO you keep a log of what people enter?
 
No. Unless the code is stored in a server-side permalink, there are no traces of user code.
I've been meaning to ask: Is there an easy way to turn an "APL script" into a workspace to create an actual full program?
 
What is an APL script? That which you are piecing together?
If so, then, at the end of the last line, your workspace has been defined.
However, what you may actually be looking for is a try Dyalog APL script.
script ≠ workspace
 
I mean a set of commands in a file, such as the greater. I read something about .dws files, but I'm not sure what they actually are.
 
the greater?
 
12:34 AM
Eh, greeter.
 
What greeter?
The messages about Dyalog version, etc?
 
⎕←'Hello, ',⍞
 
Ah. This is how it goes:
You are always in a workspace. Always. Even if you just installed, and start dyalog.exe, you will be in a clear workspace (which is almost empty).
You can modify the current workspace to your hearts content, and then save it to disk with )save myws.
You can load a workspace with )load ws or copy items from an existing workspace to the current one with )copy wsname (everything) or )copy wsname item1 item2 item3
These are called system commands. They are not APL (and thus do not conform to APL syntax, and may not be called from within programs/functions)
Other important ones are )off (quits APL) and )clear (discard everything and get a new empty workspace)
 
So a workspace is a saved state, it doesn't do anything when you load it?
 
Every workspace has a special variable called ⎕LX (Latent Expression). It is a string which gets executed when the workspace is loaded. To prevent this, you can )xload.
So ⎕LX←'name←⍞ ⋄ ''Hello '',name' will ask the user for his name, and greet him upon load.
btw, there are proper system functions to do most of what the system commands can do: ⎕LOAD ⎕SAVE ⎕CY ⎕OFF ⎕CLEAR
 
12:44 AM
And could that be somehow (ab)used by storing the user code in LX, then load the workspace for execution?
 
The system commands are there for ease of use (no quotes and quote-doubling required) and backwards compatibility with IBM/360.
@Dennis Yes, you can easily have an otherwise clear workspace which just has a short ⎕LC that loads an entire application. In fact, newer applications tend to do more or less that.
... which leads us to .dyalog files.
Dyalog scripts are human readable (and therefore suitable for source control) text representations of Dyalog APL items (namespaces, classes, functions, variables, etc.)
Dyalog comes with a framework to load, save, and modify such scripts.
Instead of round parens, the commands use square brackets: ]load ]save
You can create things in the (clear) workspace, and then save individual things to disk with ]save mything /tmp/
 
Nice. I'll have to try that when my power comes back.
 
You can also create a script inside APL (as a character array) and then ask APL to run the definition script. E.g.
⎕FIX ':Namespace math' 'square←*∘2' 'sqrt←{⍵*÷2}' ':EndNamespace'
math.square 3
9
What? you are still without power?
 
I came back, but not for long.
 
What continent are you on?
 
12:59 AM
South America
 
Oh.
You could have the users input in such a script, and then ⎕FIX it.
 
Would that have any advantages over the tradfn approach you suggested?
 
Depends. Are you doing the thing with detecting leading+trailing ∇?
 
I haven't been able to try that yet. Would the detection still be needed with FIX or LX?
 
No. And the namespace script would allow the user to define multiple functions, using a mixture of tradfns and multiline dfns.
However, I think implicit printing would be suppressed, i.e. one would need ⎕←.
 
1:10 AM
Hm, that might make more sense for a "full program" anyway.
 
One interesting feature of Dyalog APL, is that it tries to be all-singing, all-dancing, multi-paradigm.
 
can it be object-oriented?
 
@ConorO'Brien Oh, absolutely.
 
@Adám oo that sounds cool
 
⎕FIX':class myclass' '∇make' ':implements constructor' ':access public' '⎕←''You made me!''' '∇' ':endclass '
But that gets cumbersome to write. Luckily we have scripts. just ]load /tmp/myclass
@Dennis, you see, APL can look just like Java/C#
Dyalog APL is a .Net language
 
1:18 AM
Neat. I'll run out of battery any minute now, so I guess I'll see you later.
 
All the best. Sleep time in the UK...
 
looks a heckuva lot better than J's "classes"
 
@ConorO'Brien hehe, yeah, the J community keeps waddling around in their self-lie that they have OO.
 
@Adám there's a J community? o.o
I assumed that died a decade ago >_>
 
Maybe so, two of their developers now work for Dyalog.
 
1:24 AM
that sounds like a cool job
is anyone still dev'ing J?
 
Dunno, maybe J is "perfect" and needs no devt. However, code.jsoftware.com/wiki/NuVoc does seem to be developping.
 
hm, cool. how many dev's work for dyalog?
 
@ConorO'Brien dyalog.com/meet-team-dyalog.htm plus two new guys (one fresh out of University, the other coming from J devt)
... which is pretty incredible, considering that our customers are giants in their fields.
 
 
1 hour later…
2:46 AM
@Dennis How is that power?
 
Absent.
 
3:09 AM
@Dennis good god!
 
Managed to get a bit of juice for my phone from a sleeping laptop, but other than that and the emergency limit we bought for these situation, there's only darkness.
 
well, it has to finish soon, right? one can't sustain long without power...
I mean what about the freezer - all the meat will rot
 
4:11 AM
The longest outage we suffered lasted 3 days. It was in plain summer and hot as hell. I almost went insane.
 
In australia when it's +47 there was a few hours power outage
a few years ago
I think a few people died in a lift
how do you add languages? I mean how do you chose what to add? Just anyone shows up and request and you just do it?
 
@AndrewSavinykh Uh, that's terrible. This is why I avoid lifts whenever I can...
 
The reason I'm asking is that there are still some languages missing ;)
 
I mostly add them by request, yes.
 
So I'm wondering if it's worth requesting these I have in mind or spare you the misery
 
4:16 AM
Request ahead. I'll try to add as many languages as possible.
 
4:33 AM
> Ubuntu Linux 9.04 (other distributions may also work)
Sounds promising. :P I'll give it a shot.
@AndrewSavinykh Here's my httpd conf file.
RewriteEngine On

<VirtualHost *:80>
        ServerName tryitonline.net
        ServerAlias www.tryitonline.net
        Redirect 301 / tryitonline.net
</VirtualHost>

<VirtualHost *:443>
        ServerName tryitonline.net
        ServerAlias www.tryitonline.net
        DocumentRoot /srv/tryitonline.net
        Header set Access-Control-Allow-Origin "*"
        SSLEngine on
        SSLCertificateFile /etc/letsencrypt/live/tryitonline.net/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/tryitonline.net/privkey.pem
 
Thank you very much! Is power back?
what's the difference between 301 and 302?
 
Yeah, it's back. Hope it stays that way.
302 is temporary, 301 is permanent.
 
5:33 AM
@ConorO'Brien Node throws an error.
/opt/stacked/stacked.js:5
let err = (msg) => {
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:974:3
Also, could you explain what makes it practical? It's a bit hard to assess without knowing the language at all.
 
@Dennis you are in the same time zone as Greenland. I wonder if they have stable power and decent internet in Greenland
 
Probably.
Hm, factor was missing a dependency. I fixed that, but now it wants to access /dev/random and SELinux is not amused...
 
/dev/random, huh?
 
Depleting /dev/random is a kind of DoS attack; it regenerates slowly and some system components will have to wait until it regenerates.
 
 
1 hour later…
6:59 AM
OK, I managed to build factor from source and replaced /dev/random with /dev/urandom. It works fine interactively, but it cannot find any vocabularies from within a script.
@AndrewSavinykh Any ideas?
 
let me do the same as you, that is compile it form sources on linux
I'll get back to you
 
Not sure if that's a factor (no pun intended). tio.run/nexus/…
print clearly exists; it just doesn't find it from a script.
 
clearly exists?
there is some trickery as far as I remember with the boot image
it's mininal
when you build if from source you are supposed to replace it with the compiled image of a bigger "core"
sorry I do not remember the details, once I've compiled it I'll let you know
crap
just a few days ago I installed x packages on my ubuntu server
no factor insist on displaying gui which I cannot see
because I'm running headless
sigh...
 
7:20 AM
Try DISPLAY= factor?
 
does not help (
ah ok
 
USE: io gets print.
 
Apparently it works as intended, but the REPL preloads some stuff you gonna need.
 
this is because listener loads a few voabularies by default
but when you are running from file source they are not loaded
I think
exactly
so I understand it's possible to write out factor.image with any vocabularies that we need preloaded
I just need to remember how
 
7:28 AM
I'm not sure I want that. I usually try to keep the interpreters are close as possible to a pristine offline interpreter.
 
that's all right
@Dennis thank you, so much!
 
No problem. If you want me to add any other language, just ask. :)
 
fortran but I can't decide which ;)
 
7:45 AM
Alright, after executing the following, I can run a workspace as a program.
  ⎕LX←'''Hello, '',⍞,''!'''
  )save greeter
$ dyalog -script greeter <<< World
./greeter saved Tue Jan 24 04:45:10 2017
Hello, World!
The first line of output goes to STDERR, so all is good.
 
What are you trying to accomplish?
 
Now I just have to figure out how the user-supplied code has to be escaped to store it in ⎕LX.
 
But why do you want to store it in ⎕LX?
Are you not going to spin up a new dyalog.exe every time the user presse Run?
 
I must have misunderstood you earlier. I thought we could use ⎕LX instead of the tradfn wrapper.
 
No, you can use a Dyalog Script (.dyalog) instead of the tradfn wrapper.
⎕LX is good for getting things started.
If you want to use a script, wrap all the user's code (including header) in :namespace TIO and :endnamespace and save that to a file, say /tmp/TIO. then pipe ]msg←load /tmp/TIO followed by a newline and then the user's input.
 
7:56 AM
Ah, alright. Completely misunderstood you earlier.
 
oh, you should insert the line )cs TIO between the ]load and the input.
)cs is Change Space
 
Is this part of SALT? That's the only doc I could find that talks about Dyalog Scripts.
 
yes, .dyalog files are usually used with SALT. However, the newest versions of Dyalog have some SALT functionality built in.
You can use ⎕LX to ]load a script if you want.
 
Alright, I'll try that tomorrow. 5:00 means I should go to bed...
Thanks for all your help!
 
Sleep well. I'm going to the office now and will get you your license.
No thank you!
For reference, ]load under program control (including ⎕LX) is ⎕SE.SALT.Load 'path'
 
 
3 hours later…
10:37 AM
@Dennis Good morning. You are licensed to <s>kill</s> use 15.0 Unicode 64-bit on TIO!
 
 
1 hour later…
11:50 AM
@Dennis what version of node do you have? Also, it is practical because it's intended to be a functional language. It's not an esolang, that is.
 
 
4 hours later…
3:40 PM
@Dennis Can't wait to try it.
 
3:57 PM
Is APL pronounced "A-P-L" or like "Apple"?
 
4:08 PM
@Pavel Aye-Pea-Ell
It is not an acronym.
 
Huh. What does the name come from then, if it's not an acronym?
 
4:21 PM
@Dennis can you add Mathics? It's basically the Octave of Mathematica.
 
4:43 PM
@Pavel The clever people at IBM needed a name to call it. No-one could think of a name. It was inspired by a paper by Ken Iverson which was a description of a programming language (an imaginary one, not an implemented one). As a temporary measure, they called it by the initials of the paper. Note that APL does not even remotely resemble the imaginary language in the Paper, and most APLers would be incapable of reading the paper's notation.
 
@Adám Great! I'll add it as soon as this blackout ends. sighs
 
@Dennis Is this the same blackout as before, or a new one?
 
A new one. Started a few minutes ago. There was another one while I slept.
 
"A Programming Language" is a great name.
 
@Dennis Jeez.
 
4:46 PM
@Adám Btw, I only got the generic educational license email. I was hoping for an official thumbs up to use it on TIO.
 
@Dennis Maybe you should consider investing in a generator, or solar panels, or something?
 
Solar panels by themselves are a bit problematic. A generator isn't a bad idea though, although not exactly cheap.
 
@Dennis You have thumbs up from Morten, Andy, Brian, Karen, and me. Do you want it on paper?
 
Nah, that's good enough.
Power just came back, so as long as it stays that way, I'll try to add Dyalog APL to TIO now. :)
 
The reason for the generic email is that it is sent automatically by the system when it registers a licensing change.
Morten explicitly uttered the name "Try It Online".
 
4:58 PM
:D
 
Neat! You can try Mathics online in a repl!
 
5:47 PM
@Pavel However, APL/apple puns are almost as old as the name, and the trend continues today: A utility library called APLTree, a memory dump is called an aplcore, and, my favourite, the top view of an APL pi which is the built-in for π.
 
@Adám ]msg←load /tmp/TIO says VALUE ERROR.
 
@Dennis where/how are you executing that command?
 
so I googled a bit about Greenland, apparently they mostly burnt oil but then they build hydro plant inside a mountain. To get power from underground lakes, rivers. With the tunnel system of 14 kilometers long en.wikipedia.org/wiki/Buksefjord_hydroelectric_power_plant
anyway
@Dennis what do you use as the source of 99?
 
@AndrewSavinykh Denis is not on Greenland.
 
@Adám I'm aware of it
I just pointed out this is the same timezone
 
5:58 PM
$ cat /tmp/TIO
:namespace TIO
⎕←'Hello, World!'
:endnamespace
$ dyalog -script <<< ']msg←load /tmp/TIO'

VALUE ERROR
 
and Greenland sounds line a place where it would hard to come by with energy, also I'm sure that in Greenland it must be more stable than in.. uhm... Brazil? Argentina? Chilie?
 
@AndrewSavinykh This answer.
 
@Dennis thanks
@Dennis but
the wrapper does not call perl
 
@Dennis odd. try without msg←
 
it calls /opt/99/ninetynine
ah
it's a perl script?
 
6:00 PM
Yes.
@Adám Also VALUE ERROR.
 
try⎕SE.SALT.Load'/tmp/TIO'
 
$ dyalog -script <<< "⎕SE.SALT.Load'/tmp/TIO'"
VALUE ERROR
 ⎕SE.SALT.Load'/tmp/TIO'
∧
 
Ah, you appear to have no session.
⎕SE = SEssion
If you start Dyalog normally, what does ⎕SE give you?
 
That just says ⎕SE.
 
good
And ⎕SE.SALT ?
 
6:09 PM
That says ⎕SE.SALT from RIDE but gives a value error with dyalog -script.
 
Ah, it seems -script disables SALT.
 
Oh, ⎕SE.SALT.Load'/tmp/TIO.dyalog' works from RIDE. I doesn't like the missing file extension.
 
I suppose that ]load works from RIDE too.
 
It does.
No such luck from the command-line though, even if I start dyalog interactively.
But RIDE doesn't start dyalog...
Yup, it works with mapl.
 
Different approach: 2 ⎕FIX'file:///tmp/cl.dyalog
This is the built-in "SALT"
In fact, you don't need the :namespace TIO :endnamespace
 
6:14 PM
That pints to the single quote and says syntax error.
 
Oh dear, it is missing the closing quote.
2 ⎕FIX'file:///tmp/cl.dyalog'
 
That says NONCE ERROR.
 
you did change the filename to TIO, no?
 
Yes, to file:///TIO.dyalog.
 
/tmp/
 
6:17 PM
Yes, that.
 
It works by me.
Let's try a different way:
Open Dyalog (using RIDE if you want).
⎕LX←'2 ⎕FIX''file:///tmp/TIO.dyalog'''
)save /tmp/TIO
Then try to run $ dyalog /tmp/TIO
You may need to add .dws
 
Still NONCE ERROR (locally on 14.1). 15.0 on TIO says DOMAIN ERROR.
 
You must use 15.0.
 
I don't have 15.0 on my desktop computer right now (and no RIDE on TIO). Give me a few minutes to download it.
 
ok.
 
6:24 PM
South American internet. "A few minutes" was an understatement...
Hang on, I think I figured out how to enable SALT.
 
How?
(I guess I shouldn't complain about my 30 Mbps, 1ms ping)
(At the office we have 160 Mbps down)
 
@Adám )load /opt/mdyalog/15.0/64/unicode/ws/salt
 
@Dennis Nah, that is used to enable/disable a callback to save scripts when a scripted object is edited
 
But it works.
From Bash, until I write the wrapper.
 
Cool.
It was pretty slow though.
 
6:36 PM
Yeah, 2 seconds for Hello World isn't exactly stellar...
 
But I suppose that's all overhead.
Can I try to crash it?
 
I'd be interested to know what the SALT workspace actually does. We probably just need one or two things from there.
Right now is rush hour for TIO. Let's try that later. :P
 
ok.
@Dennis Right, it's just overhead. I tried a matrix inversion of a 600-by-600 matrix. APL reported 1.7 seconds computation time, and I hand timed the time to response at about 4 seconds.
 
7:00 PM
@Dennis I was working on my mirror of tio and I noticed that you have not updated your git repos. There is no rush, but when convenient can you push these please?
 
@Adám Alright, most of that time is spent rebuilding the user command cache, as the sandboxed interpreter has no way of keeping .dyalogUserCommand20.cache between runs. That should be easily fixable.
 
@Dennis Hm, but you really shouldn't need user commands at all. ⎕SE.SALT.Load should do the job.
 
Right, but that doesn't exist when I launch dyalog, and as soon as I load the salt ws, it rebuilds the user command cache.
And that takes a couple of seconds.
 
7:16 PM
Why can't you use an image where the cache is already built?
 
Alright, it's still a bit slow, but that's because TIO is a tad overloaded right now. Rush hour...
I took a snapshot of the user command cache file and included it in the sandboxed environment. That makes it quite a bit faster.
 
Amazing. Good job.
 
:)
Seems to be working fine.
 
Neat. I can load libraries!
 
@AndrewSavinykh All TIO repos are up-to-date now.
@Adám Cool. If anything isn't working as it should, please let me know.
And thanks again for all your help. :)
 
7:34 PM
@Dennis Header seems to work too.
 
I just have to provide an option to omit the newline now or grep for trailing errors. I'll do that later.
 
@Dennis You don't need an option, just replace ←\n with after merging.
 
Yeah, but other languages could benefit from an option as well.
 
oh, ok.
So is this going to be the format? Then I can start linking those codegolf solutions that are not suitable for tryapl.
Also, when is the best GMT to do stress tests and attempt to break it?
 
05:00 to 09:00 UTC is the most quiet period.
@Adám Yes, go ahead.
 
8:08 PM
@Dennis thanks a lot!
 
How do you type the characters for APL? Do you just copy->paste them from a code page?
 
@Pavel Got to the bottom, select your OS, and read "Enabling the Keyboard Key Mappings"
RIDE (and IDE on WIndows) also have a language bar, i.e. an on-screen keyboard.
 
I didn't actually know you could do that on Windows. Neat.
 
@Pavel If you are on Windows, you can easily create your own keyboard layout, or use the one I made today.
 
8:36 PM
@Dennis Are you missing a )cs TIO prepended to Input?
 
@Adám Ah yes, I had to take that out. It mistook it for the first line of input.
Not sure why.
 
It would be convenient to insert the Footer between :endnamespace and )cs TIO.
(then it is possible to execute things in the root)
 
Sadly, that's not possible. The APL wrapper only sees the glued code file, not the three individual pieces...
Well, it is possible, but I'll have to rewrite the backend.
 
@Dennis if you're not too busy with Dyalog right now, can you add Mathics? I know I asked earlier, but you never responded.
 
@Adám How can I add )cs TIO though? This is what happens when I try. tio.run/nexus/apl-dyalog#@/@ob@qjtgnqHqk5Ofk6Cuo6j3rn6agrqnPhEP/…
@Pavel Not at my computer right now. I'll add it later.
 
8:49 PM
Alright, thanks. It'll be great to have a place to easily test Mathematica code, what with it being one of the most popular languages on PPCG.
 
Is it that compatible? Octave and MATLAB are kinda hit'n'miss.
 
Well, no, it's not perfect, but it's pretty good.
 
@Dennis Hm, yeah, that is a good question.
 
As far as I can tell, every implemented function works exactly as in mathematica, the differences being in functions that don't have implementations in Mathics.
 
Are you using ⎕LX?
 
8:55 PM
But there aren't many of those, and theoretically they could be defined in the header of tio, the only really complex one I've encountered that works within TIO's restrictions is Reduce, and Solve is nearly the same and better for golfing.
 
9:40 PM
@Adám No, just the namespace thing.
 
If we got the 2 ⎕FIX to work, we could avoid the namespace altogether.
 
I'll give it a shot later.
 
I found the problem.
You can't execute statements or do I/O in such a script, only define things.
So here is a plan: Header and Code go into /tmp/TIO.dyalog
Input gets piped into APL.
 
Just the code, no namespace or anything?
 
@Dennis That's right.
However, Code may only have function definitions (multiple is OK)
Other statements go in the Input (or Footer)
And the header should handle trailing .
 
9:56 PM
But then we're back to square one with interleaved statements and input.
What's the problem with the current approach?
 
That we cannot get into the namespace.
@Dennis No, code will always be in functions. If one uses ⍞ or ⎕ in the Input, then the following line(s) will be input to that.
Either one enters that in input, and the next three lines are then the answers to the three prompts, or one enters Header: ∇f Code: ∧/⎕=⎕[⎕] Footer: and the three inputs go in Input.
or just Code: ∇f ∧/⎕=⎕[⎕]
The benefit of this method over just piping everything into APL is that one can define and dfns without s and literal :namespace...:endnamespace
 
Maybe I should learn APL.
 
@ATaco Good idea! (I'm biased.) Can I be of assistance?
 
Got a documentation I can stare at?
 
Maybe I should open a PPCG chat room for teaching APL.
 
10:05 PM
Easy enough, just open up an APL chat room.
 
@ATaco Everything is here: dyalog.com/documentation_150.htm
On Windows, the F1 key will bring you to a very extensive offline help system. It is duplicated in web form here: help.dyalog.com/15.0
@ATaco But does this belong to PPCG, not SO?
 
We have a few rooms for things we don't own.
Like recently Primes and Squares, which better suits either Math.SE or Programming, but it lives here.
 
APL is quite popular on PPCG, so there's nothing wrong with having a room for it.
 

 The APL Orchard

apl.chat ― Learn, teach, ask, code, golf, & discuss usage. See ...
 

« first day (155 days earlier)      last day (2339 days later) »