« first day (320 days earlier)      last day (2319 days later) » 

ngn
5:29 AM
@Uriel If you can make it shorter without assignment, sure, go ahead. Unfortunately ⎕ can't go immediately before the { } because ∘.⎕{ } would parse as (∘.⎕){ } instead of ∘.(⎕{ })
 
 
1 hour later…
6:57 AM
@ngn Doesn't '\-/ '[⊖⎕∘.{0::4⋄2+×⍺⎕⍵}⎕] work?
 
ngn
7:16 AM
@Adám that inputs f multiple times
 
 
8 hours later…
Ven
2:56 PM
@ngn Chat doesn't do markdown for multiline messages, btw.
 
@Adám @ngn hey guys, could someone give me a hand here? I'm trying to iterate over a vector while adding to it. I've currently got 2{n←1⋄z←⍵,⍨⍺⍴⍺⋄(≢z)<⊃⌽⍵:z,←⍵,⍨z[n]⍴⍺⋄n+1}5 20. I'd like to recurse (or loop) until ≢z≥20. The ⋄n+1 there is not relevant atm, I was just testing
@J.Sallé that code is wrong, it's supposed to be 2{n←1⋄z←(⊃⍵),⍨⍺⍴⍺⋄(≢z)<⊃⌽⍵:z,←(⊃⍵),⍨z[n]⍴⍺⋄n+1}5 20
 
Ven
@J.Sallé You might be interested in the power operator,
 
@Ven Yeah that's what I was thinking, but I couldn't get it to work
I'll fiddle with it a bit more
 
Ven
(that's a doc link btw, it just doesn't show)
 
ngn
3:20 PM
@J.Sallé that or you can do recursion with ∇
 
@ngn that'd be difficult to do since I've got a lot of stuff going on, wouldn't it? I'd have to pass n and z to the function, right?
 
ngn
@J.Sallé you could either have them as arguments (left or right; separately or in a pair) or you can modify them in place
@J.Sallé note that modified assignment like A,←B modifies A in place if it already exists
 
Ven
mh, what?
⎕←({⍵+1}⍣{⍵=0})0
 
@Ven
1
 
ngn
@Ven ⍣ applies the left operand until the right operand returns true for two consecutive values
 
Ven
3:28 PM
ahhh, right, it's for fixpointing...
 
ngn
@Ven yes, the classic use case is f⍣≡ which means apply f until the sequence converges
 
@ngn surprisingly, this doesn't error, but it's not doing what I want either
Do I really need to pass z to it too? I've no idea how to handle that
 
ngn
@J.Sallé it will take me some time to find out what it's doing
@J.Sallé which problem are you solving?
 
Ven
⎕←+∘1(=∘1{v←⍺ ⍵ ⋄ ⍺⍺ ⍵:v ⋄ ∇ v})0
 
@Ven

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
VALUE ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←+∘1(=∘1{v←⍺ ⍵ ⋄ ⍺⍺ ⍵:v ⋄ ∇ v})0
                                                                                                                   ∧

Real time: 1.275 s
User time: 1.114 s
Sys. time: 0.056 s
CPU share: 91.71 %
Exit code: 0
 
3:32 PM
 
Ven
:\ ...bah.
 
I'm trying to create the sequence first, not actually solving the challenge
 
ngn
⎕←1÷∘+⍣≡1
 
@ngn
1
 
ngn
ah, I got it wrong...
⎕←1+∘÷⍣≡1
 
3:33 PM
@ngn
1.618033989
 
ngn
there's the golden ratio (or its reciprocal)
 
Ven
how does even handle ⍺⍺..
⎕←+∘1(=∘1{v←⍺ ⍵ ⋄ ⍺⍺ v:v ⋄ ⍺(⍺⍺∇)v})0
 
ngn
@Ven for operators there's ∇∇
 
@Ven

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
VALUE ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←+∘1(=∘1{v←⍺ ⍵ ⋄ ⍺⍺ v:v ⋄ ⍺(⍺⍺ ∇)v})0
                                                                                                                   ∧

Real time: 1.313 s
User time: 1.166 s
Sys. time: 0.060 s
CPU share: 93.32 %
Exit code: 0
 
Ven
@ngn I know, but does keep its function operand?
 
ngn
3:35 PM
@Ven to be honest, I don't know what ∇ would be in a user-defined operator
 
