« first day (1832 days earlier)      last day (822 days later) » 

1:08 AM
is there any way to see how a train is evaluated for any given like, train
im trying to break down functions from the cart to try and understand them but i cant pick them apart
 
1:31 AM
in particular this: (10∘⊥⍣¯1)N, to get the digits of N. the usage of ¯1 here within a train doesnt match up with what i currently know about trains / what i thought i understood from what i read
 
1:48 AM
:60298219 try running this in the session:
]box on -trains=tree
 
thank you kindly
 
then just enter your train in the session, without the N
 
oh wow, ⍣ was at the center
would not have expected that ever
but yea thank you thats exactly what i was looking for
yaay
 
And ¯1 is a special right operand to the power operator, which applies the functions inverse. the Docs for Power will explain this
 
1:50 AM
no problem!
 
wait but thats not the power operator, thats repeat?
but now i know how to mess with it to get a better understanding, so thats ok yay
oh, it does say power here, hm
 
It is the power operator, you can apply a function N times, -N will make it apply the inverse of that function N times. Or you can apply a function until a certain condition is met
 
i was looking at the tryapl description and it was different from the dyalog ide one, interesting
 
Check out https://help.dyalog.com/18.0/index.htm#Language/Primitive%20Operators/Power%20Operator.htm

https://xpqz.github.io/learnapl/iteration.html#power
 
ahhh
that makes more sense
 
2:00 AM
Although the use case in the train you're looking at isn't iteration, just to apply the function's inverse
 
right, cause its only -1
so is it inverting ? or the whole of 10∘⊥
 
ooh :]
 
yeah it's inverting 10∘⊥
there's a few other styles you can use ]boxing with to see the train in different ways
]box -??
in the session will show you
 
thank u kindly
very helpful
 
2:19 AM
peekaboo
Stumbled upon this chatroom a few days ago. Howdy everyone!
I've got a small project to make an APL interpreter that looks like the code in the original 1962 book. After hacking up a javascript keyboard, I found Adám's keyboard program and followed links over to the APLwiki which led me here. now.
Are there any plans for more APL Seeds? I'm studying the transcripts from the earlier ones. But more is more, you know?
 
2:40 AM
{(?10 10⍴1000)<¨⍵}100 10
this does not work... anyone know how to make it work? like what i want to happen is it makes multiple arrays and each has a diffrent percentage of ones based on the input, but i can't get the ¨ operator to do < on each element of ⍵.
 
3:11 AM
@BrianBED the ¨ operator when given two arrays will try to "match" their elements together
{(⊂?10 10⍴1000)<¨⍵}100 10 or {(?10 10⍴1000)∘<¨⍵}100 10 should be fine
 
(⊂?10 10⍴1000)<¨⊢ for tacit
but beware the "once only" problem
 
 
5 hours later…
8:11 AM
@thejonymyster You mean the name "Repeat" vs "Power"?
@thejonymyster In addition to what Josh said, you can do 'tc'⎕CY'dfns' then insert tc to the immediate right of every function you're interested in. This will print the argument(s) and result every time the function is called. E.g.
      (+⌿tc÷tc≢tc)3 1 4 1 5
 ≢  3 1 4 1 5  =>  5
 +⌿  3 1 4 1 5  =>  14
14  ÷  5  =>  2.8
2.8
But you still need to know the syntactic class of every glyph; function/monadic operator/dyadic operator.
@thejonymyster Operators have long left scope, so for 10∘⊥⍣¯1 the "looks" to its left for an operand, and finds . Does have a companion left argument? Let's look further left. Oh, ; that'll bind , so we need to look further left. 10, OK, that works, but maybe it is bound but something further left. Nope, there's a ( so we're done.
 
