« first day (1744 days earlier)      last day (903 days later) » 

1:44 AM
140
A: Rolling or sliding window iterator?

Daniel DiPaoloThere's one in an old version of the Python docs with itertools examples: from itertools import islice def window(seq, n=2): "Returns a sliding window (of width n) over data from the iterable" " s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... " it = iter(seq) resu...

 
 
3 hours later…
4:58 AM
How to create .dse files from RIDE (macOS)?
 
 
2 hours later…
7:14 AM
Find the echelon form of matrix does not need division either, then you can use echelon form to find the determinant does not need any division.. correct me if I'm wrong
unlikely anyone can use other language to write a short code for codegolf.stackexchange.com/questions/236835/…
I mean not J or other similar array language,
shorter code than APL,
any Java or Python or C/C++ expert here?
 
7:33 AM
@elliptic00 Yes, it is possible if you do modified Euclidean algorithm on each column
@elliptic00 This is an APL chat room, we don't talk about Java or Python or C/C++ :P
 
@Bubbler, Wait... you need the gcd(a, b), it mean you do need division, unless you can write gcd algorithm without division. Yep, you can just use subtraction but it is very slow I think,
 
Oh right, you'll need to do modulo anyway
 
 
1 hour later…
9:07 AM
 
 
1 hour later…
10:11 AM
Does anyone understand this?
 
10:47 AM
looks to me like it's just a regular triangle
 
11:06 AM
any improvements on {-m+.×⍨(+\-+/)@(∘.=⍨⍳∘≢)⍵×∘.≤⍨⍳≢⍵}\(≢m)⍴⊂m←⎕ for codegolf.stackexchange.com/questions/236835/… ?
 
11:40 AM
@Adám Yep that is not Pascal's triangle. That is just a triangle.
 
12:11 PM
@rak1507 (≢m)⍴⊂m←⎕(≢⍴⊂)m←⎕
 
@Adám nice
 
12:25 PM
Huh, BQN ends up shorter. I think the biggest savings is in the iteration. The +\-+/ trick comes out equal to +`∘-∘».
 
12:43 PM
You don't need m in the dfn because it's already passed as the left argument. With {-⍺+.×⍨(+\-+/)@(∘.=⍨⍳∘≢)⍵×∘.≤⍨⍳≢⍵}\≢⍴⊂, APL is ahead by three.
Except that that includes the initial matrix so it's equivalent to +˝∘×⎉∞‿1⟜(-+`∘-∘»⌾(⌽0‿0⊸⍉)×·≤⌜˜⊒˜)⍟⊒˜. BQN again ahead by one.
(That's -2 in the original BQN as well, by moving 1↓ to the beginning and losing the parens in (1↓⊒).)
 
 
2 hours later…
2:19 PM
@Marshall oh yeah, duh
nice improvement
@Adám aplcart.info/?q=theoretical%20stand# rogue s in the standard deviation
 
3:07 PM
Has anyone taken a survey of whether people find it easier to use LTR or RTL?
I was wondering about why Iverson chose RTL for APL when (imo) it would've been less intuitive (except to APLers, but they didn't exist yet)
 
kind of hard to survey that if noone's used an LTR APL because there isn't one
 
Oh
I kinda expected someone to have made one already
 
LtR would probably be more intuitive for dyadic calls, but way less intuitive for monadic ones (f g h x vs x h g f)
@user some exist, but they're also wildly different in most other ways too
 
On top of that, if one did exist most of us would've used RTL, meaning we'd see little benefit in LTR. Imo, it doesn't really matter.
 
I personally quite like seeing languages with the pipe operator (although I've never used it) because you can do stuff like [1, 2, 3] |> map sqrt |> sum
 
3:11 PM
but having to use that for everything?
 
@dzaima Do you know of any? I'd like to see them
 
I wish APL had a good pipe syntax, so you don't have to do assignment for each line. Other than that, it'd be very verbose and annoying
 
@dzaima With the pipes, that'd be quite annoying, but without, it might still be okay
 
@user wiki
 
Thanks!
 
3:16 PM
@dzaima (note that the "I" language doesn't have syntactical monadic invocation, so doesn't have to worry about them)
 
@user On second thoughts, 1 2 3¨(⊢*.5)\+ doesn't look great (but that might be because I'm used to RTL?)
@dzaima Apparently, it's been described as "not usable" though
 
yeah
 