Ven
⎕←+∘1(=∘1{v←(⍺{⍺⍺w})⍵ ⋄ ⍺⍺ ⍵:v ⋄ ∇∇v})0
 
@Ven

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
VALUE ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←+∘1(=∘1{v←(⍺{⍺⍺ w})⍵ ⋄ ⍺⍺ ⍵:v ⋄ ∇∇ v})0
                                                                                                                    ∧

Real time: 0.955 s
User time: 0.897 s
Sys. time: 0.031 s
CPU share: 97.15 %
Exit code: 0
 
Ven
I'm not good enough for that.
 
ngn
@Ven I think you need to pass ⍺⍺ to the left of ∇∇ if you're trying to call it recursively
 
Ven
@ngn well, that's not the issue (yet):
⎕←+∘1(=∘1{v←(⍺{⍺⍺w})⍵ ⋄ ⍺⍺ ⍵:v ⋄1})0
 
3:37 PM
@Ven

Rebuilding user command cache... done
Was OFF -trains=box -fns=off
VALUE ERROR
 __field_initialize_result_←(⎕NS ⍬).⍎'⎕CY''salt''⋄⎕SE.UCMD''box on -fns=on -trains=tree''⊣enableSALT' ⋄ ⎕←+∘1(=∘1{v←(⍺{⍺⍺ w})⍵ ⋄ ⍺⍺ ⍵:v ⋄ 1})0
                                                                                                                    ∧

Real time: 0.990 s
User time: 0.905 s
Sys. time: 0.046 s
CPU share: 96.09 %
Exit code: 0
 
I think I'm going to have to solve that with 2 or 3 functions
 
ngn
@J.Sallé so, in the tio link, you're creating z in the dfn and you're modifying it in the same dfn?
@J.Sallé that doesn't look like it's going to accumulate anything
@J.Sallé maybe if you create z outside and then append with z,← multiple times?
 
Ven
ah oopsie..
 
@ngn yes. I ultimately wanted it to become a vector like 2 2 5 2 2 5 2 2 2 2 2 5
 
Ven
I got my jot precedence wrong >_>
@ngn is there a trick to apply a on w?
without having to do (⍺{⍺⍺⍵})⍵
 
3:42 PM
is z←⍬ a valid way to create an empty vector?
 
ngn
@J.Sallé yes
@Ven you're asking for a way to apply ⍺ to ⍵?
 
Ven
@ngn yes
 
ngn
@Ven well, ⍺ is supposed to be an array, not a function
 
Ven
I know it is :c
 
ngn
@Ven in an operator the operand is ⍺⍺
 
Ven
3:43 PM
@ngn but I want to pass two operators. Guess I'll use ⍵⍵
 
ngn
@Ven you mean pass two functions to the operator?
 
Ven
@ngn yeah. I'll just use ⍺⍺ and ⍵⍵
ah, I think it's better now!
⎕←({⍵=5}{v←⍵⍵ ⍵⋄⍺⍺v:v⋄(⍺⍺∇⍵⍵)v}{⍵+1})0
 
@Ven
5
 
Ven
applies ⍵⍵ until the value matches ⍺⍺ :D.
 
Welp, I'll be back in a few
 
ngn
3:45 PM
@Ven that's a very elaborate way for working around ⍣ :)
 
Ven
@ngn well, sometimes you don't want that "stable" behavior that ⍣ has.
 
ngn
@Ven I agree. In k there is a proper "until": f g/ a (g gets applied multiple times to a until f returns true)
 
Ven
@ngn I did try to use / in dyalog as well, but to no avail.
That language bar is really nice :).
 
ngn
@Ven I hope it's not too off-topic that I mention k so often in an APL room.
@Ven Yeah, you could use reduction, but you have to know in advance how many iterations you want to make.
 
Ven
@ngn if you (or @Adám) have a simpler version than my until, I'd gladly take it. I think though, wrt K, that it was fine in this room.
Dec 7 at 14:51, by Adám
@Ven K and J are on-topic here.
 
ngn
3:52 PM
@Ven ⍣ is simpler
 
Ven
It doesn't do the same thing, though...
 
ngn
@Ven to save the extra iteration, you could use ⍺ instead of ⍵
⎕←{⍵+1}⍣{⍺=5} 0
 
@ngn
5
 
Ven
@ngn it's still iterating an extra time, right?
just discarding the result
 
ngn
@Ven f⍣g is still calling g an extra time, yes
@Ven but f is called the correct number of times
@Ven which is probably what you care about
 