8:59 AM
@luserdroog I don't think so. Those classes kind of become in-depth BQN development discussions.
@LdBeth Or better: (?10 10⍴1000)∘<¨
 
 
2 hours later…
10:40 AM
@Adám I don't see how that can be, unless I'm missing something (entirely possible), or there are a further number of hoops to jump through. Let's say I have the pattern 'ab' and the replacement string 'ba' and the text 'ab ab ab'. I want every possible replacement, so that's:
'ba ab ab' 'ab ba ab' 'ab ab ba' 'ba ba ab' 'ba ab ba' 'ba ba ba'
If I run this with ⎕S with a function operand of something like this:
reg←{
    s←⊃⍵.Offsets
    pre←s↑⍵.Block
    post←⍵.Block↓⍨s+⊃⍵.Lengths
    pre,'abc',post
}
I only get:
 
@xpqz I don't understand what you mean by "every possible".
 
      'ab'⎕S reg⊢'ab ab ab'
┌→────────────────────────────────────┐
│ ┌→────────┐ ┌→────────┐ ┌→────────┐ │
│ │abc ab ab│ │ab abc ab│ │ab ab abc│ │
│ └─────────┘ └─────────┘ └─────────┘ │
└∊────────────────────────────────────┘
 
not sure if this is the right place to post this
but i'm willing to give +100 to anyone who posts a golfed idiomatic APL solution to codegolf.stackexchange.com/questions/205809/…
 
@KamilaSzewczyk ? Oh, I thought you were reacting to xpqz's posts.
 
ah, no, it's about the bounty.
i thought that posting it here might attract some APL programmers
not sure how i'd approach this problem myself so i'd like to see how someone solves this
 
10:43 AM
@xpqz Ah, so you don't want a global (or even limited) replacement; you want all subsets of replacements (except the empty set).
 
That's it, yes. All the different ways you can successfully replace the pattern in the text.
@Adám :) me, too. Was furiously reading back my words looking for something offensive.
 
@xpqz Missing 'ab ba ba'?
 
Eh yes, looks like it. I was generating those whilst typing... missed it.
I guess one could do ⎕R inside the operand, up to Offsets+Lengths, but that seems hideous.
 
@xpqz Something like this:
⋄  ⎕IO←0 ⋄ 'ab'{⍵⍵{⍺⍺⍴⍨∘≢@⍵⊢⍵⍵}⍵¨∊¨+∘⍳/¨¨((l⍴2)∘⊤¨1↓⍳2*l←≢s)/¨⊂s←⍺⍺ ⎕S 0 1⊢⍵}'ba'⊢'ab ab ab'
 
@Adám
┌────────┬────────┬────────┬────────┬────────┬────────┬────────┐
│ab ab ba│ab ba ab│ab ba ba│ba ab ab│ba ab ba│ba ba ab│ba ba ba│
└────────┴────────┴────────┴────────┴────────┴────────┴────────┘
 
10:56 AM
However, this assumes the replacement has the same length as the replacee.
Ah, I have another idea.
 
:) I think that validates my solving this without regex...
 
11:13 AM
@xpqz OK, here's a general regex solution:
⋄ ⎕IO←0 ⋄ 'ab'{((l⍴2)∘⊤¨1↓⍳2*l←≢⍺⍺ ⎕S 0⊢⍵)(⍺⍺{⍺⍺ ⎕R(⍺{0=⍵.⎕NC'n':⍺⍺ ∇ ⍵⊣⍵.n←0 ⋄ (⍵.n+←1)⊢⍵.Match ⍵⍵⊃⍨⍵.n⊃⍺⍺}⍵⍵)⊢⍵}⍵⍵)¨⊂⍵}'ba'⊢'ab ab ab'
 
@Adám
┌────────┬────────┬────────┬────────┬────────┬────────┬────────┐
│ab ab ba│ab ba ab│ab ba ba│ba ab ab│ba ab ba│ba ba ab│ba ba ba│
└────────┴────────┴────────┴────────┴────────┴────────┴────────┘
 
Despite the looks, it is actually quite simple. We just iterate over the masks to see if each match should be replaced or kept as-is.
 
Wow. Fair play.
 
I think a double pass (as indicated by using both ⎕S and ⎕R) is necessary, as the number of results increase twofold each time we hit a match.
 
