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

2:41 AM
⎕←{↑{(((o⍸⍵)⊃(⌽⌊o÷2))⍴'-'),⍵⍴'#'}¨o←(1=2|⍳2×⍵)/⍳2×⍵} 3
 
@TessellatingHeckler
--#
-###
#####
 
 
4 hours later…
7:05 AM
@TessellatingHeckler :
⎕←{↑,⌿1↓¨2/¨@2⌽@1⍉'-#'∘.⍴⍨⍳⍵}3
 
@Adám
--#
-###
#####
 
⎕←↑{/∘'-#'¨(⍵∘-,¯1++⍨)¨⍳⍵} 3
 
@Adám
--#
-###
#####
 
7:20 AM
⎕←↑(/∘'-#'¨⊢(-,¯1+2×⊢)¨⍳) 3
 
@Adám
--#
-###
#####
 
 
2 hours later…
ngn
9:10 AM
@Adám ¯1+2×⊢ -> ⊢-1-⊢
 
Ven
Tacks are a thing of beauty.
After all, the dyadic version of the identity operator has to be nice something nice.
 
ngn
⎕←({'-###'/⍨∊⍺⍵1⍵}⌸⌽∘⍳)3 ⊣ ⎕io←0
 
@ngn
--#
-###
#####
 
9:28 AM
⎕←↑'--#' '-###' '#####'
 
@Olius
--#
-###
#####
 
9:51 AM
More seriously:
⎕IO←0 ⋄ ⎕←↑(⊂'-#')/¨⍨(⌽,¨(1+2∘×))⍳4
⋄ ⎕IO←0 ⋄ (↑(⊂'-#')/¨⍨⌽,¨(1+2∘×))⍳3
gaah
⋄ ⎕IO←0 ⋄ ⎕←↑(⊂'-#')/¨⍨(⌽,¨(1+2∘×))⍳3
 
@Olius
--#
-###
#####
 
oh looks like @Adám already found this one :)
 
 
1 hour later…
Ven
11:16 AM
Duh, I spent several hours trying to fix a bug, when I could've just used IO 0 instead...
 
CMQ: How would you demonstrate the power of APL compared to other programming languages for managers to see?
 
Ven
.oO( "It's the 3rd time I have to reimplement a Game Of Life this month! We need a better language to write it in!" )
Morten asked me the same thing, over lunch, during the APL Paris meetup/conference/...
 
@Ven Stencil, 4 bytes 3∊me
 
Ven
Bah :)
 
Ven
11:42 AM
Is there a way to get a lexicographic comparison?
 
@Ven 2-2⊃∘⍋3∘⍴
 
Ven
I suppose Extended doesn't help here?
I just want to compare strings of equal lengths.
 
@Ven Depends on what you want. The above gives ¯1 (left precedes right) or 0 (identical) or 1 (right precedes left).
 
Ven
I just want >, so 0 or 1, but it's easy to derive
 
@Ven And if they are identical, you want 0?
 
Ven
11:51 AM
Yes
 
@Ven >/⍒ gives 1 if left precedes right, 0 otherwise
@Ven >/⍋ gives 1 if left follows right, 0 otherwise
 
@Ven
VALUE ERROR
 
Ven
⎕←(4 2⍴⍕14+'A23456789TJQK'⍳∊1↓¨w),w←'C3' 'H6' 'C6' 'S2'
 
@Ven
┌─┬─┬──┐
│1│7│C3│
├─┼─┼──┤
│ │2│H6│
├─┼─┼──┤
│0│ │C6│
├─┼─┼──┤
│2│0│S2│
└─┴─┴──┘
 
Ven
This would all be much simpler if I had figured a way to generate combinations.
 
12:05 PM
@Ven Have you looked at cmat?
 
Ven
I need to figure out how to use those from TryAPL
 
@Ven cmat isn't allowed on TryAPL.
 
Ven
(yes, yes, I really ought to install Dyalog on this computer, but TryAPL is just too convenient)
At the same, I wouldn't have interested as many people in APL without it. It is a great resource.
 
Ah I see what the issue is. It sets ⎕ML.
 