Ven
3:54 PM
well, it calls prev ⍵⍵ next right..?
so next is calculated even though it's discarded
since it calls 5{⍺=5}6
 
ngn
@Ven oops, I was wrong. It's actually next ⍵⍵ prev
⎕←{⍵+1}⍣{⎕←'⍺='⍺'⍵='⍵⋄⍺=5} 0
 
@ngn
┌──┬─┬──┬─┐
│⍺=│1│⍵=│0│
└──┴─┴──┴─┘
┌──┬─┬──┬─┐
│⍺=│2│⍵=│1│
└──┴─┴──┴─┘
┌──┬─┬──┬─┐
│⍺=│3│⍵=│2│
└──┴─┴──┴─┘
┌──┬─┬──┬─┐
│⍺=│4│⍵=│3│
└──┴─┴──┴─┘
┌──┬─┬──┬─┐
│⍺=│5│⍵=│4│
└──┴─┴──┴─┘
5
 
Ven
wait, what?
oh.
oh..
ok, so my think is really overcomplicated just because I switched ⍺ and ⍵. oops.
 
ngn
@Ven it's still a good exercise in operator syntax :)
 
Ven
s/think/thing
 
4:37 PM
@Ven @ngn in a monadic dop is equivalent to ⍺⍺∇∇ and in a dyadic dop it is equivalent to ⍺⍺∇∇⍵⍵.
 
5:01 PM
Why is ⍬ f 2 5 returning 5 instead of 2 2 5 for f←{⍺,⊃⌽⍵,⍨⊃⍵⍴⊃⍵}?
nvm I figured it out
I'm getting a value error now though D:
I also figured it out, but why does ⍬f 2 5 return a value error and ⍬ f 2 5 works fine?
@Adám ^
 
ngn
5:17 PM
@J.Sallé your expression, a little simpler: n←2 ⋄ k←5 ⋄ z←(n⍴n),k ⋄ {20<≢z:z ⋄ z,←(z[⍵]⍴n),k ⋄ ∇⍵+1}1
 
@ngn oh, that's good! Thanks!
 
ngn
@J.Sallé likely it can be solved more efficiently with other techniques than recursion
 
@ngn I was trying to make a dop to work it out, but I got stuck >.>
 
ngn
@J.Sallé I forgot to mention: ⎕IO←0 above
 
Nice, thanks!
 
5:29 PM
@J.Sallé It doesn't by me. TIO link?
 
@Adám hm, it's working properly after a )clear, but I took a screenshot
 
@J.Sallé You had f2 with no space between f and 2.
 
yeah I jsut noticed that too
by the way, does ⍬≢⍬=0?
 
@J.Sallé No, ⍬≡⍬=0 because ⍬=0 is and ⍬≡⍬.
 
Oh, so that's why my dfn wasn't working, I assumed the contrary
 
5:39 PM
@J.Sallé Well, ⍬=0 will extend the scalar (0) to be paired up with every element of the vector (), i.e. none, so the result is 0⍴something boolean, i.e. 0
 
@Adám I see. Could you help me debug this? With that input it works fine, but when I input any other vector instead of I get a rank error
 
@J.Sallé First, what is it supposed to do?
 
If the first element of the left argument is , it should create a (⊃⍵⍴⊃⍵),⊃⌽⍵ vector
 
@J.Sallé Let's straighten some things out. You have g←(⊃⍺)≡⍬:g, (which could be shortened to g←⍬≡⊃⍺:g,) but the guard only fires if the condition (and therefore g) is true, so you might as well write :1,
 
I just noticed something
 
5:50 PM
@J.Sallé And then on the next line, we know that g is 0.
 
It shouldn't be adding that 1 before the 1 2
 
@J.Sallé So, you don't need g at all.
 
Okay, I think I'm following
 
@J.Sallé In general, (A)f⍨B should always be changed to B f A
 
I ultimately want to create a vector following this sequence codegolf.stackexchange.com/questions/150262/…
Not trying to solve the challenge yet, just want to create the vector
And I'm trying to solve it without having to fall back to :For in the tradfns
Although I realize I'll probably need two or three functions for it to work out
 
5:58 PM
@J.Sallé Hm, that's complicated. I think I have to get some dinner first.
 
Hahahah no problem, I'll need to leave in a few anyway
I'll get on that tomorrow, hopefully
 

« first day (320 days earlier)      last day (2319 days later) »