« first day (1494 days earlier)      last day (1143 days later) » 

12:42 AM
CMC: find the fastest way possible of reversing each number in a vector, 1 12 123 1234 2005 12 -> 1 21 321 4321 5002 21
 
ngn
@rak1507 .'|'$:
 
nice, the lack of padding really makes that great there
and the fact ¨s aren't so slow
 
ngn
@rak1507 lack of padding - what do you mean?
 
$ doesn't pad with spaces to become rectangular or anything like 10⊥⍣¯1 does in dyalog
Is there an easy way to time things in ngn/K?
 
ngn
12:58 AM
@rak1507 ah, right, no implicit "mix" (↑). dyalog's ⍕ has that too.
@rak1507 \t or \t:n where n is the number of iterations. it reports total time in milliseconds.
 
great
 
ngn
but this is wasm, so.. :/
 
I want to try translating my APL solution but I imagine it will be much slower
 
ngn
on my humble laptop:
 \t:10000 f x
456
 
Ah, no rotate in K, this will make it awkward
 
ngn
1:01 AM
@rak1507 weren't you asking for reverse (monadic |)?
 
K should have a rotate smh
 
no
 
ngn
20 mins ago, by rak1507
CMC: find the fastest way possible of reversing each number in a vector, 1 12 123 1234 2005 12 -> 1 21 321 4321 5002 21
"reversing"
 
@rak1507 No idea how fast this is but ⌽⍎⌽⍕X
 
<moon-child> (10⊥∘⌽10⊥⍣¯1⊢)¨ is probably faster
 
1:04 AM
@user lol that's quite clever I like it
 
@rak1507 Now that I look at it, using ⍎ probably isn't such a good idea, so that's probably more useful for code golf than anything in real life
 
@DyalogAPL it's not
 
<moon-child> odd, I wonder why?
 
probably because there's a fast implementation of all of those things on arrays whereas your one uses ¨
still, no one's found a 'good' one yet
 
<moon-child> ahh right
 
ngn
1:07 AM
@user that's faster in ngn/k too :)
 f:|.|`k@
 \t:10000 f x
223
 
nice
 
ngn
' is faster than ¨ but nothing is faster than both :)
 
still 10 times slower than my good one (in APL)
{10⊥⌽10⊥⍣¯1⊢⍵}¨ is about 195 times slower (right the first time)
 
Huh, whaddaya know?
 
ngn
@rak1507 wait, what is slower than what?
 
1:10 AM
@ngn {⌽⍎⌽⍕⍵} is roughly 10 times slower than my other implementation
 
Oh ok
 
ngn
ah ok, i thought you were comparing apl vs k
 
oh no, K would definitely win here I reckon
wouldn't be a fair comparison either, wasm vs running natively
 
ngn
not sure about my k :| . is slow
 
ah
 
ngn
1:11 AM
k9 has a dedicated int parser: `i@
so it would probably win against all
 
probably
I'm interested if anyone can come up with a faster APL solution because I feel that my one does too much stuff
 
@rak1507 What's your solution?
 
that would ruin the fun
 
Oh right, the CMC!
 
lol I'll post it in a few minutes probably
 
1:16 AM
Haven't timed it but {m←⌈/l←1+⌊10⍟⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l} seems to work.
 
fails on 0
 
{m←⌈/l←1+⌊10⍟1⌈⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l} then.
 
It seems quite slow, about the same as {10⊥⌽10⊥⍣¯1⊢⍵}¨ on my machine (tested against ?⍨100000)
probably the logs, it can be replaced with interval index and that might be faster
 
It's over 30x faster for me, and about 6x faster than {⌽⍎⌽⍕⍵}.
 
huh, interesting
that's very weird
 
