« first day (984 days earlier)      last day (1671 days later) » 

3:09 AM
Looking for a short way to trim zeros from both sides of a boolean list in J. So far the best I've got is to hack binary conversion by defining g=.]&.#. and then doing g&.|.@g: Try it online!. Any better ideas?
 
@Jonah #~+./\*+./\&.|.
 
 
2 hours later…
4:47 AM
@Adám ty, nice idea. Looks like #~+./\*+./\. works as well.
 
 
3 hours later…
8:04 AM
@Jonah Yes of course, I forgot suffix existed. \. is the same as \&.|.
 
8:40 AM
I'm working on generating partitions again and none of the following each operators is getting me what I want
⎕←{⍵=1:1 ⋄ {⎕←'a',¨⍵ ⋄ {⎕←'b',¨⍵ ⋄ (2>≢⍵)∨⎕←≠/⎕←2↑⍵:(⊂⍵+1↑⍨≢⍵),⊂1,⍵ ⋄ ⊂1,⍵}¨⍵}¨∇ ⍵-1}4
 
@Sherlock9
┌───┐
│a 1│
└───┘
┌───┐
│b 1│
└───┘
1 0
1
┌─────────┐
│┌─┬─┬───┐│
││a│2│1 1││
│└─┴─┴───┘│
└─────────┘
┌───┬─────┐
│b 2│b 1 1│
└───┴─────┘
┌─┬───┐
│2│1 1│
└─┴───┘
┌───┐
│1 1│
└───┘
DOMAIN ERROR
 
Also for some reason the boxing isn't working for the intermediate steps in RIDE
At any rate, I'm stumped
 
@Sherlock9 ]box -f=on
 
Thank you very much
 
@Sherlock9 What exactly do you mean by generating partitions?
 
8:45 AM
I'm trying to generate the partitions into distinct parts of n
For 5, that would be 5,(4 1),(3 2),(3 1 1),(2 2 1),(2 1 1 1),(1 1 1 1 1) in some order
This almost works
⎕←{⍵=1:1 ⋄ {⎕←'a',¨⍵ ⋄ (2>≢⊃⍵)∨⎕←≠/⎕←2↑⊃⍵:(⊂(⊃⍵)+1↑⍨≢⊃⍵),⊂1,⊃⍵ ⋄ ⊂1,⊃⍵}¨⎕←∇⍵-1}4
 
@Sherlock9
1
┌───┐
│a 1│
└───┘
1 0
1
┌───────┐
│┌─┬───┐│
││2│1 1││
│└─┴───┘│
└───────┘
┌───┬─────┐
│a 2│a 1 1│
└───┴─────┘
2 0
1
┌───────┐
│┌─┬───┐│
││3│1 2││
│└─┴───┘│
└───────┘
┌───┬─────┐
│a 3│a 1 2│
└───┴─────┘
3 0
1
┌───────┐
│┌─┬───┐│
││4│1 3││
│└─┴───┘│
└───────┘
 
I was trying to use this algorithm
Wait no wrong one
Would you happen to know how to turn (⊂3,⊂1 2),⊂⊂1 1 1 into 3,(⊂1 2),(⊂1 1 1)?
⎕←(⊂3,⊂1 2),⊂⊂1 1 1⋄⎕←3,(⊂1 2),(⊂1 1 1)
 
9:00 AM
@Sherlock9
┌───────┬───────┐
│┌─┬───┐│┌─────┐│
││3│1 2│││1 1 1││
│└─┴───┘│└─────┘│
└───────┴───────┘
┌─┬───┬─────┐
│3│1 2│1 1 1│
└─┴───┴─────┘
 
Oh ⊃,/
⎕←{⍵=1:1 ⋄ ⊃,/{(2>≢⍵)∨</2↑⍵:(⊂⍵+1↑⍨≢⍵),⊂1,⍵ ⋄ ⊂1,⍵}¨∇⍵-1}7
 