11:33 AM
@KamilaSzewczyk does regex count as idiomatic APL
cause Regex would do quite well here
 
@Razetime nope
i know that regex does well here :)
 
 
2 hours later…
1:07 PM
@KamilaSzewczyk I'll match that, and then double that sum if the answer is also well-explained.
 
in re: these three pings:
1. yeah, im not sure why theyre differently labelled but im sure its not a huge deal
2. aha, this will be very helpful though thank you, thats exactly what i was hoping to achieve
3. makes sense, im just surprised it can get the inverse of longer functions like that. very cool
:D
 
3. is Dyalog's magic sauce ftw.
 
@Adám hahaha, so +300 for someone in total :)?
 
Yes, I'll add 300 to your bounty.
 
faaancy.
can you cross one of my bounties off your list and gift this rep to the person who posts a solution?
it might be easier this way.
 
1:18 PM
I've already fulfilled all your requested bounties.
 
oh oops. nevermind then
 
1:48 PM
@KamilaSzewczyk does this do the trick?
{∊{0=≡⍵:⍵ ⋄ '(',(∇¨⍵),')'} {(0=≡)tc⍵:⍵ ⋄ ('I'≡⊃)tc⍵:⊃⌽⍵ ⋄ (2=|≡⍵)∧('K'≡⊃∘⊃)tc⍵:⊃⌽⍵ ⋄ (3=|≡⍵)∧('S'≡⊃∘⊃∘⊃)tc ⍵:(x z)(y z)⊣(((s x)y)z)←⍵ ⋄ ∇¨⍵}⍣5⍎⍕'\w'⎕R'''&'' '⊢⍵}
 
beautiful
 
Anyone got some testcases I can test an SKi simplifier on?
 
I'll test it later
 
Not golfed yet, and I have tcs in there too.
 
{'I'≡⊃⍵:⊃⌽⍵⋄(2≡≢⍵)∧(2≤|≡⍵)∧'K'≡⊃⊃⍵:2⊃⊃⍵⋄(2≡≢⍵)∧(2≡≢⊃⍵)∧(3≤|≡⍵)∧'S'≡⊃⊃⊃⍵:(2⊃⊃⊃⍵)(2⊃⊃⍵),¨⊃⌽⍵⋄∇¨⍵}⍣≡{' '~⍨,⍵,⍨⍪' '''[1+0,2≠/'()'∊⍨⍵]} is what i've got so far.
works on the single test case given. that question could definitely use comprehensive tests.
@Adám hm did not think about pattern matching
do you plan on using an error guard
 
1:52 PM
How? Why?
 
well if the pattern match assignment fails you can try a different pattern.
and then finally if all the patterns fail just return ⍵
 
Afaict, I check if the depth is 3, so the assignment must succeed, I think.
 
oh ok
 
@KamilaSzewczyk Are we allowed to use regex to insert quotes or no regex at all?
 
2:15 PM
@Adám i'd rather you not use regex
 
No worries. It is like 2 bytes longer without.
 
oh, very cool
i wonder whom i should award the bounty to in the end, provided both of you post
 
@KamilaSzewczyk What do we do about loops? My solution alternates between ((KI)(((SI)I)((SI)I))) and ((KI)((I((SI)I))(I((SI)I))))
 
@Adám assume looping input as illegal input, i think that's what i did.
'I'≡⊃⍵:⊃⌽⍵
(2=d)∧'K'≡⊃⊃⍵:⊃⌽⍵
can't this be golfed to a single guard?
i guess that no short circuiting might be a problem maybe?
 
That shouldn't be a problem. Thanks.
 