1:28 AM
      n←?⍨100000
      cmpx '{m←⌈/l←1+⌊10⍟1⌈⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l}n' '{10⊥⌽10⊥⍣¯1⊢⍵}¨n' '{⌽⍎⌽⍕⍵}n'
  {m←⌈/l←1+⌊10⍟1⌈⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l}n → 5.4E¯3 |     0% ⎕
  {10⊥⌽10⊥⍣¯1⊢⍵}¨n                         → 1.9E¯1 | +3414% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⌽⍎⌽⍕⍵}n                                 → 3.0E¯2 |  +450% ⎕⎕⎕⎕⎕⎕
 
      a←?⍨100000
      ]runtime -c '{⌽⍎⌽⍕⍵}a' '{m←⌈/l←1+⌊10⍟1⌈⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l}a'

  {⌽⍎⌽⍕⍵}a                                 → 1.0E¯1 |     0% ⎕
  {m←⌈/l←1+⌊10⍟1⌈⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l}a → 3.0E0  | +2869% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
how strange
 
ngn
  {m←⌈/l←1+⌊10⍟1⌈⍵⋄(10⊥⊖(m⍴10)⊤⍵)÷10*m-l}n → 7.4E¯2 |      0%
  {10⊥⌽10⊥⍣¯1⊢⍵}¨n                         → 1.5E1  | +20141% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⌽⍎⌽⍕⍵}n                                 → 2.4E¯1 |   +224% ⎕
 
?!?!?!
do you think it could be windows vs linux?
how does {(10⊥⊖(m⍴10)⊤⍵)÷10*m-⍵⍸⍨0,10*⍳m←1+⌊10⍟⌈/1⌈⍵} compare, it's a lot faster for me
 
It's 30% faster.
 
it's 99% faster for me
this is very strange
do you have any idea why there'd be such a big difference between performance on my pc and yours?
 
1:34 AM
I think Dyalog uses libc for logarithms, but something is going very wrong if the Windows version is like a thousand times slower.
 
<moon-child> j uses sleef
 
ngn
who uses windows for serious performance anyway
 
<moon-child> it's cool: vectorized impls of math functions
 
moon-child: That's based on my recommendation.
What does cmpx '0.1*n' '10⍟n' give you? The logarithm is 86% faster for me.
 
was just about to ask if you had any test ideas
what's n here?
 
1:36 AM
Oh, you called it a.
 
oh are you ⎕IO←1?
 
Yes, but I tested both ways.
 
ok
      cmpx '0.1*b' '10⍟b'
  0.1*b → 1.8E¯1 |     0% ⎕⎕⎕
* 10⍟b  → 2.3E0  | +1151% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
yikes!
 
ngn
* <- means results differ
 
that's what marshall had
yes, but they do here
 
1:37 AM
Is that also true for bases other than 10? log10 is used for base 10 specifically.
 
      cmpx '0.1*b' '5⍟b' '10⍟b' '17⍟b'
  0.1*b → 1.9E¯1 |     0% ⎕⎕⎕
* 5⍟b   → 2.2E0  | +1106% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* 10⍟b  → 2.2E0  | +1056% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* 17⍟b  → 2.1E0  | +1032% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
yep
 
Time for a support email to Dyalog probably. I don't know whether libc is linked statically or dynamically; maybe it's dynamic and there's a problem with your setup. PQAs are normally done on Windows so it would be hard for logarithm to be this slow without anyone noticing.
 
I've noticed log being very slow before, but didn't think much of it
I should probably update to the latest version first before emailing just in case
 
Power looks kind of slow too: mine finishes in 1.0E¯2 seconds.
 
your pc is probably a lot better than my laptop
 
