« first day (1550 days earlier)      last day (1105 days later) » 

8:32 AM
Hi guys, MDA book p306 Laminate. I can visualize what Boys,[0.5]Girls does. I have difficulty visualizing in my mind what Boys,[1.5]Girls does. I can follow examples and sort of understand what it does. But struggling with intuition... Any tips will be helpful. Thanks!
e.g. I visualize Boys,[0.5]Girls as two flat tables sitting on top of each other in new dimention. But with others I get stuck...
 
I've never read that book. What are the dimensions of the two arrays?
 
⍴Boys same as ⍴Girls is 3 4
ok Boys,[1.5]Girls is maybe Boys interlaced with Girls and then split into new dimension of pairs...
but Boys,[2.5]Girls is complete messes with my brain
 
When using a fractional axis, the integer portion defines where the new axis is added
To be specific the new axis is ⌈x where x is your axis parameter.
 
ok numerically I understand what happens to the axis
what my mind struggles with what happens with data in the matrices in this case A,[2.5]B
 
8:47 AM
It seems you're using ⎕IO←1
In any case, are you're doing is that you are extendig along the minor axis (rows)
 
Yes it's Dyalog default I think
 
So you can think of it as rotating the two arrays in 3-dimensional space so that they are oriented along the new horizontal axis and then gluing them on top of eachother
All the laminates to the same thing, they glue two 2D arrays on top of eachother. The axis just specifies the orientation of the new 3D array
⎕IO←1 is a bad default, and I will always maintain this.
That's why my implementation only supports ⎕IO←0
 
@EliasMårtenson ok this is helping I think 'orientation', let me rotate these in my mind
 
 
3 hours later…
ngn
11:36 AM
@k1m190r the other cases are "side by side" and "one in front of the other"
@k1m190r what happens with the data - for fractional k: ⍺,[k]⍵ ←→ ⍺,[⌈k]⍥(,[k])⍵
monadic ,[k] inserts a 1 in the shape of its argument. we do this to both ⍺ and ⍵, and concatenate along the new axis
@k1m190r not a good reason to use it :)
 
ngn
12:01 PM
@ngn (in case it's not obvious: inserting 1 in the shape doesn't affect the content)
 
 
1 hour later…
1:03 PM
I've implemented when in KAP. I know APL purists will be shocked, but, it may be a useful feature. Besides, it's implemented purely in KAP itself, so it's not technicallt part of the language: github.com/lokedhs/array/blob/master/array/standard-lib/…
 
RGS
1:50 PM
@EliasMårtenson What's when?
 
@RGS It's basically a multi-clause if. It's similar to cond in Lisp.
So it's basically when { (a) {foo} (b) {bar} (c) {something else} }
If a is true, then foo is run.
 
RGS
Yeah, I think I get it. Thanks :)
 
2:10 PM
@EliasMårtenson so just {a:foo ⋄ b:bar ⋄ c:something else} (without it annoyingly changing scope and requiring single-statement cases)?
 
3:03 PM
@dzaima Yeah, pretty much.
 
 
2 hours later…
RGS
5:06 PM
How can I call a tradfn that returns no result from within a dfn and not leave the dfn?
E.g. if I want to call a tradfn whose only job is to produce side-effects.
 
6:01 PM
@ngn thank you! another day to digest the meaning of this one liner for me :)
next question
dbinom←{
⍝ p dbinom n k
⍝ p is prob of k
⍝ P ← (k!n)×(p*k)×((1-p)*(n-k))
p←⍺
n←⊃⍵
k←⊃1↓⍵
(k!n)×(p*k)×(1-p)*n-k
}

My mind is spoiled by other languages... What would be a more idiomatic way to define this as dfn?
My question is: in general how would you define this function staying in dfn land? or this sort of function belongs to tradfn land?
 
ngn
@k1m190r you can write n k←⍵ instead of n←⊃⍵ and ` k←⊃1↓⍵`
 
@ngn thank you. What about passing 3 arguments to a function? Is the way I defined is ok?
 
ngn
6:16 PM
@k1m190r yeah, that's one way to do it
 
awesome thanks!
 
ngn
you can also make a dop and accept the third "argument" as operand ⍺⍺
btw, it can be shorter if you swap n and k: {(!/⍵)××/*/-⍨⍀⍺1,⍪⍵}
 
:) have not progressed far enough in the book for the dops
 
ngn
"the book"?
 
Mastering Dyalog APL
 
ngn
6:18 PM
ah
for a moment i thought it might be "the book" in paul erdos sense :)
 
@ngn ahaha no a little more trivial for now
 
ngn
he imagined a book in which all beautiful mathematical proofs were written, and when he came across such a proof he used to say it's from "the book" :)
a dop is just like a dfn except that it mentions ⍺⍺
⍺⍺ is the (left) operand
 
ok jumped ahead reading ... on dops
 
 
1 hour later…
7:35 PM
@RGS from dfns.dws the "do" operator is one way to do it
 do←{                  ⍝ Apply no-result function "en passant".
     ⍎'⍺⍺ ⍵ ⋄ ⍵' ⋄ ⍺⍺
 }
 

« first day (1550 days earlier)      last day (1105 days later) »