@Sherlock9
┌─┬───┬───┬─────┬───┬─────┬───────┬─────┬─────┬───────┬─────────┬───────┬─────────┬───────────┬─────────────┐
│7│1 6│2 5│1 1 5│3 4│1 2 4│1 1 1 4│1 3 3│2 2 3│1 1 2 3│1 1 1 1 3│1 2 2 2│1 1 1 2 2│1 1 1 1 1 2│1 1 1 1 1 1 1│
└─┴───┴───┴─────┴───┴─────┴───────┴─────┴─────┴───────┴─────────┴───────┴─────────┴───────────┴─────────────┘
 
IT WORKS!
 
@Sherlock9 It looks like the inner dfn can be shortened/simplified as it has the duplicate code ⊂1,⍵. Just make the concatenation conditional.
 
@Adám I wasn't sure how to make the ({conditional:thing ⋄ return nothing}⍵),1,¨⍵ work as just returning nothing led to VALUE ERRORs
 
9:07 AM
@Sherlock9 extra,⍣(condition)⊢default
 
Oh, huh
 
@Sherlock9 Actually, since you're conditionally concatenating, you should be able to do (condition/extra),default too.
 
⎕←{⍵=1:1 ⋄ ⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇ ⍵-1}7
 
@Sherlock9
┌─┬───┬───┬─────┬───┬─────┬───────┬─────┬─────┬───────┬─────────┬───────┬─────────┬───────────┬─────────────┐
│7│1 6│2 5│1 1 5│3 4│1 2 4│1 1 1 4│1 3 3│2 2 3│1 1 2 3│1 1 1 1 3│1 2 2 2│1 1 1 2 2│1 1 1 1 1 2│1 1 1 1 1 1 1│
└─┴───┴───┴─────┴───┴─────┴───────┴─────┴─────┴───────┴─────────┴───────┴─────────┴───────────┴─────────────┘
 
It occurs to me that that's a lotta parens
 
9:11 AM
@Sherlock9 Me too. If it wasn't code golf, I'd name some things…
 
@Adám Ooh, actually, that's a good segue into a question I had. How would you write something like this in a non-code golf environment?
Maybe not production, but more verbose
 
@Sherlock9 Me personally?
 Partition←{
     ⍵=1:1
     Extend←{
         more←(2>≢⍵)∨</2↑⍵
         extra←more/⊂⍵+1↑⍨≢⍵
         extra,⊂1,⍵
     }
     ⊃,/Extend¨∇ ⍵-1
 }
 
simple and clean
 
@Sherlock9 ? Oh as a face. Get it.
 
@Adám Yep!
 
9:20 AM
@Sherlock9 I'd probably want to put some comments. On the first line, what it does and how to call it. Then on the Extend←{ line what that does, and on its lines why those steps, and then maybe a comment on the ⊃,/ line about the method.
 
@Adám Ah comments. I'd nearly forgotten them all XD
I realize there's only so much you can do with functions which grow exponentially, but do you see any parts where the speed of the function could be improved?
I seem to remember a conversation here about ¨ not being very optimizable (something about branch prediction IIRC?), but I'm not sure there's anything that can be done there
 
@Sherlock9 ¨ cannot run in parallel, as the order is guaranteed.
 
Ahh. No help for my code then :( Thanks for the help and explanation!
 
Well, with ∥¨ you'd use all your computers available processors/threads…
 
9:46 AM
@Adám ∥¨?
 
@Sherlock9 Just like ¨, but runs each call in true hardware parallel, hence it is read as parallel each. Unfortunately, we've been way slow in making the glyph work, but meanwhile, you can )copy isolate and then use instead of ∥¨
 
      {⍵=1:1⋄⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}IÏ∇⍵-1}6
┌─┬───┬───┬─────┬───┬─────┬───────┬─────┬───────┬─────────┬─┬───┬───┬─────┬────
│6│1 5│2 4│1 1 4│3 3│1 2 3│1 1 1 3│2 2 2│1 1 2 2│1 1 1 1 2│5│1 4│2 3│1 1 3│1 2
└─┴───┴───┴─────┴───┴─────┴───────┴─────┴───────┴─────────┴─┴───┴───┴─────┴────

      ─┬───────┬─────────┬─┬───┬───┬─────┬─────┬───────┬─────────┐
      2│1 1 1 2│1 1 1 1 1│5│1 4│2 3│1 1 3│1 2 2│1 1 1 2│1 1 1 1 1│
      ─┴───────┴─────────┴─┴───┴───┴─────┴─────┴───────┴─────────┘
