« first day (1835 days earlier)      last day (826 days later) » 

11:42 AM
♦⋄ {(?10 10⍴1000)<⊂⍵}100 100
(hope this works)
like I'm trying to make a 2 length array filled with 2 big "probability" arrays. but instead i keep making many 2 wide arrays. i tried this instead:
{{(1⊃¨⍵)(⊃¨⍵)}(⊂⍵)>?10 10⍴1000}100 100
which does work but doesn't work for any input size, which is what i want
(⋄ {(?10 10⍴1000)<⊂⍵}100 100)
 
@BrianBED
┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
│0 0│1 1│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│
├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
│0 0│0 0│0 0│0 0│0 0│0 0│0 0│1 1│0 0│0 0│
├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
│0 0│0 0│0 0│1 1│0 0│0 0│0 0│0 0│0 0│1 1│
├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│
├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
│1 1│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│
├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│0 0│
 
@BrianBED what's the relationship between the size of the matrices and the numbers 100 and 1000? what do you mean by "any input size"?
 
@RikedyP i mean in a general sense. like for example i could have 1000 1000 1000 as input aswell. i could have even 10 10 10 10. but all the inputs should be the same size, tho making it work for general size would be nice and is probably needed for what i'm using it for
so like i also want it to work with 10 20 10 30 as input
 
@BrianBED I think you might want outer product ∘.F and enclose ⊂⍵
 
Ooo let me look
 
11:54 AM
do you want me to show my suggestion or do you want a go at figuring out first?
 
no need. i haven't tried what you've suggested
 
some people want hints and to work out, others want the code, so I thought I'd ask
 
@RikedyP do you know what the status is on a blog post I submitted for review a while back (a review of the phase 1 competiton solutions)?
 
12:45 PM
@xpqz Sorry, it's coming; I had a bit of thing moving it to wordpress and then Fiona wants to review some of the use of English if that's alright
 
Of course! Was just worried I'd missed something and you were waiting for me.
 
1:06 PM
@xpqz No just a bit swamped at the minute, slowly getting on top of it
 
1:27 PM
yea thanks. this is way more fun.
(`⋄ 1∘.{(⊂⍵)>?10 10⍴0}.1 .01 1 .001`)
i got this working :D
too bad i can never get tryAPL to work lol
 
 
2 hours later…
3:05 PM
⋄ {⍵∘.>⊂?10 10⍴0}0.25 0.5 0.75 1
 
@RikedyP
┌───────────────────┬───────────────────┬───────────────────┬───────────────────┐
│0 0 0 0 0 0 0 0 0 0│0 0 0 0 0 0 0 0 0 0│1 1 1 0 0 0 1 1 1 1│1 1 1 1 1 1 1 1 1 1│
│0 0 0 0 0 0 0 0 0 0│0 0 0 0 0 0 0 0 0 0│1 1 1 1 1 1 1 1 1 1│1 1 1 1 1 1 1 1 1 1│
│0 0 0 0 0 0 0 0 0 0│0 0 0 0 0 0 0 0 0 0│1 1 1 1 1 1 1 1 0 1│1 1 1 1 1 1 1 1 1 1│
│0 0 0 0 0 0 0 0 0 0│0 0 0 0 0 0 0 0 0 0│0 1 1 1 1 1 1 1 1 0│1 1 1 1 1 1 1 1 1 1│
│0 0 0 0 0 0 0 0 0 0│0 0 0 0 0 0 0 0 0 0│0 0 1 1 1 1 1 1 1 0│1 1 1 1 1 1 1 1 1 1│
 
3:39 PM
Hi all, any reference or a read recommendation on
> how to avoid spawning arrays in memory during a scan - search?
Example: find largest palindrome
in my expression {⌈/⍣2(+/⌽=⊢)¨↑,\∘⌽¨,\∘⌽⍵}
substitute rotate scan ravel ,\∘⌽ with an in place search
Thanks in advance!
 
3:50 PM
@MiljanNC You can check if an array matches its reverse in a 3-primitive train
I don't know if you want more of a hint than that, but in the meantime - since your function finds the length of the longest palindrome, I'll try to see if I have anything more on that specifically
 
