« first day (1124 days earlier)      last day (1529 days later) » 

9:00 AM
-1
Q: Increase the numbers in apl

 cicknessI have the following data here in first row char (a b d a), number are in second row (5 9 6 1) how get char of max number in second row and how to increase the numbers in the second row with the condition (for example, if char= a, then increase the number by 10%)

 
 
3 hours later…
12:22 PM
0
Q: how to dynamically calculate sum of increases?

 cicknessI have the following data: a b c d 5 9 6 0 3 1 3 2 Characters in the first row, numbers in the 2 and 3 rows. how can I change the second row depending on the numbers in 3 row. for example in the 3rd row if number=3, then the number is multiplied by 2, if in the 3rd row the number is 1, then +...

 
1:08 PM
@cickness Welcome to the APL Orchard. Do you want a tour?
 
Thank you) I'm still reading your answer))
 
@cickness OK. When you're ready for the tour, write me a message beginning with @Adám which will ping me (makes a sounds) to get my attention.
 
1:31 PM
Is there a rule to simplify this with tacit programming?
⎕←(⊢-⊢⌹=⍨)⍳5
 
@JamesHeslip
¯2 ¯1 0 1 2
 
I know that with dyadic trains, I can omit the tacks if they're surrounding a function, i.e:
⎕←5(⊣-⊢)6
is equivalent to ⎕←5(-)6
I can't see a way to improve ⊢-⊢ in this case, though it may be the lack of coffee?
 
@JamesHeslip I'm not sure what exactly you're looking for. ⊢ f g is a called a hook and can also be constructed as f∘g⍨, but I don't know if that's "simpler":
⋄ (⊢-⌹∘(=⍨)⍨)⍳5
⋄ -∘(⌹∘(=⍨)⍨)⍨⍳5
 
@Adám
¯2 ¯1 0 1 2
¯2 ¯1 0 1 2
 
@JamesHeslip In these particular cases, you can replace =⍨ or (=⍨) with ×
 
1:37 PM
I always forget monadic ×...
 
⋄ (⊢-⊢⌹×)⍳5
⋄ (⊢-⌹∘×⍨)⍳5
⋄  -∘(⌹∘×⍨)⍨⍳5
 
@Adám
¯2 ¯1 0 1 2
¯2 ¯1 0 1 2
¯2 ¯1 0 1 2
 
@Adám, perfect, thank you.
 
 
3 hours later…
4:16 PM
@Adám can you help? in this example stackoverflow.com/questions/60362115/… if i need multiply by different numbers, such as 1.03. with all the columns. what to do in this situation?
 
@cickness You need to multiply everything in row 2 by 1.03? Something like this:
⎕←1.03×@2⊢3 4⍴'a' 'b' 'c' 'd' 5 9 6 0 3 1 3 2
 
@Adám
   a    b    c d
5.15 9.27 6.18 0
3    1    3    2
 
4:37 PM
@Adám nope) i need multiply each number to another number.
for example 5*1.03 9*1.06 6*1.03 0*5 3 1 3 2
 
@cickness Again, it'd be simpler if you kept each row in a separate variable, but this should work:
⎕←1.03 1.06 1.03 5×@2⊢3 4⍴'a' 'b' 'c' 'd' 5 9 6 0 3 1 3 2
 
@Adám
   a    b    c d
5.15 9.54 6.18 0
3    1    3    2
 
@Adám how complicated everything is) in this version it’s just a multiplication, without reference to the numbers from the 3rd line. but somehow you can make a binding. type. if there is a number 3 in 3 row, then multiply by 1.03. if the 3rd line has the number 2, then we multiply by 2
 
@cickness You really should keep the rows in separate variables. Then you can create condition masks and transform those to multipliers or additions. E.g. values×←(2*2=control)×(1.03*3=control) etc. Of course, you can just write data[3;] instead of control and data[2;] instead of values but readability drops quickly.
 
5:14 PM
@Adám can you look? tio.run/##SyzI0U2pTMzJT/… I make a mask, but the numbers did not increase. when there are 2 "values" this meaning that 2 different variables or will it grind? I don’t understand how to update
 
@cickness You're comparing the control to the fractions, e.g. (8÷100)=control. You probably want to compare to one of the existing control values.
@cickness Maybe something like this?
 
@Adám you are right) "right". THX!
 
@cickness Any time!
 
 
2 hours later…
7:32 PM
How do we type all these characters?
 
Most symbols have very mnemonic pairings with their keyboard locations, like e for (element, enlist) and d for (round down, minimum), etc.
 
7:50 PM
Why couldn't they just use letters...
 
Here's a very simple problem I can't find an elegant, short solution for: Take a boolean array like 1 1 0 0 0 1 1 1 0 1 0 1 1 as input. We want to produce the output 2 3 1 2. Looking for a solution in J.
 