2:28 PM
i feel so stupid, it took me a few lines of code to write what you expressed as ⍎⍕{3⍴''''⍵}¨@{⍵∊⎕A}⍞
i guess one good thing about my solution is that it was flat and didn't use eval... but that's not what you care about in code golf :)
 
Well, you asked for idiomatic code. Although not sure what "golfed idiomatic" means. Oxymoron much?
 
oh - i just didn't want regexes and that sort of stuff
 
well there's probably a way with the depth array from -⌿'()'∘.=⍵
 
(your solution is good i like it)
by the way - @Adám shouldn't ((K(SS))S) simplify to (SS)?
 
I have no idea. I don't know anything about this; I'm just happily implementing whatever the OP says.
 
2:33 PM
The SKI combinator calculus is a combinatory logic system and a computational system. It can be thought of as a computer programming language, though it is not convenient for writing software. Instead, it is important in the mathematical theory of algorithms because it is an extremely simple Turing complete language. It can be likened to a reduced version of the untyped lambda calculus. It was introduced by Moses Schönfinkel and Haskell Curry.All operations in lambda calculus can be encoded via abstraction elimination into the SKI calculus as binary trees whose leaves are one of the three symbols...
using the rules here
((Kx)y) = x
your implementation gives ((SS)S) which seems like an easily fixable problem
(SS) = x, S = y, for the record
 
Right, I see that.
Huh, I fixed that, but broke OP's test case ⍨
@KamilaSzewczyk I had a typo there, making it seem like they can be combined.
 
you can use this for testing expressions
 
@KamilaSzewczyk I wouldn't really know what to put there :-) but I've added that test case. Have a look.
 
very nice
 
Now I so want monadic to be ⊃⌽, (which is a Dyalog optimised idiom, btw, so a great candidate for a primitive).
I wonder if (x z)(y z)⊣(((s x)y)z)←⍵ could be written better.
x y,⍥⊂¨⊃⌽(((s x)y)z)←⍵
 
3:05 PM
@Adám the TIO link to the database keyed property in chat.stackexchange.com/rooms/52405/conversation/… is a bit truncated; any chance you recall what the statements were that you ran in that demonstration? I see:
i←⎕NEW DataBase
i.K[⊂'Dave';'name' 'age']←'David' 31
i.K[⊂'Ernie';'name' 'age']←'Ern
 
3:29 PM
      v←?⍨10
      (⌊/v)←6
SYNTAX ERROR
      (⌊/v)←6
           ∧
@Adám :(
 
⌊/v is always ⎕IO here.
But you can't assign to a value, only to an element of v
 
oh, hmm
could one make this work?
 
((⊃⍋v)⊃v)←6 works
 
oh. true
 
((v⍳⌊/v)⊃v)←6 too.
 
3:32 PM
so [] and return elements that i can assign to
is modified assignment documented strictly anywhere?
 
Yes, and and the function / etc.
I was about to refer you to APLcart, but it points at the wrong place.
However, this is actually selective/indexed assignment.
 
hm, thanks
assignment in APL is so cool
reminds me of elixir style pattern matching but much better
 
@KamilaSzewczyk … except in dfns. Dfns are broken.
 
how so?
 
Dec 7 '20 at 17:32, by Adám
@voidhawk … ⊢{a←1 ⋄ }0 giving a value error; can't trace into a one-liner dfn; →0 in the session quits instead of resuming execution; plus←+ ⋄ a plus← and plus←+ ⋄ 1 plus a←2 overwriting plus; :: failing to catch ⎕SIGNAL etc.
 
3:39 PM
oh some of these issues i knew about
will these be fixed one day?
 
The first one could be fixed, the second is so-so because it is ambiguous, the rest cannot be fixed without braking lots of existing code.
 
> Can't. The curse of a user base with existing code.
aaaaaaaaaaaaaaaaaaaa
 
We are contemplating adding a variant of tradfns which would provide auto-localisation and anonymous definition, with the assumption that those are actually the main reasons people like dfns.
 
adding new syntax that is similar to an existing thing is giving me C++ flashbacks
 
APL++!
 
3:44 PM
What else can we do?
 
~~we need a new ML~~
 
@KamilaSzewczyk Dark Souls boss music plays
 
@Razetime are you planning to post your solution, btw
 
@KamilaSzewczyk Yeah, but changing syntax with "⎕ML" is more severe than just changing semantics.
 
no, you can award the bounty to Adám
 
3:45 PM
@Adám we could have a toggleable "sane apl" vs "traditional apl" thing
or something
fair
@Adám feel free to chip yourself +300 while i set up +100 now
 
Uh…
 
(joke)
done
 
I'll just sit here basking in my own rep.
 
haha
i can't award it now but i'll see if i can tomorrow/in 2 days due to this dumb restriction. it's up anyway.
 
No rush. Feel free to leave it for a week for maximum exposure :-)
 
4:21 PM
Can I use rank () to iterate over the columns of a matrix, without like transposing the matrix first?
 
Depend on what you're doing.
 
4:32 PM
is there an installation guide on py'n'apl? i am getting frustrated trying to download it because i can't get anything to work
 
I'm working 2016 practice problem 1, where we compute the mean, which I thought would be trivial. I'm not sure how to make it work nicely with an empty array other than a guard (I routinely run into this problem - either mapping or reducing across an empty thing and not getting the value I want). Also, I made it work for the multidimensional case, but I'm not sure if there's a superior way to do so.
{⍵≡⍬:0⋄((+/÷≢)⍤1)⍉⍵}
 
@taronish Have you tried +⌿ instead of +/?
 
@Adám I did, in an earlier version, but couldn't quite make it work since the reduction was happening along the columns but the rest of the train didn't operate on the values I needed (I think, anyway) and I couldn't quite figure out how to fix it.
I can start on another attempt with +⌿ and see where it leads me!
 
@taronish In general, for maximum versatility, write your code using leading-axis orientation ( instead of / and instead of , etc.) as that will make application using much neater.
 
@BrianBED Is there a specific issue? I download the project as a zip and unzip it, then
]load /path/to/pynapl/pynapl/Py.dyalog
 
4:39 PM
:O imma try that
 
@BrianBED that's "technically" what the first part of the README says, but I can now see that it's not as explicit as it could be
 
@Adám I definitely don't have a good grasp on concepts like leading-axis yet (and I'm not sure that the page on the APL wiki is going to be of much help). I got this working, but I must confess I used the tried-and-true method of monkeying around until things worked, and I don't understand why it works with the "2".
{⍵≡⍬:0⋄((+⌿÷≢)⍤2)⍵}
 
@RikedyP yea dude i was basically trying ]load py and every time it gave error i moved the file location.... i did this like 10 times :|
 
@BrianBED Also note: ]cd tells you the current directory
you might be in /win/system32
 
@taronish I believe that would fail on say 0 2 3⍴0 but try (+⌿÷≢) ans see if you can fix it.
 
4:44 PM
@RikedyP ahhh yes i am
 
@BrianBED I don't know why Dyalog starts there, but it's easy enough to work around so I guess changing that hasn't been prioritised
 
@Adám It passed all the tests on the site ... but I will start fresh with:
(+⌿÷≢) 0 2 3 ⍴ 0
and see where it goes!
Thank you.
 
@taronish I'll look at updating the site for more comprehensive tests.
 
@RikedyP imgur.com/1UNVQft uhhh i must be doing something wrong but idk what
 
> Persinal
 
4:47 PM
@BrianBED you need to specify the full path down to the Py.dyalog file
 
ah cool one sec
 
e.g. ]load "C:\Users\rpark\Downloads\pynapl-master\pynapl-master\pynapl\Py.dyalog"
Then you should be able to:
py ← ⎕NEW Py.Py
'1+⎕' py.Eval 3
 
@RikedyP You don't. It can be relative to the current dir, but if you begin with / it'll be relative to the current drive.
 
@Adám lmao that directory has too many python scripts that have a specified path
 
@Adám ok but I'm trying to give advice that will work, not explain the whole Windows file system,
 
4:52 PM
still error
wait im dumb
 
@BrianBED you have to change the thing
 
yess!! it now said #.py which is indeed not an error :D
 
@BrianBED nicely done :)
 
Still amuses me: APL in python in APL in python....
 
5:19 PM
@Adám Seems like failing to catch ⎕SIGNAL could be fixed in a major release. Wasn't the whole scoping rules for error guards changed in not so distance release?
 
@PaulMansour You can't change that, as people can rely on a dfn used inside a tradfn to leave.
 
Dyalog can and has made breaking changes, right?
 
Only when very convinced it was a real bug, and even then it was regretted. E.g. ⍳⍬
 
The way error guards were handled was changed
I don't think it was regretted.
 
I'm not sure what it is you have in mind. We're currently fighting with fall-out from the fix to the famous Mantis 17.
But that's dfn scoping in general, not error guard scoping.
 
5:25 PM
Error guards did not catch errors thrown in dfns in a different capsule
This was changed not that long ago
 
Yup, I see that:
Dyalog APL/W-64 Version 12.1.1
Serial No : 314159
Unicode Edition
Mon Jan 31 17:26:45 2022
clear ws
      foo←{0::'caught' ⋄ bar ⍬}
      bar←{∘∘∘}
      foo 2
SYNTAX ERROR
bar[0] bar←{∘∘∘}
             ∧
 
This was not a bug, but an original design decision to be more "functional". Scholes and Foad changed it.
 
Not sure how that's not dysfunctional.
 
Static scoping vs dynamic scoping maybe?
 
Maybe. Error guards are dynamically scoped, afaict.
 
5:31 PM
Anyway, the issue with ⎕SIGNAL is only if its in the same capsule, and if its in the same dfn, its a little silly anyway, as one could just use a regular guard. So I wouldn't advocate changing it.
 
Can you explain how one could replace an error guard with a regular guard?
 
Why would use ⎕SIGNAL in a dfn to be caught by an error guard in the same dfn?
 
E.g. here I use !# instead of ⎕SIGNAL because the latter would leave.
I don't want to repeat A⊣((⍺⍺)A)←⍵ and having to dfn-wrap and name that would complicate the code a lot.
 
Right, i said that above, a nested dfn is really the only place this bug hurts.
In a single standalone dfn, ⎕SIGNAL to an error guard doesn't seem to be to useful, I doubt anyone does it.
 
The current behaviour does fit the name "signal" as it sends a signal out. You never signal yourself, however you can "throw" something to yourself. Maybe we could simply add ⎕ERROR or similar.
Or maybe just an option on ⎕SIGNAL to stay in capsule.
 
6:10 PM
@Adám Good ideas. But regarding non-breaking changes/enhancements to Dyalog, does not almost every enhancement have the potential to break existing code? The only questions is how much code. I'd bet changing ⎕SIGNAL in dfns would break less code than say extending the domain of some primitive.
Or maybe not, but the point remains.
 
@PaulMansour As I understand it, we reserve the right to make errors into non-errors. (Took me a while to get used to writing ∘∘∘ instead of *** when I came to Dyalog from APL+)
 
Right, but you are not going to make 2 3 + 1 2 3 work.
Because the real question is how much code you are going to break.
 
@RikedyP Ok so i hope I'm stupid again but honestly i can't figure out why it isn't importing correctly. i've been trying for like an hour now trying to import APL (which does work somehow) but it doesn't work at all because it says undefined when i use it for eval or anything. imgur.com/IHaG3Le
 
@BrianBED Did you do the apl = APL.APL() step?
 
 
3 hours later…
9:39 PM
Can I make an APL function optionally take 0 or 1 argument?
 
10:21 PM
hmm, figured that's impossible, it seems the only one possible to be optional is left argument.
 
10:38 PM
@LdBeth Let's say you wanted to create the vector 1 2 but instead of 1 you want your function's return value when called niladically. Easy: myFun 2. Let's say you wanted to call your function monadically with the argument 2. Easy: myFun 2. You see the problem?
 
11:24 PM
@xpqz Click on a message to jump to the transcript where you can see the whole thing.
@xpqz Maybe add a note and link that if you then hash your lookup table, your sparse array can be very performant.
 

« first day (1832 days earlier)      last day (822 days later) »