Conversation started Dec 6, 2017 at 18:30.
Dec 6, 2017 6:30 PM
Welcome to the APL learning session!
We're in the middle of our functions' marathon. Next up is , called "Grade".
First time here, any quick notes on what I should know in terms of prior knowledge to the language or classroom etiquette?
Note that you can follow the second link on the right to install a language bar, and key bindings so that you can easily type APL characters.
@HyperNeutrino You can find previous lessons here. Only really lesson 1 is necessary.
Ah okay, thanks!
Please feel free to interrupt with any questions.
Monadic takes a simple (non-nested) array and returns the indices of the major cells reordered so that they would order the array.
Easiest to understand with an example:
⍞←⍋3 1 4 1 5
@Adám 2 4 1 3 5
Dec 6, 2017 6:37 PM
This means that the second element (1) is the smallest, then the fourth (1), then the first (3), etc.
So, we can use this to sort the array:
⍞←3 1 4 1 5[⍋3 1 4 1 5]
@Adám 1 1 3 4 5
so grade(a)=b means that a[x] for x in b is the same as sorted(a)?
@HyperNeutrino Exactly. Also, use the language bar so you can have proper APL characters.
ooh ok I'll install that right now
oh this is equivalent to jelly :D
@HyperNeutrino However, you don't need the loop (for x in b) as APL allows indexing with an array, and the result has the same shape as the indexing array.
Dec 6, 2017 6:39 PM
ah ok I see how this works
@HyperNeutrino Well, I bet the U stands for "Grade Up". Jelly comes from J which comes from APL.
Yeah. That seems to make the most sense.
It works on high-rank arrays too:
⎕←3 2⍴2 7 1 8 2 8
@Adám
2 7
1 8
2 8
⎕←⍋3 2⍴2 7 1 8 2 8
Dec 6, 2017 6:41 PM
@Adám
2 1 3
So the first is row 2 (1 8) then row 1 (2 7) then row 3 (2 8).
so the ordering of the arrays is lexicographical or something?
@HyperNeutrino Yes.
Works on characters too, where it grades in Unicode point order:
⎕←5 2⍴'HelloWorld'
Dec 6, 2017 6:42 PM
@Adám
He
ll
oW
or
ld
⎕←⍋5 2⍴'HelloWorld'
@Adám
1 5 2 3 4
⎕←(5 2⍴'HelloWorld')[⍋5 2⍴'HelloWorld';]
@Adám
He
ld
ll
oW
or
⎕←2 2 2⍴⍳8
Dec 6, 2017 6:44 PM
@HyperNeutrino
1 2
3 4

5 6
7 8
⎕←⍋222⍴⍳8
@HyperNeutrino
1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121 129 137 145 153 161 169 177 185 193 201 209 217 2 10 18 26 34 42 50 58 66 74 82 90 98 106 114 122 130 138 146 154 162 170 178 186 194 202 210 218 3 11 19 27 35 43 51 59 67 75 83 91 99 107 115 123 131 139 147 155 163 171 179 187 195 203 211 219 4 12 20 28 36 44 52 60 68 76 84 92 100 108 116 124 132 140 148 156 164 172 180 188 196 204 212 220 5 13 21 29 37 45 53 61 69 77 85 93 101 109 117 125 133 141 149 157 165 173 181 189 197 205 213 221 6 14 22 30 38 46 54 62 70 78 86 94 102 110 118 126 134 142 150 158 166 174 182 190 198 206 
no wait
⎕←⍋2 2 2⍴⍳8
@HyperNeutrino
1 2
@HyperNeutrino First layer, second layer.
Dec 6, 2017 6:45 PM
Did I do something wrong?
wait nvm
@HyperNeutrino No, that's right.
oh right. that makes sense thanks
⎕←4 2 2⍴'Hello World PPCG'
@Adám
He
ll

o
Wo

rl
d

PP
CG
⎕←⍋4 2 2⍴'Hello World PPCG'
Dec 6, 2017 6:46 PM
@Adám
1 4 2 3
Layer 1, layer 4, layer 2, layer 3.
⎕←{⍵[⍋⍵;]}4 2 2⍴'Hello World PPCG'
@Adám

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 2 2⍴'Hello World PPCG'
                                                                                                        ∧