Ven
Roger's version is.
is Roger's cmat←{⊖⊃⍪/{k,¨⍪\1+⍵}⍣⍺⊢(⊂⍉⍪⍬),d⍴⊂0 0⍴k←⌽⍳1+d←⍵-⍺} not good?
 
12:17 PM
@Ven Sure. Or use John Niss Hansen's golfed version.
 
Ven
38
Q: Professor at MIT can read minds!

Stewie GriffinThe task is taken from an MIT lecture by Prof. Devadas called You can read minds. A detailed explanation of the trick can be found in the linked video, or in this document. I'll try to explain it in simpler terms. It turns out this was invented in the 1930's, and is known as the "Five-Card Trick...

The challenge is there. I can either replicate the JS solution, but that means lexographic ordering, plus to generate similar 'idx,card' string I'd need to 1) find the index 2) format to string 3) pad with '0' 4) concat with original card
Otherwise I could also find the index, ×9 (or some factor), add the index of the card's color (0 to 3), and compare those...
 
@Ven What is the problem with lexicographical ordering, now we have TAO?
 
Ven
Just >/⍋ being 3 characters
 
@Ven I have not looked a the problem, but do you need to analyse the existing order, or is sorting enough?
 
Ven
I need to calculate (d<c) binaryor (2× (d<b) + (c < b))
thought I guess I can actually use + instead of binaryor.
 
12:30 PM
@Ven 2 ⊥ ((d<b) + (c < b)) (d<c)
 
Ven
ah?
 
@Ven Binary bits → decimal nuumber
 
Ven
I don't understand how that replaces the "2 times" is all
Ah, it's just ((d<b) + c<b)<< 1 + (d < c)
 
@Ven 1011₂ is 1×2³+0×2²+1+2¹+1×2⁰
 
Ven
Yeah, I get it
 
ngn
12:47 PM
@Ven ⊃⍋ is 2
(with ⎕io←0)
 
@Ven f and g are completely different.
 
Ven
@Adám Is there an Extended idiom for ⊢f⊢? (thanks!)
Reading code using * after doing APL for a bit feels... dirty to say the least, let alone the rest :)
 
ngn
1:15 PM
@Ven is that for encoding the permutation? (SML->1,SLM->2,MSL->3,MLS->4,LSM->5,LMS->6)
 
Ven
@ngn Yes.
 
ngn
@Ven ¯1+⌊.7×2⊥⍋a (⎕io←0)
 
Ven
where a is the 3 indices?
 
ngn
or values
 
Ven
⎕←¯1+⌊.7×2⊥⍋('S6' 'H3' 'H9')
 
1:21 PM
@Ven
9
 
Ven
Guess I do need to generate the indices
 
ngn
@Ven but the lexicographic order of those strings is not the same as their order as ranks/suits
 
Ven
⎕←¯1+⌊.7×2⊥⍋(,⍉'CDHS'∘.,v←'A','TJQK',⍨2↓⎕D)⍳'S6' 'H3' 'H9'
 
@Ven
8
 
Ven
3 with io=0, which seems correct.
 
ngn
1:24 PM
@Ven the part that generates the ranks is longer than a literal '23456789TJQKA' :)
or 'A23456789TJQK', whatever...
 
Ven
@ngn Or 'A',2↓⎕D,'TJQK' :P.
(which is the same size)
if I consider A to be at the end, though, 2↓⎕D,'TJQKA' is shorter
@ngn I need an explanation as to how your figure this sort of things out, tho...
 
ngn
@Ven i wrote down all permutations of 0 1 2 and the expected results. i tried a few silly things and i noticed that 2⊥ gives almost consecutive numbers: 4 5 6 8 9 10, so i tried to squeeze that range
i tried floor-multiplying by 0.9, 0.8, and at 0.7 i noticed that it's all consecutive integers
@Ven the challenge says: "There are 13 ranks, 2,3,4,5,6,7,8,9,10,J,Q,K,A", so you must put it at the end
 
Ven
> You may choose if the ace should be the highest or lowest card, as long as it's consistent.
 
ngn
@Ven ah, you're right
 
