« first day (267 days earlier)      last day (2374 days later) » 

1:48 AM
-1
Q: Problems when trying to use arrays in APL. What have I missed?

HarleyI first added some indentation before the log below to make the posting tool happy. Then I was told to add some context to explain the code section, but that context is now already in the code section, because I added indentation as I was told. Please look for questions that are interleaved with...

 
 
10 hours later…
11:50 AM
'Morning everyone o/ Hey @Adám, are you working on the WPA golf challenge?
 
@J.Salle No. I had a look, but I'm not going to read long RFC to know what to do. IMHO, the OP should contain everything necessary to solve the problem.
 
@Adám Yeah, I'm gonna comment something along those lines. Challenge is too language-restrictive, IMO
 
@J.Salle It isn't really language restrictive. It just uses complex algorithms which few languages have built-ins for. It would be more interesting if the OP prohibited built-ins for the main pieces.
 
@Adám my point exactly. Every golflang I know would have to create a SHA-1 algorithm, then build an HMAC function using that and then implement a solution to the challenge, it's just too convoluted
 
12:15 PM
@Adám would f←{⍵=3∧⍵=19:doSomething⋄⍵} work as a function? I want to doSomething unless the input is either 3 or 19, in which case I just want to print the input.
 
Ven
Now that I have the mind cleared, I remember why I generated 10 "steps" instead of 9: I'm stupid and I misunderstood how interval index works :D.I'm making good progress again.
 
@J.Salle Yes, but remember APL's order of execution: Functions are right-associative, so the leftmost = sees 3∧⍵=19 as its right argument. Either use parentheses or use .
@Ven Great to hear!
 
@Adám how would I use ? f←{(3∧19)∊⍵:doSomething⋄⍵}?
 
@J.Salle f←{⍵∊3 19:doSomething⋄⍵}
is "member of"
 
Oh okay, so the ∧ is not needed at all? Nice. Thanks!
 
12:23 PM
@J.Salle Correct. You only need if you have several very different conditions.
 
And can I nest those conditionals, or I'd need another function? doSomething would have to check whether the argument is a prime or not.
I'm thinking f←{⍵∊3 19:(⍵∊<primes>:doSomethingElse⋄returnSomething)⋄⍵}
 
@J.Salle You can write multiple conditions with {(cond1)∧(cond2)∧cond3:true⋄false} but note that all conditional expressions will be evaluated.
@J.Salle You would have to use {} not () and you have to supply the argument(s) to the inner function as well.
{⍵∊3 19:{⍵∊<primes>:doSomethingElse⋄returnSomething}⍵⋄⍵}
 
@Adám I see! Thanks, I think I've got what I need now
 
1:04 PM
@Adám Is this link up to date? To get the biggest prime factor of , all I need is to do is ⌈⍵.factors ?
actually I think ⌈⍵.factors will return all the factors anyway, no?
 
@J.Salle APL isn't JavaScript! ⌈/factors ⍵ or ⊃⌽factors ⍵
 
@Adám oh, okay! Thanks again hahahah
 
@J.Salle Btw, ⊃⌽3pco⍵ is shorter.
 
@Adám nice, I'll use it. Currently my function f←{⍵∊3 19:⍵⋄{⍵∊((⊢~∘.×⍨)1↓⍳):∇((2×⍵)-1)⋄∇(⍵-(⌈/factors ⍵))}⍵} raises a Syntax error on the first bracket after the ⋄, any ideas why?
 
@J.Salle ⍵∊((⊢~∘.×⍨)1↓⍳) is a function, not a Boolean singleton.
you probably mean ⍵∊((⊢~∘.×⍨)1↓⍳)⍵
 
1:17 PM
Oooooooooh yeah I keep forgetting to pass the arguments there
thanks
 
@Adám heh in some golfing languages such as jelly (grand-son of apl) the function represents a boolean literal so it's a bit confusing
 
It's now raising a value error at the function you gave me: f←{⍵∊3 19:⍵ ⋄ {⍵∊((⊢~∘.×⍨)1↓⍳)⍵:∇((2×⍵)-1) ⋄ ∇(⍵-(⊃⌽3 pco ⍵))}⍵} it points at the 3 in ⊃⌽3 pco ⍵
 
@J.Salle Did you import pco?
 
but he said it points at the 3
 
@Adám I did not, is it still shorter than ⌈/factors ⍵ if I do?
 
1:21 PM
@EriktheOutgolfer The caret points at where parsing stopped.
 
@J.Salle Where did you get factors from?
 
possibly since it doesn't know if pco is monadic or dyadic
 
Apparently it'll be because I also need to import factorseh? I got it from here
How do I import stuff? I'm still getting used to the dyalog ide for windows
 