1:48 AM
It's an i5 from 2017 so maybe not.
(But that didn't go well when I tried it on dzaima.)
 
ngn
which reminds me, i need to buy a new laptop. any recommendations?
 
there must be something weird going on then with maths on the windows version or on my installation
does anyone else here use windows....?
crap! I restarted dyalog to see if that would change anything but lost my 'good' solution
I think it was this {10⊥(-+⌿∧⍀0=d)⊖⊖d←10⊥⍣¯1⊢⍵}
 
Slightly slower than mine, but the hybrid {(10*+⌿∧⍀0=d)÷⍨10⊥⊖d←10⊥⍣¯1⊢⍵} is faster. Fastest is still your interval index version.
 
ngn
@rak1507 and that, children, is what files are for. rak had a function. rak restarted the interpreter. rak doesn't have a function anymore. don't be like rak.
 
lmao
actually, I was wrong, I had a copy in one of the 5 notepad windows I had open
 
ngn
2:00 AM
@rak1507 shh!
:D
 
still a bit of a pain, the point still stands
@Marshall interesting
     ]runtime -c '{10⊥(-+⌿∧⍀0=d)⊖⊖d←10⊥⍣¯1⊢⍵}b' '{(10⊥⊖(m⍴10)⊤⍵)÷10*m-⍵⍸⍨0,10*⍳m←1+⌊10⍟⌈/1⌈⍵}b'

  {10⊥(-+⌿∧⍀0=d)⊖⊖d←10⊥⍣¯1⊢⍵}b                  → 1.1E¯3 |    0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {(10⊥⊖(m⍴10)⊤⍵)÷10*m-⍵⍸⍨0,10*⍳m←1+⌊10⍟⌈/1⌈⍵}b → 3.0E¯3 | +170% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
interval index is slower for me
@Razetime you use a mac right? can you try cmpx '0.1*b' '5⍟b' '10⍟b' '17⍟b' out of interest? (b←?⍨100000)
 
ok
 
for some reason on my pc it seems to be much much slower than for marshall and ngn, wonder how mac compares
 
      cmpx '0.1*b' '5⍟b' '10⍟b' '17⍟b'
  0.1*b → 9.0E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* 5⍟b   → 1.4E¯3 | -84% ⎕⎕⎕⎕⎕⎕
* 10⍟b  → 1.2E¯3 | -87% ⎕⎕⎕⎕⎕
* 17⍟b  → 1.4E¯3 | -84% ⎕⎕⎕⎕⎕⎕
 
something is seriously up with my installation
 
2:05 AM
@rak1507 How does the hybrid perform? And b is still ?⍨100000, right?
 
yep
I'll try the hybrid rn
 
Wouldn't be super surprising for that dyadic to work very differently across CPUs. It's probably doing a transpose then rotating rows then rotating back.
 
      ]runtime -c 'mine b' 'ii b' 'hybrid b'

  mine b   → 1.7E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ii b     → 2.3E¯3 | +35% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  hybrid b → 2.8E¯3 | +64% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
annoying how inconsistent timing can be
confusing stuff
 
Ah, I guess the * and ÷ are also too slow.
 
really odd
can't think of any reason why basic arithmetic operations would be far slower on windows
 
2:10 AM
But your solution takes 7.3E¯3 seconds for me so at least the non-math stuff is running well.
 
ngn
it would be interesting to compare against j, it's good at maths ops
 
maybe instead of + from now on I should use ≢,⍥(⍴∘1)
and ≢∘,1⍴⍨, instead of ×
 
Along those lines, what about {(×⌿10*∧⍀0=d)÷⍨10⊥⊖d←10⊥⍣¯1⊢⍵}?
 
ngn
@rak1507 maybe in a universe made only of natural numbers
 
who needs negative numbers anyway
do they really exist? I thought not
don't even mention complex numbers!
@Marshall way faster!
hang on let me do a proper timing
      ]runtime -c -repeat=5s 'mine b' 'ii b' 'hybrid b' 'another b'

  mine b    → 3.9E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  ii b      → 3.9E¯3 |  -1% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  hybrid b  → 3.0E¯3 | -23% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  another b → 9.2E¯4 | -77% ⎕⎕⎕⎕⎕⎕⎕⎕⎕
no idea why now ii and hybrid are faster
¯\_(⍨)_/¯
 
2:17 AM
Yeah, so it was just 10*int being slow, and 10*bool just uses a lookup instead of calling libc.
 
the performance seems very variable anyway
If I run it tomorrow, it'll probably be totally different
 
ngn
2:54 AM
@KamilaSzewczyk {i[⊃⍵;2⊃⍵]} -> {⍵⌷i} -> ⌷∘i
(⊃,/) -> (under some assumptions)
(⊂(!⍵-1)⍴⍵-1),⍨∇⍵-1 -> (∇,∘⊂!⍴⊢)⍵-1
 
