« first day (1656 days earlier)      last day (1003 days later) » 

6:32 AM
Have rewrite the Hilbert curve generator in C and linked into APL
It is the first proper program I've write from scratch in C :P
 
6:50 AM
So one question about the FFI convention, for a C arg list void gilbert(int *out, int width, int height), an corresponding ⎕NA'gilbert.dylib|gilbert >I4[] I4 I4', should I consider allocate my own C array and memcpy to out, or I can directly write to out?
 
 
2 hours later…
8:56 AM
since MAXIMUM is equivalent to OR, and MINIMUM is equivalent to AND in the boolean domain, is the OR and AND operator extraneous?
 
9:18 AM
@WongJiaHau GCD and LCM are also equivalent to OR and AND, so no they are not
in K it was decided that GCD and LCM was not required so it uses max and min isntead
anyway, max and min have better symbols in and
 
I see. So K does not have the boolean and/or operator?
 
well, it may be special cased for booleans
 
@WongJiaHau also empty reductions are different for min/max and and/or - ∧/⍬ is 1 while ⌊/⍬ is or equivalent
 
but & and | are min and max, yes
 
 
2 hours later…
10:52 AM
@LdBeth ⌷⍣¯1 or ?
@0xACE Not sure yet. We still need to actually do the work to build it again.
@user You could use ]set workdir ,/new/path/to/add but using the full path is probably best.
@LdBeth I know very little of ⎕NA but couldn't you just try? Worst case, Dyalog will crash :-)
 
 
1 hour later…
12:16 PM
thanks
 
 
1 hour later…
1:31 PM
@Adám Did you get a response on this? If you don't have anything else I'm inclined to revert. On one side Roger says, in a paper he spent a year working on, "…the rank operator, invented by Whitney on a train ride to the APL82 conference…" and "This email and [Pesch 2004] confirm Hui's recollection re Whitney's invention of the rank operator in 1982". On the other, Gitte's surprised by the question and states "I think the Rank was probably Ken's idea", and Joey gives a nonspecific "yes".
 
@Marshall No, I've been too busy. Feel free to revert for now, and then we can always re-edit when I get around to it.
 
2:05 PM
@RGS I saw that the link given for APL Meetup on the wiki is no longer working. Is it still running? Would probably be best if you could update it to reflect the current state.
 
RGS
2:54 PM
@Marshall thanks for spotting that, the link has been fixed.
The meetup is on hold for a Summer break :D
Btw congratz on the podcast appearance. Felt an urge to learn BQN after listening to the episode, even though I had to fix 47382947 mis-transcriptions of BQN
 
oh, the transcript isn't auto generated?
 
@RGS 47382947? How long was this episode for "BQN" to appear that many times?
 
I haven't finished listening to the episode yet, but so far it's good.
 
3:41 PM
@rak1507 It is, but then RGS fixes it up by hand.
 
Ah
 
4:26 PM
@user It was pretty long...
 
 
4 hours later…
7:58 PM
Is there a function to convert numbers to words? Like in the dfns page
 
@MasterQuiz You mean like 42forty-two?
 
Yes
 
Not that I know of. Not too hard to define, I'd think.
 
 
1 hour later…
9:13 PM
Depends on which language you want to convert them to :)
 
@user I was doing this problem projecteuler.net/problem=17 ahahah. I've choose to split out in ranges and do the sums, without converting, but it would be easier
 
Ah, the "and" is kinda annoying
 
Yes, if you consider 100 like 'one hundred and' like me...
 
Yet another edge case to handle :/
Does the British way include saying "one thousand and one hundred and eleven" or "one thousand one hundred and eleven" or "eleven hundred and eleven?"
 
9:28 PM
I'd say 'one thousand one hundred and eleven'
 
*narrows eyes* Are you British?
 
101101?
 
yes
@Adám no 1111
 
@Adám I meant 1111
 
one thousand, one hundred eleven
Just found this https://www.numwrite.com/search.html
 
9:29 PM
That's how I'd say it
 
111111?
 
???
 
How'd you say that?
 
How is one thousand, one hundred eleven 111111?
Oh
 
@Adám 'one one one one one one' :P
 
9:30 PM
The problem only concerns itself with numbers up to 1k, I think
 