Well that's an interesting result
 
@Sherlock9 Hm, that's odd. 5
 
      {⍵=1:1⋄⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}IÏ∇⍵-1}5
┌─┬───┬───┬─────┬─────┬───────┬─┬───┬───┬─────┬───────┬─┬───┬───┬─────┬───────┐
│5│1 4│2 3│1 1 3│1 2 2│1 1 1 2│4│1 3│2 2│1 1 2│1 1 1 1│4│1 3│2 2│1 1 2│1 1 1 1│
└─┴───┴───┴─────┴─────┴───────┴─┴───┴───┴─────┴───────┴─┴───┴───┴─────┴───────┘
 
@Sherlock9 II¨ seems to work fine.
 
9:53 AM
Here's a clue
      {⍵=1:1⋄⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}IÏ∇⍵-1}3
┌─┬───┬─┬───┬─┬───┐
│3│1 2│2│1 1│2│1 1│
└─┴───┴─┴───┴─┴───┘
      {⍵=1:1⋄⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}IÏ∇⍵-1}2
2 1 1
      {⍵=1:1⋄⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}IÏ∇⍵-1}1
1
 
@Sherlock9 Interestingly, the same thing seems to happing if you use green threads (multiple APL-governed threads in a single OS thread):
⎕←{⍵=1:1⋄⊃,/⎕TSYNC{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}&¨∇⍵-1}6
 
@Adám
┌─┬───┬───┬─────┬───┬─────┬───────┬─────┬───────┬─────────┬─┬───┬───┬─────┬─────┬───────┬─────────┬─┬───┬───┬─────┬─────┬───────┬─────────┐
│6│1 5│2 4│1 1 4│3 3│1 2 3│1 1 1 3│2 2 2│1 1 2 2│1 1 1 1 2│5│1 4│2 3│1 1 3│1 2 2│1 1 1 2│1 1 1 1 1│5│1 4│2 3│1 1 3│1 2 2│1 1 1 2│1 1 1 1 1│
└─┴───┴───┴─────┴───┴─────┴───────┴─────┴───────┴─────────┴─┴───┴───┴─────┴─────┴───────┴─────────┴─┴───┴───┴─────┴─────┴───────┴─────────┘
 