@rak1507 Thanks. Fixed.
@user Why is it that 1 2 3.map(⊢*.5)\+ looks better?
Or even 1 2 3.map(⊢*.5).scan(+)
 
3:31 PM
you can have first class functions this way, can't you
 
How so?
 
[1, 2, 3] | Map[⊢*.5] | Scan[+] Is pretty syntax
 
[1, 2, 3] | ¨[⊢*.5] | \[+] is for some reason ugly.
 
Yes, quite weird
 
And still [+]\[⊢*.5]¨[1, 2, 3] looks quite fine. Odd.
 
3:46 PM
@Adám Perhaps because you're just used to seeing that in other languages?
(btw I used \+ but that's supposed to be sum, I just flipped the slash for symmetry)
List(1, 2, 3).map(math.sqrt).sum with a .sum at the end feels entirely idiomatic in Scala
@Adám I guess when you start adding so much stuff to your syntax (whitespace, [], ,, and |) the coolness of APL's symbols goes away and they instead make it harder to read
 
Yes, APL's syntax is quite barebones, adding to it seems like a mistake. It's hard to say where the prettiness comes from, maybe we should ask new users what they think. I'm a fan of Mathematica's synax, it's how my APL would look, with inspiration taken from functional programming [1, 2, 3] /@ [* (.) 0.5] | Scan[+]
 
I'd definitely get rid of stranding. Iverson had (1,2,3) and it was originally implemented as (1,2,3)
Announcement: BAA webinar now! Zoom 858 532 665, passcode: ×/1920 12 17
Subject: LUV – LookUp Value pairs
 
@Adám interested in finding out what this is
I saw the description in the email
wonder if it's much more than two vectors
 
 
3 hours later…
MrV
6:57 PM
Hey guys, can anyone share me a resource(article, documentation etc.) on file reading in apl(dyalog) as well as converting character sequences to integers etc and stuff like that?
 
There is probably a pdf on it on Dyalog's site. ⎕UCS for changing characters to integers, ⎕NGET for reading files
> ⎕UCS for changing characters to integers
And vica verca
I was thinking about making documentation on ⎕ functions/commands(?)
 
quad functions are so incredibly annoying to look up
but they are in dyalog's documentation so no point i think
 
@awagga Not sure what you're suggesting. Can you elaborate?
 
I was gonna add a section to my website for quad functions, mainly just making them more accessible. One thing that a lot of newcomers do is "How to read file in X language" with some SEO, that'd be trivial. APLCart is good for simple things but it would be nice to have articles explaining a topic, like file manipulation and the associated functions that are used for it
 
@awagga Nice. We were actually discussing expanding our "getting started" page today, and the subject of system functions came up.
 
7:09 PM
I think something like what I suggested would be great for adoption. The documentation is largely there, just needs to be centralized in an accessible and simple format. I'll get around to doing it regardless - would be a great task for learning
 
MrV
So, suppose I have a vector of enclosed character sequence and I want a vector of integer, how would I achieve that?
 
@MrV E.g. '123' '234'123 234?
 
MrV
@Adám Yup.
 
⎕←⍎¨'123' '234'
 
@Adám 123 234
 
7:20 PM
not even suggesting quad VFI?
 
Oh, good call.
@MrV If you want to be safe, use ⎕←{⊃⊃⌽⎕VFI⍵}¨'123' '234'
 
@Adám 123 234
 
Alternatively: ⊃⌽⎕VFI⍕'123' '234'
 
MrV
@Adám just wondering that if I have a textfile with integers in every line, can I directly get the vector of integers while reading?
 
no
 
7:30 PM
@MrV Yes, ,⎕CSV'pathname'⍬2
Maybe I should add this to APLcart?
 
oh, nice
@Adám is it any faster than ⍎¨⊃⎕NGET'filename'1 (or VFI)? if not, I'd say it's a nice trick but not worth including when the 'obvious' solution is as good
 
  ,⎕CSV p⍬2                     → 3.0E¯1 |    0% ⎕⎕⎕⎕⎕⎕⎕
  ⍎¨⊃⎕NGET p 1                  → 1.8E0  | +481% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⊃⊃⌽⎕VFI⍵}¨⊃⎕NGET p 1         → 5.7E¯1 |  +87% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ⊃⌽⎕VFI' '@{⍵∊⎕UCS 10}⊃⎕NGET p → 2.9E¯1 |   -4% ⎕⎕⎕⎕⎕⎕⎕
  ⍎' '@{⍵∊⎕UCS 10}⊃⎕NGET p      → 4.2E¯1 |  +37% ⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⊃⊃⌽⎕VFI⍵}¨⊃⎕NGET p 1         → 5.8E¯1 |  +91% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