ngn
3:17 AM
{⍺⍺/⍵⍵/¨⌷∘⍵¨¨(⊂⍳n),¨¨↓⍉↑1+{1=⍵:,⊂,0⋄∊¨(⍳⍵)⌽¨⊂(∇,∘⊂!⍴⊢)⍵-1}n←⊃⍴⍵}
 
 
4 hours later…
6:59 AM
@Marshall @rak1507 Interesting performance data on * and ⍟. cpmx reports the logs as about 10x faster on both my Windows and Mac machines. I will investigate.
 
7:16 AM
@olabaz If you have an example of a small but real problem (with "real" data) that you are currently solving in Julia and would like to compare to an potential APL solution, please get in touch. I think we'd be happy to set some time aside to take a look at it.
 
 
2 hours later…
9:38 AM
      {(1 2 3 +⍥⍦ 2 4 5).f 3}dx⍬
53
      ⍝ f(x) = x^2 + 2x + 3, g(x) = 2x^2 + 3x + 4
      ⍝ h(x) = f(x) + g(x), h(3) = 53
I added polynomials
 
ngn
@KamilaSzewczyk what is ?
 
it builds a polynomial
it's a fancy version of {+/⍺⍺×⌽1,×\⍵⍴⍨1-⍨≢⍺⍺}
 
ngn
@KamilaSzewczyk looks like ⊥⍨ (at least for scalar )
 
hmm
if i was to allow 1 2 3 + 2 3, what should it yield
 
<moon-child> I don't think it should be allowed, but most sensible thing would be the same as 1 2 + 2 3 (i.e. truncate at the lowest of the shapes)
 
9:54 AM
i thought about padding the shorter vector
but i'm not sure if i should pad front or pad back
 
ngn
@KamilaSzewczyk inspired by dyalog's tradfns: the shorter array should be padded with some data from the caller's argument(s) :)
 
hahaha
 
ngn
@KamilaSzewczyk why not make it a choice? ⎕pad :)
 
i wonder how hard would it be to intercept system functions inside my thingy
      60⌶'⎕a'
┌──┐
│⎕A│
└──┘
seems like they're interpreted as a single token, so it should be fairly easy :)
@ngn what do you think about rational index origin and index granularity
 
ngn
@KamilaSzewczyk this is a joke, right?
not the same as rational indices but maybe worth mentioning: k9 has "step functions" - they are specified at certain values of the argument, and if you try to index them (i.e. call them) between those values, they default to the smaller one
 
 
2 hours later…
11:43 AM
@MortenKromberg Sorry, are you saying you have the same issue as me (slow logs) or it's fine for you?
 
@rak1507 I too see 10⍟b being faster than 0.1*b (though only by 2-6x, not 10x)
 
Hmmm
 
RGS
12:08 PM
Is it possible to print in a line, and then reprint on the same line?
 
doubt it, you could try ansi escape characters
 
RGS
I am not sure how that works, but I think it's the carriage return char (ASCII 13 right?) that would allow me to rewrite the same line..?
@rak1507 What would that/those be?
 
@RGS Not in the REPL/IDE at least, I'd say
 
RGS
Yeah :/
 
RGS
12:11 PM
@rak1507 ⍨ do you have any idea how to work with those?
 
in a terminal, you output them and they do stuff
 
@RGS you just (⎕ucs 27),'[whatever'
 
RGS
Yeah well it works in a regular terminal
Not inside the IDE, like you expected.
 
@RGS do you use windows?
 
12:29 PM
CMC: find the index of the first duplicate item in a vector
(oh, there's an easier solution to the one I had, oops)
 
@rak1507 {⊃⍸~≠⍵}
 
yep
 
@rak1507 ⍟ is 10x faster than * on my Windows laptop AND my MacBook Air
 
really weird
going to update and see if it stays the same
 
I will update and check my Linux machine later today...
 
12:42 PM
must be something strange with my pc or my installation
 
RGS
@rak1507 Yes, why?
 
can you run b←1⌈?⍨100000 and ]runtime -c '0.1*b' '5⍟b' '10⍟b' '17⍟b'
huh, updating fixed it!
      ]runtime -c '0.1*b' '5⍟b' '10⍟b' '17⍟b'

  0.1*b → 7.9E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* 5⍟b   → 8.5E¯4 | -90% ⎕⎕⎕⎕
