Decode problem
4 posts
• Page 1 of 1
Decode problem
In the book : "Mastering Dyalog APL" , page 461 exercise K-1
The question(s):
What is the result of :
a) 0 ⊥ 12 34 60 77 19
b) 1 ⊥ 12 34 60 77 19
Results in 19 and 202 respectively. No problem here
a) +/(12×0) (34×0) (60×0) (77×0) 19
b) +/ 12 34 60 77 19
But what happens with:
2 ⊥ 12 34 60 77 19 (results in 877 , but how?)
I was thinking that I understood ENCODE and DECODE but apparently.... :-(
The question(s):
What is the result of :
a) 0 ⊥ 12 34 60 77 19
b) 1 ⊥ 12 34 60 77 19
Results in 19 and 202 respectively. No problem here
a) +/(12×0) (34×0) (60×0) (77×0) 19
b) +/ 12 34 60 77 19
But what happens with:
2 ⊥ 12 34 60 77 19 (results in 877 , but how?)
I was thinking that I understood ENCODE and DECODE but apparently.... :-(
- hbarkhof
- Posts: 44
- Joined: Mon Apr 09, 2018 8:37 am
Re: Decode problem
Perhaps this will explain it better:
-Veli-Matti
+/ 12 34 60 77 19 × 2*4 3 2 1 0
877
-Veli-Matti
- Veli-Matti
- Posts: 94
- Joined: Sat Nov 28, 2009 3:12 pm
Re: Decode problem
Ah , thus with a 3 the result would be :
+/ 12 34 60 77 19 × 3*4 3 2 1 0
Resulting in 2680
Thanks for explaning , colour me red ! :-)
+/ 12 34 60 77 19 × 3*4 3 2 1 0
Resulting in 2680
Thanks for explaning , colour me red ! :-)
- hbarkhof
- Posts: 44
- Joined: Mon Apr 09, 2018 8:37 am
Re: Decode problem
This might give some kind of insight as well:
-Veli-Matti
⎕IO←1
0⊥12 34 60 77 19
19
0{⍺⊥⍵}12 34 60 77 19
19
1{+/⍵×⍺*⌽¯1+⍳≢⍵}12 34 60 77 19
202
2{+/⍵×⍺*(≢⍵)-⍳≢⍵}12 34 60 77 19
877
3{+/⍵×⍺*(⊢-⍳)≢⍵}12 34 60 77 19
2680
⎕IO←0
3{+/⍵×⍺*⌽⍳≢⍵}12 34 60 77 19
2680
-Veli-Matti
- Veli-Matti
- Posts: 94
- Joined: Sat Nov 28, 2009 3:12 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group