4:02 PM
There is a fast algorithm for this (Manacher's), although I've not seen an APL version.
 
@xpqz Quick Q re: your blog post, just to confirm are @RGS and @rak1507 happy to be mentioned by name in it?
@xpqz also suspect it might not be faster than the primitives
unless maybe they're really long vectors
in APL, that is
@MiljanNC I also now see that I've misinterpreted the question
 
Maybe. It was a while ago since I came across it; can't say I know how it works.
 
@xpqz I take back my words til I think about it more, I was thinking of just a nested list of words, not searching for a substring
 
@RGS and @rak1507 -- are you happy to to be attributed thus for code snippets you wrote in a blog post for Dyalog?
(Suspect it's OK with @RGS, as he's reviewed it already)
 
4:20 PM
@MiljanNC I'm not sure there's a way to avoid generating intermediate arrays (that's kind of how APL is done) - maybe you'll get some mileage with stencil but I'm not sure. Try this Manacher's algorithm and see how you get on
Also I think (+/⌽=⊢) is problematic because letters can end up over each other and summing to larger than that of the largest palindrome, even if the substring being checked is not itself a palindrome
For example, I think the following should give 7:
⋄ {⌈/⍣2(+/⌽=⊢)¨↑,\∘⌽¨,\∘⌽⍵}'palindracecaromicsubstringlolinthis'
 
@RikedyP 9
 
RGS
@RikedyP I'm ok with that.
@xpqz Yeah, fine by me :)
Wait, as long as you are not insulting me too much :P
 
No more than usual.
 
RGS
Perfect 👌
 
 
2 hours later…
6:03 PM
@RikedyP thanks a lot for insights. The example is not important, rather if the scan approach can be optimized.
 
6:31 PM
I often end up with functions where I end up repeating an when I do a compress.
An example would be:
 
@xpqz sure, but why? I didn't win so I'm not sure why I'd be mentioned at all
 
{(0=∧/↑5 3∘|¨⍵)/⍵}
Is there a nice simple way that I can learn to factor out the repetition there?
 
@taronish I don't see the problem. Such patterns are very idiomatic.
 
@Adám Ok, then that's good feedback too. Thanks.
 
However, your use of with ¨ isn't. This is an outer product!
 
6:33 PM
@rak1507 I picked up on a discussion here on an alternative solution you demonstrated, as I recall.
 
fair enough
 
@Adám Oh jeez, you're right! Ok let me try again. ;)
 
@rak1507 ^^
 
Ok, that is actually simpler: {(0=∧⌿5 3∘.|⍵)/⍵}
Thanks @Adám, that's really important for me to be able to recognize.
 
ah
 
6:36 PM
@taronish If you really want, you can make an (unnecessary) abstraction:
      _Of←{(⍺⍺ ⍵)⌿⍵}
      {0=∧⌿5 3∘.|⍵}_Of⍳10
3 5 6 9 10
This is not good practice, as it forces you into a pattern of thinking that selection of an array has to depend on that same array. It might depend on another array some day.
Think of Grade vs Sort. Sorting is reordering based on the same array. Grading is more general; it can be used to self-reorder, or re-order something else.
Soon enough, you'll want to sort a table by a specific column, which necessarily is another (sub-)array.
 
And in terms of style, is it better to write it as I did, or like {⍵/⍨0=∧⌿5 3∘.|⍵} instead?
 
That is a subjective style question. Some prefer a variable {mask←0=∧⌿5 3∘.|⍵ ⋄ mask⌿⍵} while others prefer the paren, and then there's me, preferring the commute.
 
I prefer the commute too
 
My father taught me to read ⌿⍨ as "where": the argument where zero equals…
 
@Adám in k it's literally @& as in 'at where'
so even more like that
 
6:43 PM
Ah where? That's cool. Your dad taught you some APL? My dad thinks APLs grow on trees.
 
Not "some", I grew up with APL through him. He was among the great early APLers. When Iverson was in Denmark, he'd visit us at home and I'd sit on his lap.
 
@Adám That sounds really cool. APL is something I heard about a few times when I was younger but it seemed rather out of reach for some reason.
 
Being a native APL speaker, doesn't necessarily mean I'm good at expressing myself, though. I don't have any experience working with real production systems, nor am I very good at finding algorithms or any such thing. I just know the core language well. Similarly, being a native English speaker doesn't mean one can necessarily wrote great prose…
 
@Adám the bounty has been given
enjoy your (mostly insignificant in scale) 100 rep lol
also i found that program very valuable for learning, i guess, and probably a few other people would think so too.
 
@Adám At least any experience you lack can always be gained through ... experience. ;)
 
6:58 PM
@KamilaSzewczyk Ah, really? What did you learn? (Also, I missed out on my own +300, seeing as I didn't explain it. I'll try to get around to doing so.)
 
@Adám i attempted at this problem 4 times already
and each and every time i couldn't see an elegant solution for some reason
 
Would you consider mine elegant?
 
yeah
it's much more clever than what i was thinking of
 
Announcing that a new release of April is out: github.com/phantomics/april/releases/tag/v1.0
Among other things, this release includes an ncurses terminal application that demonstrates a computer graphics technique using the ⌺ stencil operator to implement a convolution kernel
 
@phantomics Any online CL environments that could make APril available?
 
7:08 PM
It's possible I could connect it to a web application to provide a terminal
Another idea I had, since I've been getting into ncurses, is creating a system that people could SSH into for an app with a terminal-based interface, would have to take steps to ensure security
 
7:30 PM
@Adám weird question: do control structures work with
and is ∘← and tail recursive slower than control structures
 
@KamilaSzewczyk Yes, but you might need to enable multi-line input.
@KamilaSzewczyk I don't know about the performance of ∘← (I don't use it), but I'd think tail recursion is on par with control structures, at least if you don't make any intermediate assignments.
 
@Adám And of course the most immediately accessible is CptKirk's Discord bot. Btw, is there a way to implement a terminal app with Dyalog?
 
7:46 PM
@phantomics Yes. On Windows you can even make a bundled executable, so you have a single exe (and then you can choose if you want to make it a terminal or GUI app). Not sure what the situation is on Linux, but we're at least getting proper #! scripts now.
 
8:07 PM
@Adám Interesting, how are controls for terminal apps specified? Defining what key does what, etc. Is there documentation online?
 
8:42 PM
@phantomics All documentation is available online :-) We have something called ⎕SM (Screen Map) and ⎕SR (Screen Read) where you can define "fields" (rectangular areas) of the screen, including active action keys, etc.
 

« first day (1835 days earlier)      last day (826 days later) »