Real time: 1.177 s
User time: 1.069 s
Sys. time: 0.046 s
CPU share: 94.81 %
Exit code: 0
how do you type backticks
@HyperNeutrino backtick,space
⎕←{⍵[⍋⍵;;]}4 2 2⍴'Hello World PPCG'
@Adám
He
ll

PP
CG

o
Wo

rl
d
Dec 6, 2017 6:47 PM
:D cool thanks! also tab backtick seems to work for some reason (I accidentally found that out lol :P)
@HyperNeutrino Interesting, unintentional, useful.
@all Anything else about monadic ?
⎕←⍋⍋4 2 5 1 3
@HyperNeutrino
4 2 5 1 3
⎕←⍋4 2 5 1 3
@HyperNeutrino Cardinal numbers.
Dec 6, 2017 6:49 PM
?
⎕←⎕←3
@HyperNeutrino ⍋⍋ is the cardinal numbers:
@RosLuP
3
3
⍞←⍋'PPCG'
Dec 6, 2017 6:50 PM
@Adám 3 4 1 2
⍞←⍋⍋'PPCG'
@DyalogAPL Hello?
⍞←⍋⍋'PPCG'
@Adám 3 4 1 2
what's the difference between ⍞ and ⎕?
I don't quite understand cardinal numbers..
So P is the third, P is the fourth, C is the first, and G is the second.
@Adám hello, had to study...
Dec 6, 2017 6:52 PM
@HyperNeutrino ⍞← makes an inline response of the first line of the output, and without box drawing characters. ⎕← makes a multi-line response with boxed display.
@Adám I thought those were ordinals? Or are you referring to what they return as ordinals?
ooh okay, thanks!
⎕←⍋2 2 2, 4 5 6
@RosLuP
1 2 3 4 5 6
@RosLuP (2 2 2) (4 5 6)?
Dec 6, 2017 6:53 PM
@RosLuP 2 2 2, 4 5 6 is the same as 2 2 2 4 5 6
⎕←⍋ ⍋ 4 2 5 1 3
@HyperNeutrino
4 2 5 1 3
@Adám wait huh
@RosLuP ⎕←2 3⍴2 2 2, 4 5 6
does putting a space between the two ⍋ help?
Dec 6, 2017 6:53 PM
how does grade up multiple times return cardinal numbers...I thought it was just the same as grade up once
@HyperNeutrino Between what?
@EriktheOutgolfer It is so that the grade of the grade is the cardinal numbers. That is in the nature of grading.
oh I think I get why. grading my test list returns the list itself :P
⎕←⍋ ⍋ 3 5 4 1 2
@HyperNeutrino
3 5 4 1 2
@HyperNeutrino Yes, if your numbers are all the integers from 1 to n.
my numbers were 4 2 5 1 3
Dec 6, 2017 6:55 PM
@HyperNeutrino Because 3 is the third, and 5 the fifth.
So grade grade returns the numbers fitted to 1 ... length(list)?
it was a product of distinct swaps
@Adám um how does ⍋⍋ differ from just
if you continue applying ⍋ multiple times eventually it will form a cycle. I wonder if the period of the cycle has anything to do with the original list
Dec 6, 2017 6:56 PM
@Zacharý So applying to a permutation inverts it (swaps between cardinal and grade)
⎕←2 3⍴2 2 2, 4 5 6
@RosLuP
2 2 2
4 5 6
@HyperNeutrino The period is 2.
oh
well then :P
)about
@HyperNeutrino You can evaluate an APL expression by typing it into chat prefixed by ⍞←. Use ⎕← instead for boxed display and multi-line results. Do not use markdown. Commands: )lb for language bar, )help for table of language elements, )docs for full documentation, )ref for PDF reference card.
Dec 6, 2017 6:57 PM
that's an interesting command syntax for a chatbot :P the unmatched parentheses are bugging me :P
@EriktheOutgolfer is the indices of cells in the order that would sort them. ⍋⍋ is the position each will take when sorted. If you think about it hard, you'll see what swaps back and fort between these two.
@HyperNeutrino That's APL
@HyperNeutrino In APL, all non-syntactic system commands begin with )
ooh okay, interesting
@Adám oh so it's the same, but different explanation?
Dec 6, 2017 6:59 PM
@HyperNeutrino It clearly tells the system that this line is not an APL statement.
⎕←2 3⍴2 2 2 4 5 6
@RosLuP
2 2 2
4 5 6
@EriktheOutgolfer No. they are different ways to state how an array is ordered.
@Adám can you please give an example where they are different? everything I've ever tried it on makes it look like they're equivalent...
Dec 6, 2017 7:01 PM
⎕←⍋'random' ⋄ ⎕←⍋⍋'random'
@Adám
2 4 6 3 5 1
6 1 4 2 5 3
so ⍋ once is what order the elements would be in when sorted and ⍋ twice is the indices that each element would go to?
@EriktheOutgolfer ^ Column 1 says: the "lowest" letter is number two (a) while r is the sixth.
@HyperNeutrino Exactly. Bravo!
Dec 6, 2017 7:03 PM
⎕←⍋'aedcb'⋄⎕←⍋⍋'aedcb'
@EriktheOutgolfer
1 5 4 3 2
⍋⍋⍋ is equivalent to , right?
⎕←⍋'aedcb'⋄⎕←⍋⍋'aedcb'
@EriktheOutgolfer
1 5 4 3 2
1 5 4 3 2
Dec 6, 2017 7:04 PM
@Zacharý Yes.
⎕←⍋'edcba' ⋄ ⎕←⍋⍋'edcba'
lol if the input list can be represented as a product of disjoint 2-cycles applied to its sorted version then ⍋ and ⍋⍋ do the same thing xD
@EriktheOutgolfer
5 4 3 2 1
5 4 3 2 1
⎕←⍋'bcdea'⋄⎕←⍋⍋'bcdea'
Dec 6, 2017 7:05 PM
@HyperNeutrino
5 1 2 3 4
2 3 4 5 1
⎕←⍋'eadbc' ⋄ ⎕←⍋⍋'eadbc'
@EriktheOutgolfer
2 4 5 3 1
5 1 4 2 3
so I guess it must have these two properties to be different
@all Can we move on to dyadic ?
⎕←⍋'aebdc' ⋄ ⎕←⍋⍋'aebdc'
Dec 6, 2017 7:06 PM
@EriktheOutgolfer
1 3 5 4 2
1 5 2 4 3
⎕←⍋⍋'123456789'⋄ ⎕←⍋'123456789'
@RosLuP
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9
Dec 6, 2017 7:09 PM
Actually, one more thing:
Since inverts itself, it is it's own inverse:
⍋⍋a=⍋a only if a is sorted
not necessarily
⍞←⍋6 1 4 2 5 3
@Adám 2 4 6 3 5 1
(⍋⍣¯1)6 1 4 2 5 3
Dec 6, 2017 7:10 PM
@RosLuP not always the case, sometimes that's true even when a isn't sorted
⍞←(⍋⍣¯1)6 1 4 2 5 3
@Adám 2 4 6 3 5 1
f⍣¯1 is inverse of f.
I hypothesize that ⍋⍋a=⍋a if and only if a can be sorted by only applying swaps without moving any element more than once
⎕←⍋5 1 4 2 3 ⋄ ⎕←⍋⍋5 1 4 2 3
@HyperNeutrino
2 4 5 3 1
5 1 4 2 3
Dec 6, 2017 7:11 PM
wait
i'm dumb
⎕←⍋4 2 3 1 6 5 ⋄ ⎕←⍋⍋4 2 3 1 6 5
@HyperNeutrino
4 2 3 1 6 5
4 2 3 1 6 5
⎕←⍋2 1 4 3 5 ⋄ ⎕←⍋⍋2 1 3 4 5
@EriktheOutgolfer
2 1 4 3 5
2 1 3 4 5
⎕←⍋2 1 4 5 3 ⋄ ⎕←⍋⍋2 1 4 5 3
@EriktheOutgolfer
2 1 4 3 5
2 1 4 3 5
Dec 6, 2017 7:13 PM
⎕←⍋2 1 4 5 3 ⋄ ⎕←⍋⍋2 1 4 5 3
@EriktheOutgolfer
2 1 5 3 4
2 1 4 5 3
it might seem that ⍋a=⍋⍋a iff ⍋a=a but that doesn't work when a doesn't contain all 1 to length(a)
⍋⍣¯1
⎕←⍋ 1 2 4 5 ⋄ ⎕←⍋⍋ 1 2 4 5
@RosLuP
1 2 3 4
1 2 3 4
Or a isn't a vector of numbers
Dec 6, 2017 7:14 PM
Anyway, let's move on.
true
okay :D
Dyadic is for character arrays only, and it grades as if the left argument was the alphabet:
⍞←{⍵['aeioubcdfghjklmnpqrstvwxyz'⍋⍵]}'helloworld'
@Adám eoodhlllrw
wait so is this essentially sort to a specific order?
@HyperNeutrino Yes, but a bit more fancy. I'll show.
Dec 6, 2017 7:16 PM
okay
⎕←'dbcafe'⍋'abcdef'
@HyperNeutrino
4 2 3 1 6 5
⎕←4 2 3 1 6 5⍋1 2 3 4 5 6
@HyperNeutrino

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