Dyalog invite you to join our live webinar, Introducing the 2019 APL Problem Solving Competition, on Thursday 25 April at 15:00 UTC (San Francisco 8am/New York 11am/London 4pm/Copenhagen 5pm/Bangalore 8:30pm). https://dyalog.tv/Webinar #DyalogAPL
 
Ven
1:45 PM
Ah, nice! Maybe not this year, but hopefully by next year I'll understand enough APL to compete.
I'll try posting my answer to that challenge soon-ish, though if you want to post it, feel free to. I can basically discard all the rest of my code
 
ngn
@Ven i like golfing. not so much posting and explaining :)
@Ven i have a 52 byte solution, let's see how far you can go
 
 
1 hour later…
3:01 PM
@Ven Assuming in a dyadic train (because otherwise it is simply f⍨) you could write f⍨⍤⊢ which is 1 character shorter than (⊢f⊢)
 
Ven
Ah, nice!
 
 
1 hour later…
4:13 PM
@dzaima My idea for a keyboard is to have a sparse looking display of just 5 rows of 6 buttons each, except the last button in the last three rows is double width:
|  ∧  ⍳  ⍴  ←  ⋄
+  ≡  ↑  /  ∘  ⍕
¯  7  8  9   ⌫⌦
.  4  5  6   ←→
0  1  2  3   ⏎
The top two rows have can be tapped to get that symbol, or pulled upwards which reveals a vertical list of related symbols. First row is:
!     …  ⊖  ⋄  ;
?  ⊢  ~  ⍉  ∇  …]
⊤  ⊣  ∩  ⌽  :  []
⊥  ~  ∪  ⍮  ⍹  …}
⌊  ⍱  ⍷  ⍪  ⍶  {}
⌈  ⍲  ∊  ,  ⍵  …)
⍭  ∨  ⍸  ∊  ⍺  ()
|  ∧  ⍳  ⍴  ←  ⋄
Second row is:
⌹     ⍒  ⌶  ⌺  ⍠
○  ≠  ⍋  &  @  ⍞
⍟  >  ⌷  ⌸  ⍡  ⎕
*  ≥  ⊇  ⍨  ⍣  …"
√  =  ⊆  ¨  ⍫  ""
÷  ≤  ⊃  ⍀  ⍢  …'
×  <  ⊂  ⌿  ⍥  ''
-  ≢  ↓  \  ⍤  ⍎
+  ≡  ↑  /  ∘  ⍕
The four leftmost buttons in the next two rows work the same, but the rightmost double-width button needs to be pulled in one of the cardinal directions, as on your keyboard. The third row's multi-key is ↑back ↓fwd ←bksp →del:
J  X  Y  Z   ↶
j  x  y  z  ⌫ ⌦
¯  7  8  9   ↷
The fourth row's multi-key is cursor movement:
E  P  Q  R   ↑
e  p  q  r  ← →
.  4  5  6   ↓
The fifth row also has four pull-up keys, but the big key is Enter:
⍝  A  B  C
⍬  a  b  c   ⏎
0  1  2  3
 
Ven
4:38 PM
You must have a corpus of APL programs, go count which ones are most used :P.
 
4:53 PM
@Ven It isn't ordered by frequency, but rather by subject: Top row is numerics, logic, shape, function, structs. Second row is arithmetic, comparison, selection, monadic-operators, dyadic-operators, data. ¯ and j are paired as they extend the natural numbers. . and e are paired as they scale numbers. 0⍬⍝ are all a form of nulling.
 
Ven
I understand it's by subject, I suggest you still look into frequency
 
@Ven The corpus depends heavily on code subject. See dfns workspace on that.
 
Ven
Interesting read, thanks.
 
ngn
5:29 PM
@Ven shall i reveal my 52 bytes?
 
I like the musing by the author saying it's easier to type with a QWERTY layout compared to an ABCDEF layout. I loathe each and everything that comes with an ABCDEF layout by default for typing.
 
Ven
@ngn I won't be able to do it today, that's for sure. It's almost 8pm and I'm still at work :)
@J.Sallé try AZERTY :D
 
@Ven probably still much much better than ABCDEF
 