...reading license agreement is boring :-(
 
1:26 PM
@J.Salle The language is identical on all platforms.
 
@Adám nice, thanks!
 
23 hours ago, by Erik the Outgolfer
how do I import again?
 
Hm, I think my function is looping. It exceeded the TIO's time limit and I had to interrupt it in dyalog.
 
@J.Salle Are you sure the argument eventually reaches 3 or 19?
@J.Salle I would recommend defining the function on multiple lines, and then tracing into it.
 
Hello buddies!
 
1:41 PM
@Adám the challenge says it does, and it appears to be something with the pco function
@Mr.Xcoder Hello to you, sir
 
Oh you're solving that challenge?
 
@Mr.Xcoder the frog one
 
@Adám the challenge lets you assume the tested/proven inputs btw
 
my code is currently stuck at f←{⍵∊3 19:⍵⋄{⍵∊((⊢~∘.×⍨)1↓⍳)⍵:∇((2×⍵)-1)⋄∇(⍵-(⊃⌽3pco⍵))}⍵}
 
Yup I know. I have an answer there as well
Pyth does have some convenient built-ins for that challenge but unfortunately other needed ones are quite lengthy
Does APL have a prime factors built-in?
 
1:46 PM
I was wondering, what is the 3 doing in ⊃⌽3pco⍵?
@Mr.Xcoder you need to import it
 
Oh the pco module
? or something
 
@J.Salle pco can do a bunch of primes related things. The left argument choses which functionality to use.
 
@Mr.Xcoder I've found factors and Adam told me about pco
 
I see I can do ⎕CY'dfns'
To import it?
 
@Adám I see, but then ⊃⌽3pco26 should return 13, shouldn't it?
 
1:47 PM
And then <number>pco⎕
 
@Mr.Xcoder NARS APL is an experimental APL which we kind of use as a sandbox for language ideas. It has π which is essentially pco as a primitive.
@J.Salle you need a space after o
 
I am looking for a CMC I can solve in APL, anyone up for creating one?
 
@Adám oh good lord I should've realized that
Got an 'Assertion Failure' exception now. Progress!
 
@J.Salle Huh? What did you do? Please give me the exact code which gave you the ASSERTION FAILURE.
18 hours ago, by Uriel
4 ->
0  1  2 3
¯1  0  1 2
¯2 ¯1  0 1
¯3 ¯2 ¯1 0
 
@Adám Is that easy enough so I can solve it? Also must it be formatted exactly like that?
 
1:54 PM
@Adám f←{⍵∊3 19:⍵⋄{⍵∊((⊢~∘.×⍨)1↓⍳)⍵:∇((2×⍵)-1)⋄∇(⍵-(⊃⌽3pco ⍵))}⍵} this is it. The exception is raised at the ( before ⊃⌽3pco ⍵
 
No, it should give an ⍵-by-⍵ matrix.
 
I've tested every part of the code by itself and they work separetely
 
@J.Salle Oh, it is lowercase, phew! Never mind then.
 
The debugger opens at pco[1] if that means anything
@Adám yeah it's lowercase hahahahah
 
@J.Salle (Uppercase would mean that the interpreter hit an assertion failure. That's bad.)
 
1:56 PM
@Adám Ok, gonna try this one then.
 
@Adám I can imagine.
 
@Adám What is/(are) the "range" function(s)?
 
@Mr.Xcoder monadic
 
Oh right
 
2:09 PM
@Adám my primes function (from the other day, (⊢~∘.×⍨)1↓⍳) doesn't work for some reason. If I do (⊢~∘.×⍨)1↓⍳⍵ I get no result for whatever I input
lol nevermind, now it's working. No idea why it wasn't
Okay, I found out what was the problem: was calling the inner function instead of f, so it was just looping primes over and over. I solved it by making a g←{⍵∊(⊢~∘.×⍨)1↓⍳⍵:f((2×⍵)-1)⋄f(⍵-⊃⌽3pco ⍵)} to call inside f, but now I get a WS FULL exception raised when I try the last test case by calling f 9983
 
2:41 PM
Webinar 5 - APL CodeGolf Autumn Tournament - join us on Thursday 26 October at 15:00 UTC to discover the winners https://dyalog.tv/Webinar
 
@J.Salle Can you send me a TIO link?
 
@Adám I managed to fix it in my computer by increasing the workspace size. Here's the link, TIO can handle f up to ~3200
 
3:09 PM
@J.Salle Because your primality checking algorithm is really inefficient. Use 1pco⍵ instead of ⍵∊(⊢~∘.×⍨)1↓⍳⍵
 
@Adám oooh nice, I had no idea that existed hahahah thanks!
 
@J.Salle pco manual
 
@Adám thanks, I'll use it in the future hahahah
 
4:00 PM
@Adám you found the nicer solution?
 
 
1 hour later…
5:13 PM
@Adám I have a little issue with my license
Karen approved it, but instead of a download link I got this:
> Operating System:Linux

Cost: £75

Request filed: Thu 19 Oct 2017 14:30
did I accidentally apply for the commercial version?
I have replied to Karen for further information on that
in the url where I confirmed my email it had something along the lines of ?ltype=pe
 
 
2 hours later…
7:31 PM
@EriktheOutgolfer pe is personal license, so you should be OK. However, mistakes can of course happen. If you emailed Karen, she will get back to you. If you don't get a response tomorrow, let me know, and I'll talk to her. Otherwise, you can always call into the office. Karen is usually there 9-5 UK time.
@Mr.Xcoder Any success?
@Uriel I didn't try. I have too much "work" to do. Next week I'll be talking about code golf on dyalog.tv…
 
@Adám not yet. TBH I didn't really try it today. I'll tell you if I'm done with it, maybe tomorrow
 
@Mr.Xcoder No rush.
 
8:27 PM
@Adám oo nice. good luck. I might be able to watch live
 
@Uriel Thanks. My first webcast ever :-O
 

« first day (267 days earlier)      last day (2374 days later) »