Real time: 1.096 s
User time: 1.020 s
Sys. time: 0.044 s
CPU share: 97.00 %
Exit code: 0
pffft
I expected that though :P
it only works for char arrays
Dec 6, 2017 7:17 PM
yeah
So how come dyadic isn't able to work on numeric arrays? Is there a specific reason?
If characters are missing from the alphabet, they will be considered after the alphabet, and equivalent:
⍞←'abcdefgh'⍋'hawl'
@Adám 2 1 3 4
⍞←''⍋'hello world'
Dec 6, 2017 7:19 PM
@HyperNeutrino 1 2 3 4 5 6 7 8 9 10 11
@Zacharý It would be possible, I guess, but not very meaningful.
Dyadic can also use multiple levels of sorting:
⎕←⍉↑'aeiou' 'bcdfghjklmnpqrstvwxyz'
@Adám
ab
ec
id
of
ug
 h
 j
 k
 l
 m
 n
 p
 q
 r
 s
 t
 v
 w
 x
 y
 z
This 2D "alphabet" means that all vowels should come before all consonants, and only if otherwise the same, the vertical order will be considered.
@HyperNeutrino so ''⍋⊢ is ⍳∘⍴ (at least for rank 1)
@Zacharý Yes, that's nice for golfing. Never thought of that. ⍬⍋ is shorter and dyadic too (good for trains).
⍞←{⍵[(⍉↑'aeiou' 'bcdfghjklmnpqrstvwxyz')⍋⍵]}'helloworld'
Dec 6, 2017 7:22 PM
@Adám eoodhlllrw
So this sorted all vowels before all consonants, and only then did it sort the vowels and the consonants.
ooh that's cool
anyway brb o/
⍞←{⍵[(⍉↑'aeiou' 'ebcdfghjklmnpqrstvwxyz')⍋⍵]}'helloworld'
@Zacharý eoodhlllrw
@Adám oh so won't cause a DOMAIN ERROR
Dec 6, 2017 7:24 PM
⍞←{⍵[(⍉↑'aeiou' 'bcdfghjklmnpqrstvwxyze')⍋⍵]}'helloworld'
@Zacharý eoodhlllrw
And you can have up to 15 levels of sorting using this.
⍞←{⍵[(⍉↑'aeiou' 'bcdfghjklmnpqrstvwxyzo')⍋⍵]}'helloworld'
@Zacharý eoodhlllrw
@Zacharý If a letter occurs more than once, then its first occurrence rules. This is useful to fill gaps in (e.g.) columns of unequal height.
@all I think that's it for . Any questions?
Dec 6, 2017 7:27 PM
Then what is the difference between {⍵[(⍉↑'aeiou' 'bcdfghjklmnpqrstvwxyz')⍋⍵]} and {⍵[('aeiou','bcdfghjklmnpqrstvwxyz')⍋⍵]}
what are the main uses of ⍋ in real-life/practical usage?
@HyperNeutrino Sorting.
I don't see a reason why it should be limited to 15 levels?
it's not like each level adds one dimension to the array is it?
wait is there no sort monad?
Dec 6, 2017 7:28 PM
@HyperNeutrino no
@EriktheOutgolfer Same reason as arrays having max 15 depth rank maybe?
@EriktheOutgolfer Because the level increases the rank by one, and Dyalog arrays can max have rank 15.
@Adám oh it does?
@Zacharý Rank, not depth. Depth may be infinite (bound by memory only).
(btw Adám's pings are silent for some reason, but not others')
(and that bothers me a little bit because, well, ...)
Dec 6, 2017 7:30 PM
@EriktheOutgolfer I turned my ping sounds off. Wonder if chat is broken.
@EriktheOutgolfer How about now?
yes now they're audible
btw I don't think by turning your pings sounds off it should be silent for me too
@EriktheOutgolfer Silent?
@Adám yes, I think so :/ chat is notoriously buggy btw
@HyperNeutrino No, but I've argued that there should be one.
@EriktheOutgolfer Loud?
I really think there should :P
Dec 6, 2017 7:32 PM
@HyperNeutrino Why?
Golfing (Even though APL is not meant for golfing)
@HyperNeutrino btw the shortest you can get to a short monad for anything is {⍵[⍋⍵]}
well golfing and because having a sort builtin would be so much nicer than {⍵[⍋⍵]}
@Zacharý CXO says: APL is not a golfing language. Sorry!
so simply sorting a list is now to be considered something only useful for golfing languages?
Dec 6, 2017 7:34 PM
Yeah I know, that would be a reason it would be nice, along with ease of typing (rather than typing {⍵[⍋⍵]} every time)
@EriktheOutgolfer It doesn't even sort everything, only simple vectors.
What would be the shortest method for sorting everything then?
wait what does simple vector mean in this context?
@Zacharý J has it better: J's A⍋B is APL's B[⍋A] so you can sort B with B⍋B or ⍋⍨B.
@HyperNeutrino A non-nested list.
but ⍋2 3⍴3 3 6 5 3 2 works?
Dec 6, 2017 7:37 PM
@HyperNeutrino That has rank 2 but depth 1. It isn't nested, it just has two dimensions.
How does that work, anyways? And how many chars is J's equivalent to .
What if for sorting one array one has need to use a special function compare? For example, Axiom has sort(compfunction,arrayObj) if I remember well
⎕←⍋1 2 3 (4 5 6) 7 8 9
@Zacharý Two.
Dec 6, 2017 7:37 PM
@HyperNeutrino

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
⍎DOMAIN ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←⍋1 2 3(4 5 6)7 8 9
                                                                                                        ∧