ngn
10:10 AM
@Sherlock9 that recursion is in disguise
⎕←{{⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(⍵-1)⊢1}7
 
@ngn
┌─┬───┬───┬─────┬───┬─────┬───────┬─────┬─────┬───────┬─────────┬───────┬─────────┬───────────┬─────────────┐
│7│1 6│2 5│1 1 5│3 4│1 2 4│1 1 1 4│1 3 3│2 2 3│1 1 2 3│1 1 1 1 3│1 2 2 2│1 1 1 2 2│1 1 1 1 1 2│1 1 1 1 1 1 1│
└─┴───┴───┴─────┴───┴─────┴───────┴─────┴─────┴───────┴─────────┴───────┴─────────┴───────────┴─────────────┘
 
@ngn Oh nice!
Unfortunately, I think that's a byte longer
 
ngn
@Sherlock9 a full program is a byte shorter: {⊃,/{(((2>≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(⎕-1)⊢1
 
It is faster
      ]runtime -c {⍵≤1:1⋄⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇⍵-1}7 {{⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(⍵-1)⊢1}7

  {⍵≤1:1⋄⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇⍵-1}7  → 5.9E¯5 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {{⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(⍵-1)⊢1}7 → 5.5E¯5 | -7% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
And gives different result?
 
10:16 AM
Sorry I messed that up
I thought would work. It was a non-starter
 
ngn
btw, the solution i had in mind before was: ¯1↓¨{×⍺:⊃,/i,¨¨i∇¨⍵-i←⍳1+⍺⌊⍵⋄⍵↓⊂⍬}⍨ (⎕io←0)
 
@ngn Huh. I don't understand this at all XD
 
ngn
@Sherlock9 ⍺ is a restriction for the max element in generated partitions. ⍵ is the sum.
i is (a vector of) how much we take away from ⍵ before calling recursively
⍵↓⊂⍬ is the base case: an empty list if ⍺=0 and ⍵≠0, and ,⊂⍬ if ⍺=0 and ⍵=0
 
@Sherlock9 I've sent an internal email to ask what's going on. I managed to cut it down to a minimal repro.
 
10:32 AM
@Adám Good luck! Hopefully the glyph makes it out of this safe and sound :D
]runtime -c {⍵≤1:1⋄⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇⍵-1}7 {{⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(7-1)⊢1}
 
@Sherlock9
* Command Execution Failed: SYNTAX ERROR
 
@Sherlock9 You're missing a trailing 7
 
I was trying to put it in where ⎕ would be in (⎕-1). Ergo, what I really forgot is to remove the outside curly brackets
]runtime -c {⍵≤1:1⋄⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇⍵-1}7 {⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(7-1)⊢1
 
@Sherlock9

  {⍵≤1:1⋄⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇⍵-1}7 → 7.2E¯5 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨⍵}⍣(7-1)⊢1   → 7.0E¯5 | -3% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
They seem to run at the exact same speed for all arguments.
 
10:36 AM
]runtime -c {⍵≤1:1⋄⊃,/{(((1≥≢⍵)∨</2↑⍵)/⊂⍵+1↑⍨≢⍵),⊂1,⍵}¨∇⍵-1}7 ⎕io←0⋄¯1↓¨{×⍺:⊃,/i,¨¨i∇¨⍵-i←⍳1+⍺⌊⍵⋄⍵↓⊂⍬}⍨7
 
@Sherlock9
* Command Execution Failed: LENGTH ERROR
 
And by my count, ngn's version, while much shorter, takes longer
@ngn Ah, so once we have all the results of i∇¨⍵-i, we append i to everything, flatten, and return?
 
ngn
@Sherlock9 exactly
 
ngn
11:07 AM
@Sherlock9 it evaluates more than once for certain pairs of ⍺⍵. i was aiming only for code size.
 
 
1 hour later…
ngn
12:30 PM
youtube be like "psst, can i interest you in videos about systems of quadratic equations?" :D
because of this
 
 
2 hours later…
2:25 PM
0
Q: Idiomatic way to select from a matrix based on value

codesectionsThe following employee matrix of names and email addresses makes it visually clear that bob's email address is bob@example.com. ┌───────┬─────────────────────┐ │alice │alice@example.com │ ├───────┼─────────────────────┤ │bob │bob@example.com │ ├───────┼─────────────────────┤ │charli...

 
 
4 hours later…
6:18 PM
> APL looks like it should be stabbed with the latin alphabet until it learns its lesson
^ Quote from a friend as I am explaining APL and the partition generator we made today
 
@Sherlock9 Response:
> Have you ever mistakenly used a reserved word while programming?
> What would you rather a²+b²+2(a+b) or plus(square(a),plus(square(b),times(2,plus(a,b))) ?
 
I have pasted them both into chat. I believe their main base of programming knowledge is Python, however
> Not mistakenly, as far as i know
but we did find out by trying to break stuff (we were ordered to play around with the code, so we did) that you can redefine predefined functions
Eh, I won't overquote them
 
:-)
 
> Me:
Also from APLer friend
> What would you rather a²+b²+2(a+b) or plus(square(a),plus(square(b),times(2,plus(a,b))) ?
In short, the symbols are nice and easy to get used to
The array-based part of array-based programming on the other hand
that's a little tough

Them:
but see, there are perfectly fine conventions for this, using ascii:
a^2+b^2+2(a+b)
 
Sure, now make me an N-by-N multiplication table!
 
6:29 PM
ooh hang on, what's the best way to do this
 
∘.×⍨⍳
 
⎕←∘.×⍨⍳10
 
@Sherlock9
 1  2  3  4  5  6  7  8  9  10
 2  4  6  8 10 12 14 16 18  20
 3  6  9 12 15 18 21 24 27  30
 4  8 12 16 20 24 28 32 36  40
 5 10 15 20 25 30 35 40 45  50
 6 12 18 24 30 36 42 48 54  60
 7 14 21 28 35 42 49 56 63  70
 8 16 24 32 40 48 56 64 72  80
 9 18 27 36 45 54 63 72 81  90
10 20 30 40 50 60 70 80 90 100
 
Ahh I was about to just do the multiply
> Them: yeah, that would require a bunch of for loops i guess
but well, that is the tradeoff for other people also understanding my code
Me: Again, it's not that hard to get used to the symbols
 
@Sherlock9 Give them Dijkstra's Challenge:
21
Q: Dijkstra's Challenge

AdámPresented in honor of APL as an interactive tool turning 50 this year Background Ken [Iverson] presented his paper Formalism in Programming Languages in August 1963 at a Working Conference on Mechanical Language Structures, Princeton, N.J. The list of conferees is full of famous and soon-to-...

> given a matrix M with elements aᵢⱼ return the sum of each aᵢⱼ where aᵢⱼ = i + j.
 
6:36 PM
> it seems nifty for things that only have numbers, but sadly that is not what i typically work with
 
@Sherlock9 Given a string A, e.g. mississippi and a string B, e.g. ps, give me the indices into A where there is a letter which occurs in B, i.e. [2,3,5,6,8,9]
APL solution: ⍸∊
 
You're kidding XD
 
I'm not:
⍞←'mississippi'(⍸∊)'sp'
 
@Adám 3 4 6 7 9 10
 
⎕IO←1 here, I adjusted it to 0 for Python's sake.
Give me the running parenthesis nesting level of my string: plus(square(a),plus(square(b),times(2,plus(a,b)))
 
6:44 PM
> Me: It works for any array-based thing (which is darn near everything)

Them:
> which is darn near everything
Last week I built something that required doubly linked lists and random pointers
it was a weird algorithms for graph stuff where we had a number of given assumptions
 
+\'('∘=-')'∘=
@Sherlock9 APL has no issue with (infinitely) linked lists, and pointers. Various manipulations of such trees are themselves short one-liners. Search YouTube for "hsu apl graphs"
 
FnConf17?
 
@Sherlock9 Any of his presentations really. This is his expertise.
@Sherlock9 Speaking of which, given an adjacency matrix M, give me the transitive closure. E.g. [[1,0,0,1,0],[1,1,0,0,1],[1,1,0,0,0],[0,0,0,0,0],[0,0,0,1,0]][[1,0,0,1,0],[1,1,0,1,1],[1,1,0,1,1],[0,0,0,0,0],[0,0,0,1,0]]
In APL: (∨.∧⍨∨⊢)⍣≡
 
> Me: *repeats your words about APL, linked lists, pointers, and trees
Them: well, then i think you can do anything. Is it proved to be turingcomplete?
XD I hope so
Or I could try to implement a Brainfuck interpreter in APL
 
@Sherlock9 Heheh, it is A Programming Language :-D A .NET language (if you want), multi-paradigm (functional/imperative, array-oriented/OO, explicit/point-free,…) cross-platform…
 
6:58 PM
Wait that's already in dfns
 
@Sherlock9 Exactly.
 
Me:
Well I can pretty easily write a Brainfuck interpreter in APL, I think, which is itself Turing complete, so yep!
This is used in production, which is why I'm willing to go to bat for it

Them:
well, then it is just preference

Me:
If it were just one of the many esoteric languages I knew, then I'd have called it a day a little earlier :joy:
 
@Sherlock9 More linked list fun: Sort the numbers in the list L=[4,4,0,[2,[[4]],[0,2]],5,[6,1],[[5]],1] i.e. → [0,0,1,[1,[[2]],[2,4]],4,[4,5],[[5]],6]
Even if they can do it, ask them to do it in-place!
APL: (∊L)←(⍋⊃¨⊂)∊L Extended APL: (∊L)←∧∊L
@Sherlock9 Volvo Penta (makers of trucks, busses, and maritime engines) plans their production in APL. The European commission does its statistics in APL. The Swedish health care system keeps its patient journals in APL… Yeah, I think it is a programming language alright.
 
Hahaha I think my friend still in university (This is an online acquaintance on a Discord server I moderate) and I'd rather not scare him too hard XD
Especially since he ended with
> well, then it is just preference
 
@Sherlock9 Yes, choose to get less done or more done in the given time. Also, choose whether to have fun while doing it :-)
 
7:10 PM
Besides which, I should get some sleep
Goodnight and thanks, Adám :D
 
@Sherlock9 NP. For next time, this one is fun to show, if people think you can't do serious stuff in APL (running on a single laptop). Thank you for spreading the message!
 
7:27 PM
NP! It occurs to me that I was describing some fun APL programs but I never actually got around to explaining what APL is. Something for next time :D
 
Be aware that CS people are notoriously hard to convince about APL. It seems that the CS studies closes their minds. \○/
 
@Adám well, apl does suffer in performance on any non-vectorizable task
 
@dzaima That's never their count argument, though.
 
@Adám the design choices that have lead to that are though
yeah, ]runtime doesn't like this
 
@dzaima I have a feeling that co-dfns can optimise that.
 
7:33 PM
CS people like being able to control how exactly stuff works, and APL very directly opposes that, hiding all implementation and special-case optimizing only some combinations of builtins
 
Parting words XD
 
:-)
 
Ack deleted instead of editing
> Friend 2: It's a p̪ɽɔɠʁʌɱɱɨɳɡ ɭɐɳɢʋɒ̈ɡ̤ɜ with completely normal characters
Friend 1: *Runs away screaming*
 
ngn
7:47 PM
@Adám elaborate?
 
@ngn as a person who likes beautiful algorithms & low-level performance optimization, I agree
 
@ngn Just my experience (and that of others too; Aaron Hsu, for instance). Introducing APL to scientists, laymen, children,… very easy. CS people have some kind of block. The more well-versed in traditional programming languages, the harder it is for them to "get it".
 
ngn
@dzaima with adam's message or with my questioning it?
 
@ngn i agree that it's hard to convince me to use APL outside of ±recreational purposes
 
ngn
both of you are right :)
 
ngn
8:46 PM
@Adám "some kind of block" - or probably the unmet expectations for language mechanisms that evolved in lisp and others after apl was created. for instance, as a sort-of cs person, i find it hard to accept apl's lack of 1st class fns and the bad design of dictionaries in dyalog.
on the other hand, lack of array capabilities elsewhere keeps pushing me towards apl&family.
@dzaima is it because of something in the language itself, or due to external factors like obscurity, absence of good enough f/oss impls, integration with other languages (except C#), lack of jobs?
 
@ngn mainly because either i often need sets/maps or want to create one custom class that'd be pretty annoying to otherwise use in APL
e.g. currently i'm trying to implement toi efficiently in Java as per this about this and i don't think there'd be a pretty way to do it in APL
my idea would be to have a global list of all possible sets, represented as lists of pointers in that same list, but that's pretty much reimplementing pointer-based memory, just with the added factor of difficulty to use
 
ngn
@dzaima why not use vectors for sets and keep them sorted?
(i haven't read the toi spec carefully, i'm trying to read it now)
 
9:03 PM
@ngn the syntax is pretty horrible, but basic problem is this
if you want performance, you pretty much have to deduplicate sets at all costs
i have no idea how much would that help in general, but for basic things it changes things drastically. anyways gtg
 
)about
 
@BrianBecker You can evaluate a single line of APL by typing it into chat prefixed by ⍞←. Use ⎕← instead for boxed display and multi-line results and use ⋄ instead to silence the first statement. Use ] to call user commands, including ]help ⍣ for help on a glyph etc. Do not use markdown, but fixed-width (4 initial spaces) is fine. Commands: )lb for language bar, )docs for full documentation, )ref for PDF reference card, )idioms for idiom list.
 