* 10⍟b  → 7.2E¯4 | -91% ⎕⎕⎕⎕
* 17⍟b  → 8.6E¯4 | -90% ⎕⎕⎕⎕
¯\_(⍨)_/¯
so weird lol oh well at least it's fixed now and I can finally use logs
 
RGS
      ]runtime -c '0.1*b' '5⍟b' '10⍟b' '17⍟b'

  0.1*b → 1.1E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* 5⍟b   → 1.8E¯3 | -83% ⎕⎕⎕⎕⎕⎕⎕
* 10⍟b  → 1.5E¯3 | -86% ⎕⎕⎕⎕⎕⎕
* 17⍟b  → 1.8E¯3 | -84% ⎕⎕⎕⎕⎕⎕⎕
 
yeah
I wonder what was causing it to be so slow for me before
 
RGS
Wait, on my machine everything is 10 times slower
 
12:51 PM
@rak1507 It appears that there is significant room for improvement of both * and ⍟, which we will be investigating. My first guess would be that vector instructions are being used for some cases and not others.
 
@RGS 10 times slower than what?
@MortenKromberg well it seems fine now... maybe it was just an issue with that particular version or something I did to the installation
 
RGS
Ok not 10 times slower, but my timings are consistently slower than yours.
 
what's your cpu?
 
In more and amore cases, Dyalog APL selects different algorithms depending on whether different types of vector instructions are available on the machine. We've had cases where clients complained and we found out that although the chip had AVX, the VM was configured to pretend that it wasn't.
 
RGS
This? Processor Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz, 2592 Mhz, 6 Core(s), 12 Logical Processor(s)
 
12:53 PM
that's a lot better than mine
should be faster... who knows
 
Me: Core i7-6820HQ @ 2.7GHz
 
RGS
      ]runtime -c '0.1*b' '5⍟b' '10⍟b' '17⍟b'

  0.1*b → 5.8E¯3 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* 5⍟b   → 6.0E¯4 | -90% ⎕⎕⎕⎕
* 10⍟b  → 5.3E¯4 | -91% ⎕⎕⎕⎕
* 17⍟b  → 6.0E¯4 | -90% ⎕⎕⎕⎕
plugged it in, now it goes faster.
 
Ah
Makes sense
 
RGS
vrum vrum 🚗
 
Now I have a new installation... how do I set default ⎕IO again?
 
RGS
12:55 PM
you set it to whatever you want
 
Ah, options -> configure
 
RGS
then close the interpreter and ask it to save the config
or that
 
OH! It was ⎕FR!
I have ⎕FR←1287 by default
 
RGS
Mine's at 645
 
Yeah
When I switch to 1287, I get the slow logs, but on 645 it's fine
 
12:58 PM
@rak1507 global variables at it again
 
Yeah, I can't believe I didn't think of FR
Still... logs shouldn't be over 1000 times slower with a higher precision right? idk
not ideal
 
RGS
@rak1507 changing ⎕FR←1287 and timing again gives those increases for me as well
 
yeah, that'll be it
updated my version for nothing! lol
 
Decimal floating-point can be expected to be ~50x slower
... but we have been able to speed some things up, so YMMV
 
@rak1507 well, it is native hardware support vs a custom (and inefficient as it's base 10!) number format and presumably custom impls for all operations
 
1:00 PM
@dzaima ah, didn't know it was a custom format for ⎕FR←1287, that explains it
I'll stick with 645
 
@rak1507 yeah, only powerpc or whatever has native support for 128-bit decimal floats
 
@dzaima Ah interesting I didn't know that, I barely know anything about low level stuff so I didn't even consider that it could be ⎕FR making it slow, facepalm
 
The DECF format is for people who need to do accurate currency conversions on the Norwegian Oil Fund or the US National Debt, DOUBLE won't do any more :)
 
financial calculations using floating point, I think I'm going to be sick
 
It is a tricky business
 
1:03 PM
@rak1507 well, it's decimal floats, which is somewhat better (unless you're dividing by 3 or something weird for some reason)
 