ngn
@Ven ah, ok. i'll wait till tomorrow then :)
@Ven haha! another byte gone: ¯1+⌊.7×2⊥ -> ¯2+⌊1.8⊥
 
6:24 PM
@Adám ah, that's a good idea taking the extended pullable set to the max. Where'd the 1st two row extensions get drawn though - drawing them all for every key above would make them extend way over the keyboard space, obstructing text view. current system doesn't allow for generic pull mappings other than the orthogonal directions but adding that has been on my mind - there'd be a lot of space for user-added shortcuts for project-specific things (e.g. (+/÷≢), G.rect, etc.)
in my layout clicking "A" opens my abcdef-ish layout
 
@dzaima Eh, one should be able to switch-to/invoke the device keyboard.
@dzaima Good point. Maybe the two top rows should instead be at the bottom.
 
@Adám that's also definitely a thing I have wanted to add
my goal with my APL layout was to minimize the amount of swiping required, yours would have some pretty long swipes
the swipe detection in mine isn't exactly invoked by the cursor being over a neighboring character, but rather a specific distance away from the center as to allow off-centered taps to only care about swipe size to tell whether something special has to happen as IMO that's way easier to control than a specific position
 
@dzaima True, but it would have a look-and-feel much closer to a normal calculator.
@dzaima I'm sure your layout would allow much faster typing than mine, once one has learned it. Yes, precision on mine would be a problem, and it requires visual feedback of the currently held character. Your's allows "blind" typing.
 
@Adám really my goal isn't to adhere to some already existing design or specific (it's just a probable bonus), but to be efficient
 
6:39 PM
@dzaima One thing I do think you should adapt from my layout is a single button which is swiped to move the cursor in the four directions, instead of two adjacent key presses for left and right but two swipes on the same key for up and down. Tapping the direction key should insert a space.
 