@S.S.Anne Imagine if you had to write mathematical formulas using letters instead of symbols!
@Jonah I.e. APL's:
 
Yeah, sin, cos, M, E, f. Terrible.
 
⎕←≢¨⊆⍨1 1 0 0 0 1 1 1 0 1 0 1 1
 
@Adám
2 3 1 2
 
7:57 PM
@S.S.Anne i'll ask the opposite - why not use symbols? Besides not having to set up a keyboard input, i don't think there's much to lose, and in the end the code is way more easily readable
 
@S.S.Anne They used to write et instead of + and m instead of -
 
Maybe I can write an ASCII-to-APL converter for ease-of-not having to set up a keyboard.
 
@S.S.Anne Quite a few have tried before you. The result tends to be less than pleasant.
@S.S.Anne Here's one attempt.
 
@S.S.Anne If you're serious about understanding the deeper reason you might prefer symbols, there are some good, approachable videos on youtube by Aaron Hsu. Also many pieces by Ken Iverson himself. It's a subject with a pretty substantial literature. It may not persuade you, but at least you'll understand the argument fully. It's a pretty deep subject imo.
 
@Adám Not that kind. One that just takes keyboard input and transforms it into what it would be on an APL keyboard.
 
8:03 PM
@Jonah Maybe you can add a section to aplwiki.com/wiki/Glyph about the reasons and the attempts to ASCIIfy APL?
 
@Adám Sorry I was referring to his question about why did they have to use symbols, not the ascii <-> symbol translation problem which is a much smaller (more trivial) impl detail in the process of programming itself.
 
@S.S.Anne Ah, I see. You might enjoy this where you can type e.g. -> and press Tab to transform it into
 
I was thinking a program where I could type "e" and have it replaced by "∊" or "r" replaced by "⍴".
@Jonah I'm male. The name is a reference to a ship from the first generation of Pokemon games.
 
@S.S.Anne How would the program distinguish between an e e and an ∊ e?
 
@S.S.Anne Sorry about that, fixed.
@Adám Do you happen to a have a reference handy to the dyalog symbols?
 
8:07 PM
There's an e e too?
 
@S.S.Anne There's the letter e which you can use in identifiers like variable names.
@Jonah Ask the bot:
)ref
 
Thank you
 
@Jonah There's also the interactive Language Elements page.
@S.S.Anne There's the so called "backtick keyboard" where you can prefix e with ` to make an ∊ and prefix r to get ⍴
 
I'm not sure if J has the "Nest" operator you used.
Oh nm it looks like boxing
Perhaps ;?
 
8:12 PM
@Jonah I don't think it does. Let me run downstairs to ask Marshall. Hang on…
 
You mind explaining in english what's happening, I will probably be able to tell quickly if I can translate that way
 
8:25 PM
@Jonah It is simply the length of each of the partition-reflexive. I don't think you can do that. Marshall's:
#tio do j echo _2-~/\I.2~:/\0,0,~1 1 0 0 0 1 1 1 0 1 0 1 1
 
@Adám 2 3 1 2
 
@Jonah Is it possible to write multiple J sentences on a single line?
 
Not really. You can use the verb [ between two verbs like this though as a cheat:
#tio do j echo (a * 3) [ a=.1
 
@Jonah |syntax error: script
 
@Jonah I know about that, but it won't work if you need to assign verbs.
 
8:29 PM
This works eg: (v 3) [ v=.*: and returns 9.
 
@Jonah 4 or more initial spaces (Ctrl+K) will monospace everything. Bot understands neither backticks, nor edits :-)
@Jonah Huh, how? Magic?
@Jonah Gives 9 [ *: for me (as expected).
 
Ah sorry yeah you have to call it to get the raw 9
There is nothing equivalent to a "semicolon" in other langs, I am pretty sure.
 
That's really bad practice. One day you'll have a verb with side effects!
I was just thinking if I should set up the bot to understand J.
 
IRC J has one. It has a memory so people can assign and then use across multiple invocations.
 
@Jonah This one can do that too, I just never use that functionality.
 
8:35 PM
:)
Tell Marshall thanks, that's a little better than what I came up with, though still bulkier than I'd hoped.
 
I'll tell him. hits the spot sometimes.
 
@Adám Out of curiosity, when given the choice, does you happen to know if Roger Hui would use J or APL?
 
@Jonah Like if he needs to munge some data for himself? I know he has been teaching his child APL rather than J.
You know, you could just ask him
 
How can I contact him?
I'd love to ask him some questions.
 
Most people at Dyalog have the email address firstname at dyalog dot com.
 
8:48 PM
Great, thanks.
 

« first day (1124 days earlier)      last day (1529 days later) »