Ah right yeah fair enough
 
I think applications that really need it will use DECF for accounting, but might well slip back into DOUBLE to do things like compute an internal rate of return, where you really don't need 30+ digits of precision.
(hence the switch, few people want to use DECF for everything)
To anyone thinking of implementing a new array language, I recommend variable-precision floats and (not or) "rats". We expect to go there eventually.
 
what about high precision ints?
 
@MortenKromberg I'd personally disagree with variable-precision floats. Ideal float usage shouldn't be able to ever strictly break on lower precision; if ints and floats aren't in the same tower, imo even f32 would be just fine
 
1:19 PM
Can you explain what "ideal float usage" is? If the application knows its range and precision requirements, why should it not use a "custom" data type?
 
@MortenKromberg if you indeed know your precision requirements and manage to make sure all your additions and subtractions are done on the same magnitude numbers to have predictable precision loss, i guess it's fine. But doing that is hard
 
I think that if, like in a multi-currency accounting system, you have specific precision requirements, it is natural to follow such rules for all the arithmetic that is related to your accounting. The rest of your math you would probably do using the normal numeric tower with DOUBLEs.
 
@MortenKromberg I would hope that an accounting system has precision requirements of "100% correct", and an extra 15 digits of precision just delays the time until it's not correct if the operations aren't guaranteed to be safe
 
100% correct, rounded off to specified numbers of digits at various points in legally mandated computations.
 
@MortenKromberg if you have mandated rounding, why not just use fixed-point integers?
 
1:30 PM
If you do a currency conversion, or you own 1/3 of something, you will need to round things off.
 
@dzaima As Morten says, precision requirements are a matter of law, and being more precise would also not be allowed. Fairly sure this subfield of finance is the only kind of programming with a requirement like this, so I think it's very strange to consider when making a general-purpose language.
 
Fixed point integers are nasty because you're not expressing math naturally.
@Marshall Indeed, these things are all perfectly horrible when making a general-purpose language.
 
@MortenKromberg I mean more as a language type. Use as regular floats, but they're actually precise, sane values
 
@dzaima Yeah, I realised that a second after making my comment, sorry. I guess you could use them but then you would need to be a bit more careful than if you have floats with known precision.
 
@MortenKromberg I'd say you'd be able to be less careful. For one, magnitude is no longer intermingled with decimal precision
 
1:35 PM
@Marshall Rational numbers are a better solution for a general-purpose math-oriented language, I guess(?). The problem is that they have unknown cost, which could get catastrophic if used for financial calculations.
 
@dzaima but if there are things mandating strict behavior, there's really no point in supporting things the rules weren't made for i guess
 
anyone know how to make ⎕plot work on gnuapl? gnu.org/software/apl says 'you need some of the special purpose system functions (⎕FFT, ⎕PLOT, ⎕RE, etc) that depend on non-default libraries', and while ./configure has a --with-pcre option for ⎕re, idk how to get ⎕plot working
i found stackoverflow.com/questions/58927866/… , and have gnuplot installed, but still doesn't work
 
@dzaima You may be right, I have not looked carefully enough at those types yet and our financial clients went for IEEE DECF.
 
2:03 PM
@user41805 You're going to have to provide a bit more details than "it doesn't work"
 
right, i get SYNTAX ERROR+ when running ⎕plot ⍳10, for instance
i get the same error when running '2'⎕re'2', which according to doc/apl.html means the cnofigure script doesn't find libpcre. but the doc section for plot doesn't say anything about this
 
 
1 hour later…
3:21 PM
@user41805 Are you using the latest version from SVN?
 
@EliasMårtenson i downloaded 1.8 from the download page ftp.gnu.org/gnu/apl
why, has there been a fix since 1.8's release?
 