@Adám reason for me not combining the direction keys is that the left/right moves would definitely be used by being held for faster travel and using a swipe to do that feels weird (it's what currently happens to the vertical movement however), though that's personal opinion, so subject to change
 
@dzaima Is it strange to swipe and hold? That's how the pointing stick on a laptop works.
 
@Adám I don't have a pointing stick nor a laptop, but that's a good point
@Adám since you're the one here with lots of APL code, do you have statistics on character usage? I'd be interested in where the numbers actually are in the usage frequency to decide whether they're worthy top-level spots
oh right, dfns exists, i could just scrape that
 
2 hours ago, by Adám
@Ven The corpus depends heavily on code subject. See dfns workspace on that.
 
@Adám oh :| doesn't include numbers however
 
6:50 PM
@dzaima What do you mean? It does about 1÷3 down
 
@Adám should've said digits - there's no statistics about digit usage
really the usage of digits probably depends a lot on the domain/project. having some layout of top-level digits is probably smart anyway
 
@dzaima I think there was a discussion about this in TNB. Found it: Here and onwards.
 
beyond 0/1 (any maybe 2) I don't think writing code would need random access to digits, mostly used for hardcoded data, for which switching a layout would be allowable
@Adám that again doesn't relate to the frequency of APL chars, but i realize now that they probably wouldn't relate much
7 being 100× less used than 1 does seem to say something though
 
7:07 PM
@dzaima Without comments and strings:
1 6.11748%
3 4.27327%
2 3.52627%
⍵ 3.51505%
9 3.20970%
7 3.16225%
← 3.12775%
0 3.10273%
s 2.98974%
4 2.59294%
e 2.49720%
t 2.40662%
⍺ 2.29363%
5 2.11421%
) 2.08402%
( 2.08229%
6 2.02536%
r 1.97015%
a 1.96843%
8 1.95377%
n 1.74847%
p 1.66997%
{ 1.58285%
o 1.57681%
} 1.57681%
' 1.53110%
c 1.40430%
d 1.40171%
, 1.38446%
i 1.36979%
l 1.36548%
m 1.28612%
: 1.13862%
f 0.83326%
/ 0.77461%
u 0.76167%
b 0.75390%
⎕ 0.73406%
¨ 0.73234%
⍴ 0.69783%
k 0.64090%
h 0.62279%
x 0.60985%
↑ 0.57190%
= 0.56586%
v 0.56155%
 
@Adám woah, 6% is 1? :D
 
@dzaima Yeah, and all 10 digits within the 20 most common characters. I'd say "the numpad" merits easy access.
Ah, hold on, pco probably skews the result quite a bit. Let me take that one out.
@dzaima Yes, as suspected, same thing but without pco:
⍵ 4.86555%
← 4.34333%
s 4.15586%
e 3.46444%
t 3.34636%
⍺ 3.21976%
) 2.90204%
( 2.89961%
a 2.74379%
r 2.72432%
n 2.39686%
p 2.28487%
{ 2.20575%
o 2.20453%
} 2.19723%
1 2.14975%
' 2.14367%
d 1.96837%
c 1.96472%
, 1.93916%
l 1.92333%
i 1.91360%
m 1.79187%
0 1.63849%
: 1.55814%
f 1.15887%
u 1.07366%
/ 1.07244%
b 1.04079%
⎕ 1.02984%
¨ 1.02375%
⍴ 0.96167%
k 0.89228%
h 0.87889%
x 0.85454%
↑ 0.80585%
2 0.78394%
v 0.78272%
⊃ 0.77055%
= 0.76568%
↓ 0.74134%
+ 0.70969%
≡ 0.69021%
⊂ 0.68047%
g 0.66708%
. 0.53805%
 
so really and should be at the top, not { and }. also {}?
oh, all 4 should be top-level really
 
@dzaima Hm, it doesn't make sense that {} and () and [] are not exactly matched.
 
5.5% total for numbers, hmm
 
7:22 PM
Here's the formula I used (I should have let the bot do this…): {(⊂⍒n)⌷'%',⍨(⊣/⍵),5⍕⍪100×n÷+/n←⊢/⍵},∘≢⌸' '~⍨∊('''[^'']''' '⍝.*$'⎕R''⎕NR)¨(⎕NL-3 4)~⊂'pco'⊣⎕CY'dfns'
 
the top 14…24 chars take 6.7%, a bit more than numbers. seems my best bet is to make 3 layouts - one without top-level numbers, one with, and one specifically for data hardcoding..
at least now I have actual statistics to design by
 
@dzaima Nope, not yet. Can you spot my mistake?
 
@Adám [^''][^'']*?
 
@dzaima Yes.
 
we just had a cmc here about ignoring strings and comments :p
took me way too long to do ]help ⎕NR to realize that it isn't part of the operand to ⎕R :|
 
7:37 PM
⎕←{(⊂⍒n)⌷'%',⍨(⊣/⍵),5⍕⍪100×n÷+/n←⊢/⍵},∘≢⌸' '~⍨∊('''[^'']*''' '⍝.*$'⎕R''⎕NR)¨(⎕NL-3 4)~⊂'pco'⊣⎕CY'dfns'
 
@Adám
⍵ 5.26282%
← 4.69697%
s 4.25485%
e 3.51628%
t 3.50726%
⍺ 3.36676%
( 3.12057%
) 3.12057%
r 2.77384%
a 2.74677%
n 2.41809%
{ 2.40391%
} 2.40391%
p 2.30208%
1 2.27372%
, 2.18865%
o 2.18607%
c 1.97726%
d 1.96308%
l 1.95664%
i 1.91024%
m 1.87544%
0 1.68338%
: 1.60604%
f 1.20904%
/ 1.12397%
¨ 1.11624%
b 1.06210%
u 1.05695%
⍴ 1.02214%
⎕ 0.96801%
k 0.95641%
h 0.93450%
x 0.93321%
↑ 0.86876%
⊃ 0.82236%
2 0.80173%
↓ 0.80044%
⊂ 0.77853%
v 0.77466%
+ 0.73728%
≡ 0.72697%
= 0.70635%
g 0.69088%
∇ 0.53492%
 
so now 1.7% numbers, 3.8% 14…24s, and all brackets match!
 
8:15 PM
so top 20 non-numbers are ⍵←⍺(){},:/¨⍴↑⊃↓⊂+≡=∇. now to logically group those along with the rest and sort that into an intuitivish layout..
 

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