« first day (1041 days earlier)      last day (1910 days later) » 

02:44
@AntonioNikishaev @TessellatingHeckler Thank you both!
 
14 hours later…
17:13
Announcement: DuckDuckGo now has an !aplcart bang; you can search directly on APLcart by entering !aplcart with your query. This also works in your URL bar if you use DDG as your browser search engine.
4
ngn
ngn
i like that
17:59
How would you do «f⍣g but giving intermediate results»?
yesterday, by Adám
2
Q: Repeated function application in APL

August KarlstromGiven the integers p, q and n I would like to generate a vector of length n with the elements (⌊p ÷ q) (⌊(⌊p ÷ q) ÷ q) ... In other words I want to construct a vector where the i:th element is {⌊⍵ ÷ q} applied i times on p. How can I do that in APL?

@Adám I don't want "vector of 𝑛", I want «until g»
@AntonioNikishaev Ah. Sorry.
ngn
ngn
@AntonioNikishaev dyalog doesn't have scan-fixedpoint, so you must work around it with something like {⍵,⊂f⊃⌽⍵}⍣{g⊃⌽⍵}⊂ or recursion
@AntonioNikishaev @ngn Maybe I should add {⍺←⊢ ⋄ r⊣⍺ ⍺⍺{r,∘⊂←⍺ ⍺⍺ ⍵}⍣⍵⍵⊃r←⊂⍵} to APLcart?
18:16
@Adám Thanks. Yes! I tried to search "iterate", "unfold"
ngn
ngn
@Adám that might scare the noobs :)
@ngn Do you have a better (shorter) general definition?
ngn
ngn
better lobby for a scanny ⍣
@ngn Like ⍣(⍳10) and ⍣(⍳∞)?
@AntonioNikishaev Can you give me a full TIO repro?
@AntonioNikishaev What does "unfold" mean?
ngn
ngn
@Adám i don't know, either something like that or a separate squiggle. in k they are just / and \. obviously, apl can't do that because it doesn't know the valence of functions in advance to tell apart "reduce" from "converge", and "scan" from "converge-iterate" (or whatever fancy name it has now)
18:34
@AntonioNikishaev aplcart.info/?q=iterate#
@AntonioNikishaev Thanks, I'll have a look.
@Adám like in Haskell, e. g. unfoldr (\x -> if x>0 then Just (-x, xdiv2) else Nothing) 42 is [-42,-21,-10,-5,-2,-1]. Here function returns (a) what elem goes to the result (-42), (b) the next state (xdiv2 aka {⌊⍵÷2}), (c) whether to stop (Just(v,state) or Nothing). Shouldn't be necessary that complex, but the idea is this.
ngn
ngn
18:48
⎕←{⍵>0:(-⍵),∇⌊⍵÷2⋄⍬}42
@ngn
¯42 ¯21 ¯10 ¯5 ¯2 ¯1
ngn
ngn
@AntonioNikishaev ^
@ngn yes... but why would I ever want a recursion? ;)
ngn
ngn
@AntonioNikishaev i can do it without recursion in k
well... -{2/x}\42 in k7. but we're talking about apl
ngn
ngn
18:58
that's not isomorphic to the haskell code above
k5/k6 could do -(-2!)\42 too
in apl: -{⍵,⌊2÷⍨⊃⌽⍵}⍣{0≥⊃⌽⍺}42 or -{∪⍵,⌊2÷⍨⊃⌽⍵}⍣≡42
@AntonioNikishaev hint at the behavior
@ngn that -x is not necessary, just a (simple) way to do unfoldr (\x -> if cond x then Just (x, next x) else Nothing) a₀ would be nice [But that's just me, and I'm only "using" APL for 2 weeks, so maybe I'm completely wrong]
ngn
ngn
@AntonioNikishaev afaik there's no simpler generic way to do unfoldr than the ones i mentioned above
and k's \ is just a special case of unfoldr in which the results (a) are the same as what's fed into the next iteration (b)
19:20
@dzaima thanks. That (almost) explains it. I specifically checked ⎕drs, but the docs for ⎕dr don't say anything about it trying to auto-compact.
 
1 hour later…
20:37
think i'm finally going to try to somewhat optimize my line parsing code. though it's fun, it's annoying to have to write everything performance-requesting in train form :/
20:49
@AntonioNikishaev I'll make sure we fix that. Thanks!
10 messages moved to ­Trash
 
2 hours later…
23:07
@Adám Can I use Variant to specify options for a user-defined function?
23:23
The help page doesn't mention how I could achieve it, but it doesn't say I can't either
(Just a random idea because writing "powmod" as pow⍠m or range function with optional step size n as to⍠n would be cool)
⎕←{⍵}⍠1⊢'abc'
23:42
@Bubbler
DOMAIN ERROR
Guess I can't...

« first day (1041 days earlier)      last day (1910 days later) »