« first day (1167 days earlier)      last day (1503 days later) » 

12:04 AM
@Bubbler @dzaima Maybe I should make it more clear that these are my personal guidelines. They are not endorsed by Dyalog. The reason I dislike parens that change the order of execution is that I can't hold the intermediate values in my head.
 
For identifiers, Attributes vs GetAttributes doesn't look like a good example because GetAttributes can be seen as part of getter-setter pattern if there is another function called SetAttributes.
 
Good point. Maybe ExtractAttributes?
 
Probably.
FWIW, many style guides (for other languages) say "function names should read like a verb (phrase), and variable names should read like a noun (phrase)."
 
@Bubbler Yeah, and I used to think so to, but I've reversed course on that. E.g. I prefer Valid over Validate, and Head over Curtail.
 
12:21 AM
@Bubbler that depends on usage - obj.getAttributes() and attributes(obj), and most of APL is of the second type
 
This is also why I object to J's renaming of functions to verbs. I wouldn't mind renaming operators to modifiers (monadic) and combiners (dyadic), though, but certainly not adverbs, especially considering that they can take arrays (nouns) as operands.
 
The "Structure" section has the last sentence broken.
 
Thanks. Fixed.
Made me fix the previous sentence too.
 
12:42 AM
@Adám I think "combinators" is bad word for dyadic operators. Maybe "combiners", as you've written above, is better
 
Looks like Source Sans Pro is not loading properly.
 
Symptoms?
 
> Failed to load resource: the server responded with a status of 404 (Not Found)
Address: https://abrudz.github.io/style/url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,400
 
That's it? It ends with 0,400?
 
At least it does on my Chrome on Windows.
 
12:53 AM
Indeed, so it does on Chredgium.
 
@Adám seems to load the file correctly too though?
 
Yeah.
 
But it isn't used anywhere...?
 
It should be for all non-code.
 
Oh, right.
 
1:11 AM
@dzaima @Bubbler Should be fixed now. (There seems to be a bug in Google code that generates the import statements, so I just included the fonts instead.)
 
 
2 hours later…
 