ngn
@dzaima the wsfull is while trying to render the result as a char matrix (a pretty large one), not while computing a←⍬ ⋄ {a,←⊂a}¨⍳100
which is the same as a←{⍵,⊂⍵}⍣100⊢⍬ by the way
 
9:35 PM
@ngn hm, i guess that was a bad example. this though
 
ngn
@dzaima that does look like something dyalog should pay attention to
 
@ngn i don't think that's optimizable without being able to store the data in a completely different format (ignoring the fact that ≢¨ being unique is enough for to not do anything, as that's just a consequence of how the data was created)
 
ngn
the elements of that vector (a) are all of different sizes, so i'd expect of the vector to be computed instantly
for comparison, ngn/k:
 \t ?100{x,,x}/!0
0
 
@ngn yeah, true, but that doesn't help in this case as ≢¨ can be all the same
 
ngn
@dzaima right
 
9:48 PM
right, this is still on my todo list
 
ngn
@dzaima good old java's equals and hashCode? :) there's a trade-off between reserving room in the header for a hash code and performance in those cases when it's not needed
there's also the complexity of dealing with in-place updates that invalidate the hash code
 
@ngn oh right, i don't store the hash so it wouldn't help anyway (though i have thought about storing it)
actaully that makes hashing pointless hmm
@ngn i don't have in-place updates :p
 
ngn
@dzaima you don't even have refcounting, java does the memory management for you, and java is great at managing memory (at least sun/oracle's vm), but not for array oriented languages :)
 