Oh
 
@user Yes
 
@Adám I'd think you were talking about binary and say 63 :P
 
:-)
 
(it took me way too long to count those ones)
 
9:32 PM
projecteuler.net/problem=12 And to solve this I should write a better function than (≢∘∪⊢∨⍳)Js?
 
I used 2 pco for that
 
@rak1507 I should study better this pco...
 
¯\_(ツ)_/¯ That looks fine, but maybe (+/0=⍳|⊢) would also work?
 
it won't be fine, it's extremely slow
 
Huh, I thought it was in APLcart
 
9:35 PM
APLcart doesn't guarantee anything about performance
 
APLcart doesn't guarantee anything.
 
well I would say it guarantees that the code works
 
It doesn't. Bugs have been found.
 
fair enough
 
@rak1507 Ah, I thought Adám picked solutions with okay to good time/space complexity
 
9:37 PM
@Adám Where should I tell you about them? Cause I've found one
 
@MasterQuiz Either here or GitHub.
 
@user I think that there isn't a short and fast function to find divisors
 
CMC: Fast, preferably short, function to find divisors?
 
@Adám (⊢×∘.>⍨∘⍳∘≢)Mm ; I thougth I've told you about this yet, but I'm not sure
 
{×/1+⊢⌿2 pco ⍵}
that is number of divisors, not all divisors
 
9:39 PM
Aug 5 at 14:39, by rak1507
      overkill←{⍵(÷,⊢)⊃⌊/d/⍨(⍵*÷2)<d←×/1⌈a×⍤1⍉2⊥⍣¯1⍳2*≢a←factors ⍵}
      ]runtime -c 'f 98776512304' 'g 98776512304' 'overkill 98776512304'

  f 98776512304        → 8.4E¯3 |    0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  g 98776512304        → 1.8E¯2 | +110% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  overkill 98776512304 → 4.4E¯3 |  -48% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
@rak1507 How does overkill even work?
 
that's for one of the phase 1 dyalog problems
powerset of prime factors
 
Ah
 
@rak1507 How for ⎕IO←1? The error is in rank
 
overkill there is totally irrelevant to that project euler problem but if you really care for some reason stick a 1-⍨ before the ⍳
oh, cool, found a bug in that anyway
doesn't work on square numbers
< should be ≤
 
9:49 PM
@rak1507 Oh, it returns only central divisors
 
@MasterQuiz I think so too. Anyway, fixed now. Thanks!
 
@MasterQuiz yes it's problem 5 in phase 1 of the dyalog competition
 
@rak1507 (≢∘∪⊢∨⍳) This is faster
 
no it isn't
 
      ]runtime "{×/1+⊢⌿2 pco ⍵}¨⍳500" "(≢∘∪⊢∨⍳)¨⍳500" -c

  {×/1+⊢⌿2 pco ⍵}¨⍳500 → 2.2E¯2 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (≢∘∪⊢∨⍳)¨⍳500        → 6.5E¯3 | -71% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
9:53 PM
sure, it's faster on small numbers
 
I thought ⍳500 was a big array
 
500 is a small number
      ]runtime -c '{×/1+⊢⌿2 pco ⍵}¨⍳10000'  '(≢∘∪⊢∨⍳)¨⍳10000'

  {×/1+⊢⌿2 pco ⍵}¨⍳10000 → 3.7E¯1 |     0% ⎕⎕⎕
  (≢∘∪⊢∨⍳)¨⍳10000        → 4.2E0  | +1051% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
as is 10000 really
 
Huh, pco's pretty nice
 
RGS
@rak1507 That's why the transcript isn't terrible, but might have some issues.
 
10:04 PM
I'm not sure I'd agree that it isn't terrible
 
RGS
@user Maybe the longest episode so far, but also BQN was discussed left, right, and centre, so it was said many times :P
@rak1507 Oh that's terrible
 
well, maybe not terrible, but there are always quite a few mistakes
 
RGS
Yup, I bet there are :'(
BUT the auto transcript is worse 😂
 
{⍵/⍨500≤{×/1+⊢⌿2 pco ⍵}⍤+/∘⍳¨⍵}⍳10000
This has been running for like 10 minutes, should I stop it?
 