Real time: 1.150 s
User time: 1.070 s
Sys. time: 0.038 s
CPU share: 96.38 %
Exit code: 0
@RosLuP I don't think there is an operator for that.
@HyperNeutrino That's a seven element list. It has rank 1, depth ¯2 (negative because it is unevenly nested)
@Zacharý {⍵⌷⍨⊂⍋↑⍣≡⍵} is the shortest I've found that can sort any array that has no refs, is homogeneous, and where 15≥⍴∘⍴+|∘≡
Next one will be quick: is the same as but grades descending.
Dec 6, 2017 7:41 PM
⎕←{⍵⌷⍨⊂⍋↑⍣≡⍵}(1 2)(3 4)
@Zacharý
┌───┬───┐
│1 2│3 4│
└───┴───┘
⎕←{⍵⌷⍨⊂⍋↑⍣≡⍵}(3 4)(1 2)
@Adám well, I don't get that, if a builtin was added for that, why shouldn't a builtin for sorting a list shouldn't, that looks more like a golfing feature than a simple sort does...
@EriktheOutgolfer What? Can you fix your grammar?
⎕←2
Dec 6, 2017 7:42 PM
sorry
@Zacharý
2
⎕←{⍵⌷⍨⊂⍋↑⍣≡⍵}(3 4)(1 2)
@Zacharý
┌───┬───┐
│1 2│3 4│
└───┴───┘
Wait, what are refs?
@Adám I meant that, if there is such a built-in (⍒), then I can't get why a sort built-in doesn't exist as well, since IMO ⍒ is more of a golfing feature than a simple sort builtin
Dec 6, 2017 7:44 PM
@Zacharý Pointers to objects. That's for the OOP lesson…
@Adám I'll need to be there for that one.
@EriktheOutgolfer Do ⍒'HelloWorld' using !
⎕←⍋'HelloWorld' ⋄ ⎕←⍒'HelloWorld'
@HyperNeutrino
1 6 10 2 3 4 9 5 7 8
8 5 7 3 4 9 2 10 6 1
⎕←⍋⌽'HelloWorld'
Dec 6, 2017 7:46 PM
@HyperNeutrino
10 5 1 9 2 7 8 4 6 3
⎕←{(⌽⍒⍵)=⍋⍵}'HelloWorld'
@Zacharý
1 1 1 1 0 1 0 0 0 1
⎕←{(⍒⌽⍵)=⍋⍵}'helloworld'
@Zacharý
0 0 0 0 0 0 0 0 0 0
⎕←{(⌽⍒⍵)=⍋⍵}'helloworld'
Dec 6, 2017 7:48 PM
@Zacharý
1 1 1 0 1 0 0 0 1 1
@Zacharý OK, can we move on?
Reverse compose ⍒=⍋
That was what I just was going testing, RosLuP
Dec 6, 2017 7:50 PM
OK, let's see if we can cover .
Monadic is the index generator. ⍳a generates an array of shape a where the elements are the indices for that element:
⍞←⍳10
@Adám 1 2 3 4 5 6 7 8 9 10
⎕←⍳2 4
@Adám
┌───┬───┬───┬───┐
│1 1│1 2│1 3│1 4│
├───┼───┼───┼───┤
│2 1│2 2│2 3│2 4│
└───┴───┴───┴───┘
⎕←⍳2 3 4
@HyperNeutrino
┌─────┬─────┬─────┬─────┐
│1 1 1│1 1 2│1 1 3│1 1 4│
├─────┼─────┼─────┼─────┤
│1 2 1│1 2 2│1 2 3│1 2 4│
├─────┼─────┼─────┼─────┤
│1 3 1│1 3 2│1 3 3│1 3 4│
└─────┴─────┴─────┴─────┘
┌─────┬─────┬─────┬─────┐
│2 1 1│2 1 2│2 1 3│2 1 4│
├─────┼─────┼─────┼─────┤
│2 2 1│2 2 2│2 2 3│2 2 4│
├─────┼─────┼─────┼─────┤
│2 3 1│2 3 2│2 3 3│2 3 4│
└─────┴─────┴─────┴─────┘
Dec 6, 2017 7:52 PM
⎕←⍴⍳2 3 4
@Zacharý
2 3 4
yeah monadic ⍴∘⍳ is the same as monadic
Any bets on what ⍳0 gives?
⍬ ?
Dec 6, 2017 7:54 PM
i'm guessing that's empty list?
@Zacharý Yes. And what about ⍳0 0?
@HyperNeutrino Yes.
ok
@Adám ⍬ as well?
⎕←⍳0 0
@Adám 0 0⍴⍬?
@EriktheOutgolfer