@user41805 The versioned releases are very rare, and the author only does them rarely when asked to. Usually it's a couple of years between them.
Always get the latest version from the SVN repository.
 
3:38 PM
okay i'll try that
done, and got the same error again
 
@user41805 The plot one is strange, since it shouldn't require any compile-time dependencies.
It simply runs the external program. What is the error you're getting?
 
4:14 PM
SYNTAX ERROR+
      ⎕PLOT ''
      ^
with ⎕plot ⍳10 there is an addition caret under the iota
 
 
5 hours later…
8:52 PM
CMC: running totals of the counts of each number in a vector, 5 8 2 3 8 3 3 4 5 4 5 5 -> 1 1 1 1 2 2 3 1 2 2 3 4
 
@rak1507 BQN,
 
Yep, I was playing with BQN and wondered how that could be done in APL succinctly
I have a 7 but I feel like there must be something cleverer
 
@rak1507 The implementation BQN uses is ⊐˜(⊢-⊏)⍋∘⍋. It's the same as the J one in this essay and I think there's one in the FinnAPL idiom library as well.
 
ngn
9:14 PM
@rak1507 {0 0⍉+\⍵∘.=⍵} and (⌈⌿+\×⊢)∘.=⍨
unftly +\⍤∘.=⍨ is a syn err
k: {|/x*+\'x:x=\:x}
 
+´¨⊢=≠↑↑ in BQN as well.
+´¨⊢=1↓↑ if you want it to include each number in its own count.
 
ngn
golfing is not fun when done in different languages
 
9:31 PM
@dzaima Thanks. Fixed.
 
9:52 PM
@ngn I think I have an 11 in K
 
ngn
@rak1507 translation of marshall's?
 
No
could easily be the same though
 
ngn
i'm too hungry to think right now :)
 
yeah it is the same as marshalls {+/'x=,\x}
and my APL one was ⊢+.=¨,\
 
ngn
10:17 PM
@rak1507 that's 10 - cool!
 
oh oops, I don't know how I miscounted
 
ngn
that feeling when i'm not even the number two golfer at the language i've so lovingly stolen and reimplemented
 
who are the top K golfers? I've seen a few people on cgcc but I can't remember their names
another cmc: find the maximum number of repeated elements (1 1 1 1 -> 4, 1 2 3 4 -> 1, 1 2 1 1 -> 3) without using ⌈/ or equivalent
 
@rak1507 I have 5
 
ooh
I have 6
got 5
 
ngn
10:26 PM
@rak1507 @coltim is by far the most prolific. @galen-ivanov has some great shots too. there are people in "the k tree" who are really good at it but don't golf.
 
@dzaima ⎕RL←1⋄2049≡?+/⎕UCS'≢∘⍉⊢⌸'?
oh oops
I meant to put the code in a variable to avoid revealing it
lol
 
@rak1507 yep
 
ngn
10:43 PM
@ngn i should have mentioned @scrawl and @traws too
 
ngn
10:59 PM
cmp: how do you pronounce "julia" (the language)?
 
like the name
 
@RGS ⍞←'...' ⋄ ⎕DL 2 ⋄ ⍞←⎕UCS 3⍴8 ⋄ ⍞←'yes'
 
ngn
@rak1507 french family name or anglo-sax female given name?
 
@ngn the female name (didn't know about the french one, how is that pronounced?)
 
11:12 PM
 
ngn
@rak1507 /ʒu'lja/ (stress on last syllable), like gaston after whom the lang was named
 
ah so the main difference is a french j like je rather than a hard one like juice?
 
ngn
@rak1507 yeah, /ʒ/, not /dʒ/, and the stress of course
 
yeah
 
ngn
welcome to the minority of people who pronounce it correctly :)
 
11:23 PM
youtube.com/watch?v=xKrIp4ZVOrg the creators seem to pronounce it with a hard j
 
ngn
that's so wrong :)
 
Just wait until you hear how people pronounce mandelbrot!
 
ngn
@rak1507 how could one even make a mistake there? (except: final t not pronounced?)
 
Man-dell-brot
 

« first day (1494 days earlier)      last day (1143 days later) »