@MasterQuiz Yes. Easy to make faster.
 
10:11 PM
f⍤+/ is definitely wrong as it's parsed as (f⍤+)/
 
1. use a formula for +/⍳
2. write the inner function as ×/1+↑⊢⌿¨2 pco¨ (without braces)
 
{⍵/⍨500≤{×/1+⊢⌿2 pco ⍵}¨{2÷⍨×/0 1+⍵}¨⍵}⍳10000 This took a few seconds...
@Adám Didn't understand...
 
@MasterQuiz {⍵/⍨500≤×/1+↑⊢⌿¨2 pco¨
But actually, {⍵/⍨500≤×/1+↑2⊢⌿⍤pco¨ would be even better.
 
@Adám that'll save you a microsecond if that, at the cost of making the code way uglier
 
@MasterQuiz {2÷⍨×/0 1+⍵}¨2÷⍨×⌿0 1∘.+⍵
 
10:17 PM
@dzaima (and, due to the padding of , you'll end up doing more multiplication that you would otherwise)
 
@dzaima But you can use vectorised multiplication.
 
@Adám or just use +\
 
@Adám well, ×/1+2 pco should use vectorized multiplication anyways
 
@rak1507 Yes, of course :-)
@dzaima On some rather small vectors.
 
@Adám So work with a matrix instead of a vector of vectors is better
 
10:19 PM
@Adám well, better do it on inconsistently small vectors than tons of large ones
 
@MasterQuiz In general, yes, but dzaima has a point.
 
this can definitely be optimised in other ways too :)
 
:-)
 
@dzaima oh right, these are lists of powers per prime number, so for up to 10000 the longest one you have is 7 items long
 
@Adám Here too I use tha table from 0 1∘.⍵ so I don't have the vector of vectors.
 
10:25 PM
Yup.
 
@dzaima Your point is that it's worse use Mix and don't gain so much speed up working with the matrix?
 
Why don't you compare them using ]runtime -c "one expression" "the other"?
 
@MasterQuiz My point was that mix adds padding numbers that need to be handled for every row, but, given that the longest list you have is 7 items long, the reduced interpreter overhead is gonna be worth it
 
]runtime "{{×/1+⊢⌿2 pco ⍵}¨2÷⍨×⌿0 1∘.+⍵}⍳1e3" "{×/1+↑⊢⌿¨2 pco¨2÷⍨×⌿0 1∘.+⍵}⍳1e4" -c
What did I do wrong?
 
1e3 for one, 1e4 for the other
 
10:32 PM
@hyper-neutrino Can you give chat.stackexchange.com/users/412643/user7089017 access?
 
{⍵/⍨500≤×/1+↑⊢⌿¨2 pco¨2÷⍨×⌿0 1∘.+⍵}⍳1e5 This gives me "Nonce error". Why?
 
ugh non-)sic-ed errors confused me for a while by putting me in an environment with ⎕IO←1 ಠ_ಠ
@MasterQuiz 2 pco 1e10 is too large for pco
 
@dzaima {⍵/⍨500≤×/1+↑⊢⌿¨2 pco¨2÷⍨×⌿0 1∘.+⍵}⍳13000 I've found a number with this, but the site tells me it's wrong; or maybe I didn't understand the problem...
 
you need to give the actual triangle number
 
@dzaima Second time I make this type of error...
      ]runtime -c "{{⍵/⍨500≤{×/1+⊢⌿2 pco ⍵}¨⍵}+/∘⍳¨⍵}⍳13000" "{{⍵/⍨500≤{×/1+⊢⌿2 pco ⍵}¨⍵}2÷⍨×⌿0 1∘.+⍵}⍳13000"

  {{⍵/⍨500≤{×/1+⊢⌿2 pco ⍵}¨⍵}+/∘⍳¨⍵}⍳13000       → 7.7E¯1 |  0%
  {{⍵/⍨500≤{×/1+⊢⌿2 pco ⍵}¨⍵}2÷⍨×⌿0 1∘.+⍵}⍳13000 → 7.0E¯1 | -9%
I thought that the specific formula would give much speed up...
 
10:52 PM
The cost of computing factors far outweighs the cost of computing the sum of the indices.
 

« first day (1656 days earlier)      last day (1003 days later) »