Rebuilding user command cache... done
Was OFF -trains=box -fns=off

Real time: 1.051 s
User time: 0.983 s
Sys. time: 0.036 s
CPU share: 97.05 %
Exit code: 0
Dec 6, 2017 7:55 PM
@HyperNeutrino Nope. remember that the result must have the same shape as the argument.
@dzaima Yes.
@EriktheOutgolfer What explains that then?
@Adám doesn't seem like it
      0 0⍴⍬
┌⊖┐
⌽0│
└~┘
      ⍳0 0
┌⊖──────┐
⌽ ┌→──┐ │
│ │0 0│ │
│ └~──┘ │
└∊──────┘
@EriktheOutgolfer The reason for this strange result is that there is nothing to show, so the bot gives you the debug info instead.
Dec 6, 2017 7:56 PM
@Adám that's why RIDE is useful to have
⎕←⍳0 0⊣⎕SE.UCMD'box on -s=max'
@Adám
┌⊖──────┐
⌽ ┌→──┐ │
│ │0 0│ │
│ └~──┘ │
└∊──────┘
@EriktheOutgolfer Uh, you shouldn't be programming using a chat bot. Yes, use the desktop version and either the terminal interface, RIDE or (on Windows) the IDE.
@Adám I'll install IDE too, when I sometime boot into Windows :-P
@dzaima Oh, no it isn't 0 0⍴⍬ because each element must have two element (coordinates), and in 0 0⍴⍬ each element has only one.
Dec 6, 2017 7:59 PM
it's not a priority for me to request a new license for Windows currently
0 0⍴(⍬ ⍬)?
@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
Dec 6, 2017 8:01 PM
@Adám Seems fine with me.
A⍳B finds the first occurrence of the major cells of B in the major cells of A.
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
Dec 6, 2017 8:05 PM
⍞←'hello'⍳'lo'
@Adám 3 5
⎕←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
Dec 6, 2017 8:08 PM
⍞←(3 2⍴'abcdef')⍳(2 2⍴'cdxy')
@Adám 2 4
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']
Dec 6, 2017 8:10 PM
@Adám
┌─────┬───────┬─────┬──────┐
│Third│Missing│First│Second│
└─────┴───────┴─────┴──────┘
@Zacharý You can see that reverse compose ⍒if it is not ⍋it one function that order inverse
@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
Dec 6, 2017 8:12 PM
@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!
 
Conversation ended Dec 6, 2017 at 20:14.