« first day (443 days earlier)      last day (2368 days later) » 

1:59 PM
@Adám What does ^ do? Example
@cairdcoinheringaahing LCM
So Dyalog treats and ^ to be the same character?
@cairdcoinheringaahing Same function, not same character.
 
4 hours later…
5:39 PM
Hey @Adám, how can I make a while-like structure in a Dfn? I tried using ⍺{⍵≢' ':doStuffTo⍵⋄what happens here is not important⋄call recursively with ⍺+1}⍵
Doesn't work though, it just exits after running once
@J.Sallé Either do⍣(~condition) or tail recursion.
@J.Sallé E.g. next higher multiple of 10:
⍞←{0=10|⍵:⍵ ⋄ ∇1+⍵}13
@Adám 20
⍞←1+⍣{0=10|⍺}13
@Adám 20
@Adám ah, I see. I'll try this one
Actually I think I'll try the other one. This one is kinda confusing to do what I want
5:48 PM
@J.Sallé What's your code?
@Adám 1{⍵≢(≢⍵)⍴' ':⎕←f←(⍺⊃⎕A)⎕R' '⊢⍵⋄(1+⍺)∇f}'TEST'
Purpose is to remove letters from the given string in alphabetical order
one at a time
Also it's still not gonna work as it should but I'm trying to go step by step
It doesn't match the CMC though, you should only remove one T the first time around, not all the Ts.
@Adám that's why I said it's not gonna work as it should :p
I just wanted to try to do something with ⎕R/S to get a feel for it
@J.Sallé But the looping format is right.
I'll fine tune it eventually
@Adám it doesn't loop though? At least it seems like it doesn't
5:55 PM
@J.Sallé Because your condition is reversed. It says: If ⍵ has non-spaces, terminate with the following result, else recurse.
⎕←1{⍵≡(≢⍵)⍴' ':⍵ ⋄ (1+⍺)∇ ⎕←(⍺⊃⎕A)⎕R' '⊢⍵}'TEST'
@Adám
TEST
TEST
TEST
TEST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T  T
Aaaaah I see
@J.Sallé "⍵ has non-spaces" can be written as ×≢⍵∩⎕A.
@Adám Okay, thanks! What's with the × there though?
@J.Sallé Only 1 is truthy in APL.
6:02 PM
@Adám Ah, that's a doesn't match, not a tally
I get it now
⍞←1{×≢⍵∩⎕A:⍵⋄(1+⍺)∇⎕←(⍺⊃⎕A)⎕R' '⊢⍵}'TEST'
@J.Sallé TEST
Doesn't seem to work though?
@J.Sallé ? No, it is a tally. The sign of the length. If the length of the collection of letters is positive, we have letters, but if the length of the collection of letters is zero, then we don't.
@J.Sallé Now you have reversed condition again.
Oh
I think I get it
Okay I get it
@J.Sallé Also, you need ⎕← for multi-line output.
⎕←1{×≢⍵∩⎕A:(1+⍺)∇⎕←(⍺⊃⎕A)⎕R' '⊢⍵⋄⍵}'TEST'
6:05 PM
@Adám
TEST
TEST
TEST
TEST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T ST
T  T
@Adám also I was reading through the ⎕R/S lesson transcript but I couldn't find anything about this: can I ⎕R just the first match?
@J.Sallé Only if you can specify that in the regex.
@J.Sallé I don't think regex is a good solution in this case anyway, as you only need to replace a single character each time.
@Adám yeah, I'm starting to think the same
I'll use 'find' instead, I think
@J.Sallé The letter you need to replace is (⊢⍳⌊/)⎕A⍳⍵. Even shorter: ⊃⍋⎕A⍳⍵. Even shorter: ⊃⎕A⍋⍵.
@Adám that's helpful already :D
6:14 PM
@J.Sallé Which primitive do you think you can use to replace a character at a specific position?
@Adám I was thinking about using @ but I don't think that replaces?
@J.Sallé It sure does.
Hm, I must be using it wrong then
I'll keep trying
⍞←'_'@3⊢'HELLO'
@Adám HE_LO
6:17 PM
@J.Sallé ^
⍞←' '@(⊃⎕A⍋⊢)'TEST'
@J.Sallé RANK ERROR
@Adám What am I doing wrong?
@J.Sallé No wait, that is a fn.
' '@(⊃⎕A⍋⊢)⊢'TEST' also doesn't work >.>
Yeah that's what I thought, I can't use (⊃⎕A⍋⊢) with @ can I?
6:19 PM
@J.Sallé If ⍵⍵ is a fn (and thus doesn't need separation) it needs to return a Boolean.
⍞←{' '@(⊃⎕A⍋⍵)⊢⍵}'TEST'
@Adám T ST
@Adám I was sure I'd tried that
⍞←' '@(⍳∘≢=∘⊃⎕A⍋⊢)'TEST'
but I used a space instead of
@Adám T ST
6:22 PM
⎕←1{×≢⍵∩⎕A:⍺∇⎕←' '@(⊃⎕A⍋⍵)⊢⍵⋄⍵}'TEST'
@J.Sallé
T ST
T  T
   T
Seems to have worked
@Adám can I do the same as this for a lexical replacement? (non-alphabetic characters first, then capital letters then small letters?)
Idk if grade-up can do that
@J.Sallé Sure, just use ' '~⍨⎕UCS⍳256 as alphabet.
Or use monadic but replace all spaces with a higher char.
Or if it is allowed to sort lowercase before upper, use ⎕AV~' '
@J.Sallé I've got to go now too. Sunset is coming…
@Adám no problem, thanks a lot!
I'll try to use one of those

« first day (443 days earlier)      last day (2368 days later) »