« first day (1605 days earlier)      last day (1032 days later) » 

7:40 AM
is there anyone wiith good experience using Dyalog-mode on Emacs?
 
 
1 hour later…
8:47 AM
I have a few functions defined across multiple files. Is there a way to call them like modules from another APL Script?
 
9:09 AM
@Razetime What is an "APL Script"?
 
a .apl file
 
What's in the file?
 
9:25 AM
just a single tradfn
do i require namespaces
 
@Razetime Not necessarily. How are you running your script?
 
through RIDE
I'm fixing the function and running it
 
Ah, using ⎕FIX?
 
i guess that's what the emacs extension does?
 
Oh. No idea.
 
9:30 AM
let me check that file real quick
yes it's using ⎕FIX
takes the emacs buffer via socket, splits into lines and uses that
 
Your function can use ⎕FIX to fix other files and then you can run them.
 
using a relative path?
 
Relative to current directory. To get the directory from which the current function was loaded, use ⊃⎕NPARTS 4⊃5179⌶⊃⎕SI
 
hm. or I can just create a :Class and put all the fucntions in it
 
Probably a :Namespace but yes.
Or you could use Link:
]Create # /path/to/dir
 
9:38 AM
oh, that might be it
 
But I'm not sure how that'll work with emacs.
 
emacs simply has a bind to fix the object inside the current file into dyalog
shouldn't hinder normal RIDE operations
]link can't be called from a tradfn, right?
 
It can: ⎕SE.Link.Create etc.
 
soo, ⎕SE.Link.Create # ⊃⎕NPARTS 4⊃5179⌶⊃⎕SI would work?
 
You need parens around ⊃⎕NPARTS 4⊃5179⌶⊃⎕SI
 
9:44 AM
ah yeah gotcha
I assume I'd have to consider # as a local var?
to avoid polluting the global namespace
 
Where does emacs put the function?
I.e. if the function says ⎕←⎕THIS what does it print?
 
it prints a #
 
OK, perfect.
@Razetime Not sure what you mean by that, and # is a constant, not a variable.
 
so ⎕SE has to be in the tradfn header right
 
Wat? No. That's also a constant.
 
9:49 AM
so I'd have to destroy the link once the program runs?
 
Not really.
Does the interpreter get shut down after every run?
 
nah
 
So it keeps an interpreter running and just does a ⎕FIX over and over?
 
wait which interpreter are you taking about
 
Dyalog's.
 
9:53 AM
@Adám oh the emacs mode thing?
 
Yes.
(Btw, you know you can ask RIDE to use emacs as editor instead of using its own editor?)
 
It has a connection script written in apl here: github.com/harsman/dyalog-mode/blob/master/Emacs.apl
how do I execute certain commands when RIDE opens
 
RIDE is a dumb interface, it can't execute anything.
Start the interpreter with the command line param LX="expression to run"
 
like ermI want to load certain scripts when RIDE opens
oh I guess that kind of works
 
You can't. You can load certain scripts when the interpreter opens.
RIDE doesn't know anything about APL, really.
 
9:59 AM
ok when the interpreter opens
 
Doesn't have to be a cmdline param, btw, it can also be an envvar or in a config file.
 
oh, where do i edit the config file
 
You have to create it.
 
alright where do i put my config file
 
 
3 hours later…
12:40 PM
0
Q: Unrecognised symbols in GNU APL

J. D.I am playing around with GNU APL, but my experiments quickly reached an impasse. This is my what happened: x←1 2 3 4 5 ⍝ build the matrix u where u_{ij} = x_i + x_j, ⍝ then filter the entries equal to 6 u←6=x∘.+x So far so good, u is a flipped identity matrix, as expected. Now, I would like to g...

 
1:19 PM
I have a file with multiple lines. I did x←⊃⎕NGET '2.input' 1 to get the first line. If I do x I can see a box around the line, and if I do ⍴x nothing is returned. So as far as I can tell x is not an array of characters. What type of value am I dealing with?
 
@PuercoPop ⎕NGET returns a vector of which only the first element is the file contents. You need x←⊃⊃⎕NGET '2.input' 1 to get the first line.
 
Sorry I mispoke I did x←(⊃⎕NGET '2.input' 1)[1]
Which is equivalent to ⊃⊃ right?
 
Ah, then you need to realise that bracket indexing doesn't disclose (or "open up") elements.
Compare to 'abc' 'def'[1]
 
2:09 PM
Ah, that makes sense as the bracket indexing returns vectors when the index is a vector as well. Thanks!
 
2:24 PM
Exactly.
 
really it would probably make sense if 'abc' 'def'[⎕IO] was 'abc' and 'abc' 'def'[,⎕IO] is ,⊂'abc'
 
@rak1507 (you'd definitely want 'abc' 'def'[,⎕IO] to be ,⊂'abc')
 
@dzaima that's what I meant thanks
 
@rak1507 That would break the rule that ⍴A[B] ←→ ⍴B
 
I wasn't aware of that rule (and it doesn't seem important anyway)
 
2:31 PM
@rak1507 you'd have this
 
@dzaima which is fine, scalars are different to vectors and matrices
 
@rak1507 they're really not any different though
(I'm not saying that 'abc'≡'abc' 'def'[⎕IO] wouldn't be beneficial, but I am saying it'd be extremely inconsistent)
 
3:19 PM
fair enough
 
4:17 PM
@rak1507 It isn't the result of bracket indexing that is the problem; it is bracket indexing (and squad indexing) that is the problem. If you didn't have squad indexing, but did have sane indexing, you'd use to extract an element, and to select multiple elements.
 
 
4 hours later…
8:25 PM
how do I make a hashmap in APL? assume I want a string=>int hashmap with a default value, and i want to for example add some value to each key
 
8:47 PM
I initially came up with this: {(v k)←⍵⋄idx←(,1↑⍉⍺)⍳⊂k⋄idx<≢⍵:(((⊂k),v+2⊃idx⊃↓⍺)@idx)⍺⋄⍺⍪k v}
      tab
┌→──────────┐
↓ ┌→─┐      │
│ │hi│    3 │
│ └──┘      │
│ ┌→────┐   │
│ │hello│ 4 │
│ └─────┘   │
└∊──────────┘
      tab map 5,⊂'hi'
┌→──────────┐
↓ ┌→─┐      │
│ │hi│    8 │
│ └──┘      │
│ ┌→────┐   │
│ │hello│ 4 │
│ └─────┘   │
└∊──────────┘
      tab map 5,⊂'test'
┌→──────────┐
↓ ┌→─┐      │
│ │hi│    3 │
│ └──┘      │
│ ┌→────┐   │
│ │hello│ 4 │
│ └─────┘   │
│ ┌→───┐    │
│ │test│  5 │
│ └────┘    │
└∊──────────┘
although it needs special casing initial tables of invalid shape because that's not gonna work just yet.
 
assuming you're fine with O(n) time for all operations, that does work and you probably won't get much better. If not, this is your best bet
 

« first day (1605 days earlier)      last day (1032 days later) »