@dzaima oh i do store hashes? huh
 
ngn
@dzaima dzaima of the past surprises dzaima of the present :)
 
10:03 PM
oh i'm using a stored hash of 0 as indication of needing to calculate the hash, so the storing wouldn't help anyway :D (though i should make it never set hash to 0)
 
ngn
computing a hash would take traversing the whole content of an array though
comparing just the lengths (tallies or maybe shapes) should be much cheaper, at least in the case we were considering above where all lengths are different
on the other hand if you have vectors that, for example, are of the same length and differ only in their last element, hashes would surely help
so it's a trade-off, depends on what's expected to be the more common case in practice
 
@ngn (which ties back to the CS-people topic, which would definitely want to be able to choose the algorithm themselves)
 
ngn
10:18 PM
@dzaima it depends. in some cases a custom .equals() might help, but "choice fatigue" is also a thing.
for many algorithms you simply can't be bothered with trivial details and you just expect the obvious .equals() from your language
java is bad in that respect, as it doesn't provide default implementations of .hashCode() and .equals() for user classes
i've seen the templated generation of those methods implemented in ide-s (both intellij and eclipse), and as someone put it long ago, "every ide feature is a deficiency of your language" :)
 
@ngn should my apl start requiring writing the color code along each character? :)
 
ngn
wat
 
(aka i disagree with that statement)
 
ngn
that would be "choice fatigue" as most of the time you just want white on black
 
@ngn my android app colors characters based on their type, and as that's a feature of the IDE, it should actually be a part of the language
and i'm not sure how to remove the need for going to the matching bracket in the language..
 
ngn
10:28 PM
if you find it necessary to highlight types in a different color, maybe the language does a poor job of making it clear what's a type and what's a variable name, or maybe it doesn't need static typing at all
@dzaima ok, i give you that one about the matching bracket :)
 
@ngn it's just coloring different classes of characters differently, using data just from the tokenizer
human brain better at finding colorful pattern => ide feature
 
ngn
apl syntax eliminates the need for only about 50% of bracket pairs (unless you love ), compared to lisp, so there's still a need to highlight matching brackets
 
@ngn so yeah, i agree that javas default hashcode & equals are horrible (imo they should just not exist without implementing some interface), but offloading language things to the IDE imo can be a good idea sometimes
 
ngn
10:50 PM
@dzaima good idea sometimes - that's probably right
gtg
 

« first day (984 days earlier)      last day (1671 days later) »