4 hours later…
6:31 AM
Trying to solve Precious Snowflakes with key. http://beyondloom.com/blog/strings.html
⊃,/(//){{⍺,⍨1=≢⍵}⌸⍵}'somewhat heterogenous'
I feel like there must be an easier way to mask the two columns together and get a flat result.
 
@eyepatch ∊{⊂⍺/⍨1=≢⍵}⌸ should do.
 
 
2 hours later…
8:38 AM
@Bubbler many thanks for taking the time to review my code on codereview.se. Lots of helpful hints for me to learn from.
 
 
2 hours later…
11:06 AM
@eyepatch - Was there any particular reason you want a ⌸-based solution?
 
11:17 AM
I solved it as {⍵/⍨1=+/⍵∘.=⍵}
(I couldn't quite get down to tacit)
 
11:52 AM
@JeffZeitlin ⎕←(⊢(/⍨)((1=+/)∘.=⍨))
Lots of brackets, not my finest work but best I could do
 
@JeffZeitlin @JamesHeslip ⊢(/⍨)1=1⊥∘.=⍨
 
@Adám That was fast
Ah of course, good use of 1⊥
 
@JamesHeslip Getting rid of the last paren by relying on argument being a simple vector: ∊⊢⊆⍨1=1⊥∘.=⍨
 
@Adám Nice.
 
@Adám - One of these days I'll remember that dyad⍨ applied monadically uses the same value for both arguments...
 
12:01 PM
@JeffZeitlin The symbol is literally a selfie. Anyway, you could also have used ⊢∘.=⊢
 
 
2 hours later…
2:07 PM
@Bubbler I took your advice and made a Leftist Tree instead: gist.github.com/xpqz/c10b3009a68f9ffdc84c2fb09b44302a
Pleased with how well that turned out.
It almost looks like APL to my untutored eyes...
...and is half the size.
That is an elegant data structure for a functional implementation.
 
@xpqz Other than using a naming convention, it looks very good to me. Btw, I wrote up my own personal guidelines.
 
(about that, for some reason, personally i very much dislike pascal case for functions)
 
@Adám for a future cultivation (unless the topic's been done already), I'd be interested to learn about workspaces and how to package code into "libraries" or modules etc.
 
@dzaima But you are OK with dromedaryCase?
 
@Adám That's very helpful -- I'll try to adopt your style.
 
2:15 PM
@xpqz No force at all. It is very opinionated about certain things.
 
Opinionated is good.
 
@Adám yeah, uppercasing non-first word first letters is fine by me everywhere
 
Freedom from choice.
 
@dzaima So you wouldn't want to uppercase Variables?
 
@Adám yep
 
2:16 PM
@dzaima Then how can you distinguish variables from functions? (operators don't need the uppercasing for distinction.)
 
@Adám syntax highlighter? :p (aka i don't, and usually that's fine)
 
@dzaima The syntax highlighter cannot always know.
 
@Adám and that's a fault of APL.
(but imo any code both relying on non-obvious function-vs-array confusion and is actually confusable is bad in other ways)
 
I'd like to enforce a naming convention to declare type.
 
@xpqz @Adám +1
 
2:20 PM
what case would you use for things that could be both functions and variables, e.g. ⍺⍺ or if ⍺←⊢?
 
@dzaima I was just about to mention that.
Their class would probably not propagate, so they'd stay as ⍺⍺ ⍵⍵ , but a tradop would be a problem.
 
@dzaima (my personal opinion would be: don't. imo the ⍺←⊢ hack is just horrible, and if i had a good way to, i'd make operators require different implementations for ⍺⍺/⍵⍵ types)
(another thing i've been thinking about is a "Too Late" "compiler" (as opposed to a "Just in Time") - compile functions based on the types encountered in the first run, and continue with that, possibly having different cache for different ⍺⍺/⍵⍵/ types. Solves the problem of runtime overhead of parsing (well, at least after the 1st time) while not breaking too much (getting different type items out of namespaces at the same place/writing different types to the same variable is just evil))
(but it'd probably be much more easier & safer to just go fully static typing, making function/operator access from namespaces be done in some other way)
 
@dzaima I think APL*PLUS does/did that.
 
@Adám huh, so it's not too crazy of an idea
 
ngn
3:12 PM
@Adám it's good you're not in charge
@dzaima iirc dyalog's own 400⌶ did that for globals - it compiled optimistically, assuming that the types (or "kinds": fn vs array) of globals would remain the same next time the fn is called
if they weren't, it simply discarded the compiled bytecode
 
3:44 PM
Back in my heavy Pascal days, I tended to use a somewhat modified Hungarian Notation combined with CamelCase for naming pretty much everything.
 
ngn
4:01 PM
@dzaima here's me talking about it 6 years ago
 
4:55 PM
@Adám - It looks like LINK expects everything to be in a namespace, not in the "root" of the workspace. Is that in fact correct? If so, how do I move stuff into a namespace to make it LINK-compatible?
 
5:15 PM
@JeffZeitlin Old versions struggled with things in the root. You should be able to update it. Otherwise, you can simply make a namespace with a copy of everything: (⎕EX⊢'myns'∘⎕NS)⎕NL-⍳9
 
@Adám - If it matters, I'm on a machine which was virgin when I installed 17.1 from the download page.
 
@JeffZeitlin The machine shouldn't matter. If it is Windows, you can update Link simply by merging the link repo into the Dyalog install folder (you'll see that things like StartupSession/ and startup.dyalog already exist there). "Yes" to overwrite everything.
 
5:32 PM
@Adám - Got it. Downloaded, but I'm back on duty for work, so it'll wait until later this afternoon for install. Mentioned the clean install just in case the version that shipped with the original installer was the "right" one, and just the documentation was a little behind.
 
RGS
5:42 PM
@Adám can I ask you a somewhat personal question?
 
RGS
6:10 PM
On a non-personal note, yesterday I made something incredible
I was able to produce something, let me call it v that had ⍴ v equal to 0
and ≢ v equal to 0
but when printed, it felt like it was printing an extra newline
and ⍬ ≡ v gave false
So I don't know what I had in hands
Or maybe ⍴ v printed nothing as well, not really sure now...
And I can't really recreate what was producing said weird object
 
@RGS was it ''?
 
RGS
@dzaima maybe.
 
(or in general, 0 ⍴ anything that's not a scalar number will behave that way. checks for prototype equality too)
 
RGS
I don't think it was '' because that doesn't print sufficient vertical whitespace
But it could've been ↑ '' '' for example...
 
@RGS 0⍴⊂⊂⊂⊂1 2? (with some other number of s)
 
RGS
6:20 PM
I can't tell for sure what it was but it was really annoying. It was coming as the result of this operation:
I had to iterate over a vector I to create indices to index into a vector V, but when the vector I was `''` the "empty indexing" into V was being performed in such a way that it was producing the behaviour I described
and it was frustrating because I couldn't understand what my dfn was returning. But then I fixed by indexing in a different way, so everything is fine.
 
0
Q: Decoding a telephone number that was masked with letters from the respective keys with APL

RGSLegend says phones used to have keyscitation needed and in those times, a person could "encode" a phone number by creating a word from the letters in the keys with the given numbers. Below is the usual layout of the keys (that matter for my question) of a phone: | abc | def | 1 | 2 | ...

 
RGS
6:37 PM
@Adám How can I distinguish between a vector of characters and a vector of vectors of characters..?
 
@RGS ≡arr - depth
 
RGS
ah
 
7:28 PM
@RGS Go ahead.
@RGS Try applying ⎕SE.Dyalog.Utils.repObj to your mystery array.
 
RGS
8:22 PM
@Adám this is the type of dark magic I will leverage next time I run into a weird problem like this, thanks
@Adám basically I wanted to ask you if you have a preferred time to be asked APL questions; I have to focus on my thesis but I also want to set aside some time to learn APL, so I'd better do that when I know it is most likely you are available/receptive to questions :p
 
RGS
9:03 PM
Also, interesting problem I find recurrently.
I run ⎕ED 2⎕FIX,⊂,'SomeName'
define a dfn called `SomeName` in the file, fix it
reopen the editor with )ed SomeName and do File -> Save As and save the file as a .dyalog file
press ESC to fix the code; when I write )ed SomeName again, the interpreter crashes.
This already happened a couple of times with different functions.
And the APL Stack Trace is empty.
!!! Shorter version to trigger same error:
run ⎕ED 2⎕FIX,⊂,'Test'
write some dfn then File -> Save As and save file as a .dyalog file. Press ESC to fix the file and exit the interpreter.
run )ed Test
The interpreter crashes.
 
RGS
9:32 PM
dist ← {*∘0.5 +/ *∘2 ⍺-⍵}
Why doesn't this dfn work to compute the distance between two points..?
(0 0) dist (3 0) returns 3.16227766 3.16227766
But if I do things just slightly differently it works... so I guess things aren't being parsed as I think they are...
 
@RGS look at *∘2 ⍺- - 2 and are both arrays
 
RGS
Sqr ← *∘2
Sqrt ← *∘0.5
dist ← {Sqrt +/ Sqr ⍺-⍵}
(0 0) dist (3 0)
@dzaima what do you mean?
 
@RGS 2 ⍺ make a strand together, resulting in {*∘0.5 +/ *∘(2 ⍺) -⍵}
 
RGS
ah! ugh -.-
Thanks
In fact, dist ← {*∘0.5 +/ (*∘2) ⍺-⍵} already works
 
10:25 PM
@RGS I'm on UK time. I'm the most likely to answer quickly, during business hours. I'm usually around (with some delays to my responses) every day between 6 in the morning and midnight, except that I'm definitely not here between Friday sundown and Saturday nightfall.
@RGS YOu mean exit the Editor?
@RGS I can't reproduce any of these crashes. Can you maybe screen capture it?
 
11:13 PM
@RGS - Consider *∘÷2 instead of *∘0.5.
 
@JeffZeitlin It should be *∘÷∘2. Also, 0.5 is fine IMO because it's universal and it is exact in IEEE 754, so there's no problem communicating with it and computing with it.
 
@Bubbler - point taken on ÷∘2; and I'm never quite sure where floating point inaccuracy kicks in...
 
@JeffZeitlin Any small multiples of power of 2s are fine, e.g. 0.5, 0.25, 0.75 (though those having long fractional parts, e.g. 0.0625 could be written better using ÷, e.g. 1÷16).
 
11:53 PM
@RGS I'd write dist ← {2*∘÷⍨ +/ 2*⍨ ⍺-⍵}
 

« first day (1167 days earlier)      last day (1503 days later) »