« first day (1071 days earlier)      last day (1877 days later) » 

09:53
@RosLuP Here is something to consider. It is inevitable that we create new abstractions and new semantics to handle the problem we are trying to solve, that is a part of solving the problem.
You can create those new forms by some meta-object protocol, by introducing new names, new constructs with macros, so on and so forth. To the point of creating a DSL, and a new DSL for every problem you solve. That DSL will be effectively a new language, for every problem.
Or, you can build the same kind of idea with a rich and broad set of primitives, as in APL. Even Aaron Hsu's "supreme intelligent and terse style" (as Adam put it) is built on the exact same primitives. There is no layer on top.
I find this to be "easier" on my cognition.
 
1 hour later…
11:15
How can I do binary AND in APL? (eg: 15&42 gives 10)
Umm, convert to binary then logical AND every item...
(I don't know how to convert something to a bit string.)
(All I know is that 2 2 2 2 ⊤ 16 could do a fixed-length conversion)
I kinda did it but it's really dumb
⎕←15{2 2 2 2 2 2 2 2⊥∧/{2 2 2 2 2 2 2 2⊤⍵}⍺ ⍵}42
@EdgyNerd
10
(I'm assuming there is an easier way to make those arrays of 2s)
⎕←15{8⍴2⊥∧/{8⍴2⊤⍵}⍺ ⍵}42
11:26
@a'_'
0 0 0 0 0 0 0 0
I think you need brackets
⎕←15{(8⍴2)⊥∧/{(8⍴2)⊤⍵}⍺ ⍵}42
@EdgyNerd
10
now time to make it work with any size inputs
@EdgyNerd :
⍞←2⊥∧/2⊥⍣¯1⊢15 42
@Adám 10
11:39
This works with any size integers.
oh wow
thanks :D
I made this thing to do the serpinski triangle using that
⎕←{∘.{0=⍺{2⊥∧/2⊥⍣¯1⊢⍺ ⍵}⍵:0⋄⍬}⍨1-⍨⍳⍵}16
@EdgyNerd
┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
│0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│0│ │0│ │0│ │0│ │0│ │0│ │0│ │0│ │
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│0│0│ │ │0│0│ │ │0│0│ │ │0│0│ │ │
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│0│ │ │ │0│ │ │ │0│ │ │ │0│ │ │ │
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│0│0│0│0│ │ │ │ │0│0│0│0│ │ │ │ │
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│0│ │0│ │ │ │ │ │0│ │0│ │ │ │ │ │
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
│0│0│ │ │ │ │ │ │0│0│ │ │ │ │ │ │
├─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
is there a way to turn off boxing on the bot?
@EdgyNerd You can always stick a in front:
⎕←⍕{∘.{0=⍺{2⊥∧/2⊥⍣¯1⊢⍺ ⍵}⍵:0⋄⍬}⍨1-⍨⍳⍵}16
@Adám
0 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0    0     0     0     0     0     0     0
0 0        0  0        0  0        0  0
0          0           0           0
0 0  0  0              0  0  0  0
0    0                 0     0
0 0                    0  0
0                      0
0 0  0  0  0  0  0  0
0    0     0     0
0 0        0  0
0          0
0 0  0  0
0    0
0 0
0
11:50
oh ok
Btw, there's no need for the inner dfn to be separate: ⍺{2⊥∧/2⊥⍣¯1⊢⍺ ⍵}⍵2⊥∧/2⊥⍣¯1⊢⍺ ⍵
oh yeah good point
what is the inverse of 2⊥⍣¯1?
@EdgyNerd And the reason the display is in boxes is because you have elements. You can instead use the result to index into a set of characters.
@rcabaco 2⊥ since ⍣¯1 literally means 's inverse
sorry, better said, what does 2⊥⍣¯1 evaluate to?
yes, i wrote my question incorrectly
11:53
@rcabaco ⊥⍣¯1 is a derived function.
so it is encode?
No, not exactly.
It is the inverse of in the sense that just like it extends its left argument as needed. doesn't do that, instead chopping high digits:
⎕←2⊥⍣¯1⊢123 ⋄ ⎕←2 2 2 2⊤123 ⋄ ⎕←2⊤123
@Adám
1 1 1 1 0 1 1
1 0 1 1
1
can you tell me (sorry for the dumb questions) why you need to "extend its left argument as needed"?
@rcabaco You need to tell how many digits (bits, if binary) you want.
11:56
ah, i see
Otherwise, there's no way for it to know if by "123" you mean an 8-bit or a 16-bit or a 32-bit integer. Or for that sake a 20-bit integer.
So you tell this by giving it that many 2s:
⍞←(20⍴2)⊤123
@Adám 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1
This also allows mixed-radix numbers, like 24 60 60⊤ for time.
11:59
and ⊥⍣¯1 is a way to tell it to "extend as needed"
@rcabaco Yes, because knows how to extend (it assumes all digit positions have same weight), so its inverse knows to do so too.
⎕←{'⎕ '[1+×∘.{2⊥∧/2⊥⍣¯1⊢⍺ ⍵}⍨1-⍨⍳⍵]}16
@Adám
⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
⎕ ⎕ ⎕ ⎕ ⎕ ⎕ ⎕ ⎕
⎕⎕  ⎕⎕  ⎕⎕  ⎕⎕
⎕   ⎕   ⎕   ⎕
⎕⎕⎕⎕    ⎕⎕⎕⎕
⎕ ⎕     ⎕ ⎕
⎕⎕      ⎕⎕
⎕       ⎕
⎕⎕⎕⎕⎕⎕⎕⎕
⎕ ⎕ ⎕ ⎕
⎕⎕  ⎕⎕
⎕   ⎕
⎕⎕⎕⎕
⎕ ⎕
⎕⎕
⎕
@EdgyNerd ^
on a very high level, it translates to ⊤ with the left-argument extension of ⊥? is this about rank?
@rcabaco Yes. No, well, a little.
(scalar)⊤ could have been to make this extension, but instead it was made equivalent to (1⍴scalar)⊤, so in that sense it is about the rank of a scalar vs a 1-element vector.
In fact, I think we should change the definition of scalar⊤ to be scalar⊥⍣¯1
12:05
if you'd ever need to "trim" the encoding wouldn't that require an extra step afterwards, considering it extends as needed?
not sure one would ever "trim" an encode. question just popped up.
@rcabaco If you know the width you want, you can always use the (width⍴base)⊤ method like now. I'm not suggesting it should extend if the left argument is a vector.
12:56
@EdgyNerd I've now added that and similar things to APLcart. Thanks for inspiring that!
oh wow nice
I actually looked it up in there before asking here
@EdgyNerd "Bit-wise application of f over Jv" was there, but not with the keyword "binary" and it may anyway be a bit obscure that that was what you needed.
oh ok
13:49
⎕←{⎕USING←'System' 'System.Collections' ⋄ h ← ⎕new Hashtable ⋄ r←h.Add 'abc' ⍵ ⋄ ⎕←h[⊂'abc']} 5
@TessellatingHeckler
VALUE ERROR
@DyalogAPL DWIM
anyway, that approach does basically work to access the .Net Hashtable collection, and it leads me to a couple of questions; a) if I run h.Add 'abc' 5 twice I get an exception that the key already exists, which I expect. If instead I run h.Add (⊂'abc') 5 repeatedly /something/ keeps being added into the hashtable and the h.Count increases, but what is being added and why is there no clash?
and b) is there any syntax to use enumerators (¨ doesn't work trivially on them), to access Generic collections like List<String> and Dictionary<String, Int> or LINQ features?
14:23
@TessellatingHeckler Bot is on TIO linux, so no .net support yet. Coming this year, though.s
@Adám Who is Dennis and how come he runs the Dyalog APL bot on TIO, when Dyalog already run TryAPL with an online APL environment :eyes:
Apart from being a person who always gets unbelievably short Codegolf answers
15:17
@TessellatingHeckler Dennis just runs TIO. Both it and TryAPL have strengths and weaknesses. Dyalog runs the bot, but it uses TIO to compute.
@TessellatingHeckler Monadic ("materialise") changes a collection into a vector so you can use ¨.
 
3 hours later…
18:02
@aierl If you want write access to this room, just send me an email: adam@ with the same domain as www.dyalog.com
18:18
@Adám It does, thanks! This means I can do {⍵.Key}¨⌷h or ⌷h.Keys
How much use does the .Net code get by Dyalog's commercial customers? Because that seems like it almost is a standard library, referencing the chat of the past few days.
@TessellatingHeckler We actually don't know. We don't do any tracking of our customers at all. For good and for bad. (Likewise, Dyalog APL never "calls home" or requires internet access to verify its serial number, etc.)
Fair comment; I'm just so surprised that I've been on-and-off in this chatroom for about a year now, and seeing several discussions of APL around Reddit and Hacker News, and this is the first time I'm realising that this is possible:

⎕USING ← 'System' 'System.Collections'
Convert.ToBase64String ⊂?10⍴255
DateTime.Now.ToString ⊂'yyyy-ddd-MM'
Text.Encoding.UTF8.GetBytes ⊂'abc'
Environment.OSVersion
and all kinds of other conveniences from PowerShell world
I can't tell if nobody discusses them because they aren't interesting, or are taken for granted, or aren't known, or aren't traditional APL-ish enough, or they do and I haven't seen it
I've asked about this before, touched on .Net crossover, but it didn't click it was /so easily accessible/.
@TessellatingHeckler One of the reasons for not discussing them is that they are not portable (and will work neither on TIO nor on TryAPL (both running on Linux). Luckily, we're getting .NET Core/5 support this year.
@TessellatingHeckler it's not really APL, and (currently) isn't portable. In a perfect world, the .net interface wouldn't be that "interesting"
@TessellatingHeckler Yeah, it is really neat. You can almost take C# code and use as-is in APL.
18:36
@dzaima guess I don't have enough need for working with matrices of numbers to stay in real-APL. The .net interface is interesting because there's no way I can, or want to, write Security.Cryptography.RNGCryptoServiceProvider myself, but leaning on that makes a HOTP/Google Authenticator token easy to write.
@Adám Oh ok. (If Dyalog don't track customers, you must get requests for portability directly?). PowerShell has been "coming soon" on .Net Core for two or three years now. They did a Python2/Python3 split and are now almost back to feature compatibility except with all the bits that are just missing from Core.
@TessellatingHeckler Oh yes, cross-platform .NET and GUI are constantly being requested. GUI is still a bit of a problem, even with .NET Core, as the GUI components of .NET are not being ported for now. However, now we at least have the HTMLRenderer cross platform. (Except on AIX, but who uses a screen on AIX‽)
@TessellatingHeckler In that perfect world, Security.Cryptography.RNGCryptoServiceProvider would be provided in APL (but with as much is in .net, porting everything is obviously infeasible). .net is obviously helpful in some cases, but as i'm on linux, i'm pretty much never talking about it.
19:18
@Adám People use AIX??
@TessellatingHeckler @dzaima Conga has some cryptography built in, an then there's DCL.
@TessellatingHeckler Oh, for sure. If you need top single-core performance, Power excels. It even has hardware DECF support, so everything ⎕FR←1287 is much much faster on AIX.
 
4 hours later…
23:06
@Adám IMO, using 2⊥⍣¯1 for bitwise functions like NAND and NOR is incorrect because it doesn't respect 0 f 0 being 1 at the higher bits.
I'd use "infinite" 2's complement instead, like Python does

« first day (1071 days earlier)      last day (1877 days later) »