« first day (1660 days earlier)      last day (1294 days later) » 

06:13
dfn ← {(2×⍳⍵)-1}
⍝ Equivalent to ..
dfn ← {1-⍨2×⍳⍵}
^ in that case does switch the arguments of the function -?
is there a way to split a vector by a delimiter (say x)
or just count them
Is the delimiter a scalar or a vector?
For scalar x, the canonical way to count x's in a vector v is +/x=v
and split v by x with (x≠v)⊆v
06:28
@PyGamer0 one of my favourite idioms is <char>(≠⊆⊢)<string>
06:44
splits string on char
07:30
@Razetime Also one of my faves. And for multiple delimiters: ((~∊⍨)⊆⊢)
@RikedyP ~⍤∊⍨⊆⊢?
@Adám Yeah but I just can't get into using atop for these things, don't like how it looks
Also I think what's happened for me mentally is trains just "feel right" in parens, since I don't often (unless copying from aplcart) assign trains to names, since in my mind the ideal train is just larger than a single composition but smaller than a dfn
08:01
I vibe with rikedyp
 
3 hours later…
11:18
For 2015 p4 (progressive dyadic iota), whatever I enter I get the following message: Internal error – No result was provided when the context expected one -- temporary issue, or test bug?
@xpqz Probably not temporary, as the site is static GitHub Pages+TIO. Sounds like a test bug. I'll have a look.
Mysterious. Everything looks normal.
As in you can't reproduce?
I can, using the site. I'll try running it locally.
12:09
Hi all!
Dipping my toes into APL.
I have written a solution to [Project Euler problem 1](https://projecteuler.net/problem=1), which asks for the sum of all multiples of 3 or 5, below 1000:

`euler1 ← {+/ ⍸ 0 = (3 | ⍳ (⍵ - 1)) ^ (5 | ⍳ (⍵ - 1))}`

`euler1 10` gives 23, the sum of 3, 5, 6 and 9, as described in the problem there.

It seems like it should be possible to simplify my solution a bit.
I have watched a couple of Conor Hoekstra's videos, among others, so I have seen this concept of forks, for example.
@VegardStikbakke (You might want to read apl.wiki/APL_Orchard#Basic_formatting for help with the markdown.)
@Adám Indeed, thanks!
Oh, and welcome to the Orchard. You've found the right place!
Do you know about the outer product ∘.f?
No!
But I know of it from math
⎕←3 5∘.|⍳10
12:17
@Adám
1 2 0 1 2 0 1 2 0 1
1 2 3 4 0 1 2 3 4 0
and thanks! that's great!
let's see. Trying that
Feel free to use the bot.
)about
@Adám To run APL code, write code blocks starting with ⎕← or or write a multi-line code block and prepend ⎕← or to lines you wish to run. All matching groups / lines will be joined by and run via TryAPL, and the output will be posted here. To format a codeblock, write `code`, or for a multi-line code block, use Shift+Enter to type multiple lines and press Ctrl-K, press the 'fixed font' button, or prepend four spaces to each line.
Oh, excellent!
Right, so for each number in the array on the left, it'll perform the operation on the right?
Sorry, the other way around
It pairs up each element from the left with each element from the right. The arguments are treated equally in that way.
12:20
For each number on the right, it'll perform the operation on the left?
Okay!
⎕←1 1∘.+ 1 1
@VegardStikbakke
2 2
2 2
Try changing the numbers to 1 2 and 10 20.
so in the example above, the | is the f
Yes.
12:22
⎕←1 2∘.+ 10 20
@VegardStikbakke
11 21
12 22
So now I want to do some kind of reduction along the y axis?
Yes, that's instead of /
ah!
⎕←∧⌿3 5∘.|⍳10
@VegardStikbakke 1 2 0 4 0 0 2 6 0 0
12:25
Two things:
Hm, there might be a better one? I still need to find those equal to 0 and sum them
∘ You want to know when the division remainder is zero, so you need 0=
∘ You probably mean OR, not AND, so (not )
yeah, true!
⎕←^⌿0=3 5∘.|⍳10
@VegardStikbakke 0 0 0 0 0 0 0 0 0 0
oops
ah sorry
you did say v
⎕←∨⌿0=3 5∘.|⍳10
12:28
@VegardStikbakke 0 0 1 0 1 1 0 0 1 1
⎕←+/∨⌿0=3 5∘.|⍳10
@VegardStikbakke 5
This counts how many there are, but you want their sum, so what you did before with was good.
Right!
⎕←⍸∨⌿0=3 5∘.|⍳10
@VegardStikbakke 3 5 6 9 10
12:30
⎕←+/⍸∨⌿0=3 5∘.|⍳(10-1)
@VegardStikbakke 23
Alternatively, you could multiply all the numbers by their corresponding Boolean, and sum that, since it would null out the non-multiples.
Can you show me that?
⎕←{+/all×∨⌿0=3 5∘.|all←⍳⍵-1}1000
@Adám 233168
12:32
Ohh, I get it. Nice
and name←value both sets name to value and evaluates to the value?
Yes, in general, the result of any assignment is always whatever is on the right of the
I see. Useful!
This even applies if you do what we call "modified assignment" (I think other languages call it "augmented assignment").
What's that?
E.g. ⋄ a←10 ⋄ 2+a+←1 ⋄ a
12:34
@Adám
3
11
similar to += in other languages
So a+←1 added 1 to a's current value, but it also returned 1, and then 2+1 gave 3.
modified assignment has different scoping
@Razetime What?
12:35
doesn't it assign globally?
No.
is that only ⊢←?
No.
⋄ a←10 ⋄ {a←20 ⋄ a+←1 ⋄ a}⍬ ⋄ a
@Adám
21
10
Thanks a lot Adam!
12:37
No problem. You're always welcome to ask questions here and hang out in general. There are usually people ready to help at a moment's notice.
Otherwise, questions on Stack Overflow are usually answered within a few hours.
Exactly, and also [dyalog] if that's what you're using.
Nice! Thanks!
 
2 hours later…
RGS
RGS
14:59
@Adám I wonder why does it feel like I always write the slower function 😂
@xpqz ○/ Thank you for the book
Announcement: BAA webinar NOW. Zoom 858 532 665, passcode: ×/1920 12 17
15:14
I normally get an email about it, I didn't today, wonder if something's broken.
May I get a little J help. Trying to get the same result as (3 5) ∘ר ⍳3 in APL. I can get there with <"1 |: (3 5) */ i. 3, but am I missing something obvious?
nothing obviously better to me but <"1]3 5*/~i.3 avoids the |:
I suppose it's not actually any shorter than <"1|:3 5*/i.3 :/
@rak1507 Maybe because it isn't interesting…
maybe, don't think I got one last time either
yeah, well it was the |: that seemed unneccessary. I figured there must be another way
15:26
would it be rude to leave? as fascinating as the agm is...
that's @rak1507
erm... i meant... thanks @rak1507
RGS
RGS
@rak1507 just drop a "sorry, have to go; thanks for the webinar" in the chat and leave.
That's how I usually do it, at least.
@Joshua np
what's the equivalent to ∘ in j?
for dyadic, x f∘g y being x f g y
@rak1507 I don't know. I've just started to play with J a little, but sometimes I try to learn by looking at APL stuff.
yea, doesn't look like j has an exact equivalent from a quick look at the docs
15:49
@rak1507 (f g)
@Joshua Obvious? 3 5&*each i.3
thanks @Adám, I didn't find each in NuVoc, but I will play with this and look up more info
@Joshua You could also write it as 3 5&*&.>i.3
ahh thanks. I was looking at Compose thinking it could do it somehow
In this aspect, J is exactly like APL.
 
1 hour later…
17:19
What is the user command to show the amount of memory taken by some variable in dyalog? I never used it, but I am pretty sure I have seen it being used at some point
@pmikkelsen Do you mean memory used by a specific name right now, or how much memory is needed to evaluate an expression?
Either way, do you know about APLcart?
Memory used by a name right now
@Adám Ah I should use APLcart some more instead of asking easy questions :) thanks
Then it isn't a user command you're looking for, but rather the ⎕SIZE system command.
Yes that looks like the one i need
Just be aware of what the number it reports actually represents.
17:32
Yes
 
2 hours later…
19:57
Can I unify these?
susp∨←1≡⊃event
susp∧←0≡⊃event
20:07
Never mind, that makes no sense.

« first day (1660 days earlier)      last day (1294 days later) »