This is for (⊂⍕¨?⍴⍨1e6)⎕NPUT p
 
Oh interesting
 
The −4% solution is non-obvious imo, so the ⎕CSV one is compelling.
Btw, they are not entirely equivalent. ⎕CSV will handle '-1e-3' '+2e+2' and none of the others will.
This, imo, is further a compelling reason.
 
7:48 PM
if the left operand is a boolean vector, do and differ?
 
@KamilaSzewczyk Yes: ⎕←1 0 1⊂'abc' ⋄ 1 0 1⊆'abc'
 
@Adám
┌──┬─┐
│ab│c│
└──┴─┘
┌─┬─┐
│a│c│
└─┴─┘
 
oh. i see.
 
With Boolean left args, has 1s indicating beginning of segments while has 1s indicating segments.
 
8:06 PM
@Adám fair enough, I would include it then
I should use ⎕CSV more for parsing... clever
 
It can do a lot of cool tricks, not just comma separated values.
 
yeah
 
Orthogonally, it can also read files in chuncks.
Richard Smith makes the most powerful and useful system functions.
⎕XML, ⎕CSV, all the modern ⎕Nxyz, ⎕JSON, ⎕C, ⎕DT, etc.
 
he's dyalog's system function guy then? cool
 
// Java to APL code volume ratio: 1206 / 5 = 240
 
8:10 PM
No, not officially. He's officially our development manager, but he loves doing things like these.
 
my favourite comment in my current codebase
prototyping something in APL and then translating it into a conventional language feels a bit like decompression to me
 
@KamilaSzewczyk Thanks for the edit. Got worried there for a moment.
 
btw, I was thinking earlier in the BAA meeting about serialising arbitrary strings to use as namespace keys, came up with serialise←{⊃(⎕JSON'{"',⍵,'":0}').⎕NL¯2} and deserialise←{¯4↓2↓⎕JSON n⊣(n←⎕NS⍬)⍎⍵,'←0'}, any improvements?
 
@rak1507 What are you actually trying to do? Mangling valid JSON names to valid APL names?
 
8:15 PM
take any string and turn it into a valid APL name
so that it could be used in a namespace
 
ah lol, I thought there'd be something like that
I searched for 'serialise'
 
      0(7162⌶)'--123'
⍙⍙45⍙⍙45⍙123
      1(7162⌶)'⍙⍙45⍙⍙45⍙123'
--123
 
yep, that's exactly what my functions do too
 
@rak1507 I'll add that. Any other terms while I'm at it?
 
8:16 PM
@Adám don't think so
so yeah, the process of storing string/value pairs could be storing the mangled string in a namespace I think
and then you get ⎕JSON etc support out of the box
 
yeah, and that could easily be adapted to mangle the strings too
 
Of course.
@rak1507 Your functions would have failed on '"'
 
oh, true... didn't think about that haha
 
8:45 PM
Sometimes, I feel like I'm writing more Perl than APL:
⍺←0
type←⎕C⊂⍺
Untilde←'(\W|^)~\+' '(\W|^)~-' '(\W|^)~(\W|$)'⎕R'\1[PWD]' '\1[OLDPWD]' '\1[HOME]\2'⍠'UCP' 1⍣(⎕SE.SALTUtils.WIN<type∊'posix' 0)
Sub←{⍵⍵ ⎕R(⍺⍺ {⍵.PatternNum:⍺⍺(⎕SE.Dyalog.Utils.Config ¯1↓↓)⍵.Match ⋄ ⊢/⍵.Match})⊢⍵}
type∊'posix' 'linux' 'unix' 'ux':2 Sub'\\[$\\]' '\$\{([^}]+)}'⊢'\$([\pL_]\w*)'⎕R'${\1}'⍠'UCP' 1 Untilde ⍵
type∊'salt' 'dyalog':1 Sub']' '\[([^]]+)]'⊢⍵
type∊'cmd' 'dos' 'win' 'windows':1 Sub'\^[%^]' '%([^%]+)%'⊢⍵
type∊'ps' 'powershell' 'psh':6 Sub'`[$`]' '\$\{env:([^}]+)}'⊢'\$env:([\pL_]\w*)'⎕R'${env:\1}'⊢⍵
(I've fixed mistakes in the above.)
 

« first day (1744 days earlier)      last day (903 days later) »