« first day (315 days earlier)      last day (47 days later) » 
11:00 - 20:0020:00 - 22:00

8:00 PM
@all Do we want to go over time with dyadic ?
@Zacharý No, 0 0⍴⊂0 0
 
@Adám I would have, but I don't know when I should go
 
⍞←(0 0⍴⊂0 0) ≡ (⍳0 0)
 
@Adám 1
 
@Adám Seems fine with me.
 
A⍳B finds the first occurrence of the major cells of B in the major cells of A.
 
8:02 PM
General advice regarding usage of grading in golfing: trial and error are always the fastest way to get it right.
Hi Adam, I finally made it into one of these sessions
 
@Uriel nobody is perfect ;) (at least AFAIK, but I don't think a perfect person has been born yet)
@Uriel well, overtime but anyways :p
 
⍞←'hello'⍳'l'
 
@Adám 3
 
⍞←'hello'⍳'lo'
 
@Adám 3 5
 
8:06 PM
⎕←3 3 5≡'hello'⍳'llo'
 
@Zacharý
1
 
If a cell is not a member, it will return a number one higher than the number of elements.
⍞←'hello'⍳'x'
 
@Adám 6
 
⍞←(3 2⍴'abcdef')⍳(2 2⍴'cdxy')
 
@Adám 2 4
 
8:08 PM
So the "cd" row is the second one, and the "xy" row is not there.
 
⎕←(3 3⍴⍳9)⍳1 2 3
 
@Zacharý
1
 
@Zacharý Yup, the rank is extended as needed.
This behaviour for elements that are not there is really useful for supplying a "default":
⎕←'First' 'Second' 'Third' 'Missing'['abc'⍳'cdab']
 
@Adám
┌─────┬───────┬─────┬──────┐
│Third│Missing│First│Second│
└─────┴───────┴─────┴──────┘
 
@Zacharý You can see that reverse compose ⍒if it is not ⍋it one function that order inverse
 
8:11 PM
@all If you don't have any questions, I think we can conclude the lesson here.
 
@RosLuP Eh?
 
⎕←{⍒⍵}'helloworld'⋄⎕←{⍋⍵}'helloworld'
 
@RosLuP
6 8 5 7 3 4 9 1 2 10
10 2 1 3 4 9 5 7 8 6
 
@RosLuP Yes, it will order in reverse, but it doesn't give the same exact result.
@RosLuP No need for the { and ⍵} there.
OK, this is the end of today's lesson. Feel free to hang around and keep discussing, experimenting, and asking questions. See you next Wednesday!
 
In ⋄⎕←{⍋⍵}'helloworld' the array 'helloworld'
 
8:17 PM
@RosLuP It's amazing how communicating in a system without any need for words (APL) can get a point across easier than, say, English.
 
⎕←{⍋⍵}1 2 3 4
 
@RosLuP
1 2 3 4
 
⎕←{⍋⍵}4 3 2 1
 
@RosLuP
4 3 2 1
 
In In ⋄⎕←{⍋⍵}'helloworld' the array 'helloworld' is seen not as a array of chars but as one aggregate type...
 
8:21 PM
@Zacharý That's the whole point of APL. Being a notation for precise communication of algorithms and ideas.
@RosLuP Uh, explain how so.
 
¨⎕←{⍋⍵}¨4 3 2 1
⎕←{⍋⍵}¨4 3 2 1
 
@RosLuP

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
RANK ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←{⍋⍵}¨4 3 2 1
                                                                                                          ∧

Real time: 0.961 s
User time: 0.886 s
Sys. time: 0.040 s
CPU share: 96.42 %
Exit code: 0
 
@RosLuP You can't grade a scalar.
 
Reverse compose ⍒is not⍋ because they have to return the first index (in case some elements are=)
⎕←{⍋⍵}⊂4 3 2 1
 
8:38 PM
@RosLuP

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
RANK ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←{⍋⍵}⊂4 3 2 1
                                                                                                          ∧

Real time: 0.992 s
User time: 0.924 s
Sys. time: 0.030 s
CPU share: 96.25 %
Exit code: 0
 
⎕←{⍋⍵⊃}⊂4 3 2 1
 
@RosLuP

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
SYNTAX ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←{⍋⍵⊃}⊂4 3 2 1
                                                                                                          ∧

Real time: 1.001 s
User time: 0.941 s
Sys. time: 0.029 s
CPU share: 96.94 %
Exit code: 0
 
@RosLuP you can't grade a scalar
 
⎕←{⍋⊃⍵}⊂(4 3 2 1)
 
@RosLuP
4 3 2 1
 
8:45 PM
⎕←{⍋⍵}4 3 2 5 1
 
@RosLuP
5 3 2 1 4
 
@RosLuP Why don't you just write:
⎕←⍋4 3 2 5 1
 
@Adám
5 3 2 1 4
 
⎕←{⍵+3}4 3 2 5 1
 
@RosLuP
7 6 5 8 4
 
8:55 PM
@RosLuP Or just:
⎕←3+4 3 2 5 1
 
@Adám
7 6 5 8 4
 
9:25 PM
@Adám yes, it is better without that anonymous function; but I would like to know what happen in these functions, what is the argument of function etc
 
@Adám I think I finally implemented a sort for all function
{↑⍣r⊢(↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}
example
⎕←sort←{↑⍣r⊢(↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]} ⋄ ⎕←sort(3 3⍴⍳9)[2 1 3;]
 
@EriktheOutgolfer
{↑⍣r⊢(↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}
 
what
sort←{↑⍣r⊢(↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]} ⋄ ⎕←sort(3 3⍴⍳9)[2 1 3;]
⎕←{↑⍣r⊢(↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}(3 3⍴⍳9)[2 1 3;]
 
@EriktheOutgolfer

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
RANK ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←{↑⍣r⊢(↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}(3 3⍴⍳9)[2 1 3;]
                                                                                                             ∧

Real time: 1.034 s
User time: 0.912 s
Sys. time: 0.045 s
CPU share: 92.63 %
Exit code: 0
 
⎕←{↑⍣r⊢(↑↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}(3 3⍴⍳9)[2 1 3;]
 
9:35 PM
@EriktheOutgolfer
1 2 3
4 5 6
7 8 9
 
there we go, forgot a char: {↑⍣r⊢(↑↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}
⎕←{↑⍣r⊢(↑↓⍣(r←≢⍴⍵)⊢⍵)[⍋⍵]}(3 3 3⍴⍳27)[2 1 3;;]
 
@EriktheOutgolfer
 1  2  3
 4  5  6
 7  8  9

10 11 12
13 14 15
16 17 18

19 20 21
22 23 24
25 26 27
 
@EriktheOutgolfer What are you trying to do here? This only works on non-nested arrays, and ↑⍣r⊢(↑↓⍣(r←≢⍴⍵) is a no-op.
 
11:00 - 20:0020:00 - 22:00

« first day (315 days earlier)      last day (47 days later) »