« first day (45 days earlier)      last day (1490 days later) » 

8:27 AM
Does “reverse” literally reverse the array in memory? Or does it just reverse the way the array is accessed?
 
@chrispsn that'd be implementation specific (in general i'd guess it really reverses), but you could test it by checking if it takes any time at all to reverse a huge array
 
@chrispsn I guess it returns a copy of a new value. Unless it does something similar to: archive.vector.org.uk/art10501160 (strided representation). That would require to store meta-information (attributes) for each array. I think this is only done for dicts/tables.
You could also check the memory usage. Is there a command in k7?
 
8:50 AM
@chrispsn when would it really be useful that reverse didn't actually reverse? k doesn't have multidimensional arrays so multiple reverses couldn't be chained together, otherwise, is there anything much beyond *| that'd benefit?
 
 
1 hour later…
10:05 AM
@dzaima I did have *| in mind - maybe also drop?
 
@chrispsn for a few special cases i think having some kind of idiom interpreting would be more useful than new array types & slowing down everything else
e.g. Dyalog special-cases ⊃⌽ (k's *|) to be O(1) even though alone is O(n)
 
Ok. And maybe reversing to drop is an anti pattern anyway - take (n-x) elements better?
 
10:23 AM
that's the problem with a limited builtin/character set - small compromises often have to be made
 
And maybe k’s increasing set of “deferred execution” primitives will allow a similar approach to Dyalog’s proposed thunks to replace idiom recognition reddit.com/r/apljk/comments/a4vue8/thunks_in_apl/…
 
@chrispsn thunks would be like your initial suggestion of not reversing the array but marking it as reversed. imo both usage of thunks & idioms is good as there are things both do well (and k has the advantage that it's immediately parsable making idioms much more powerful)
I have thought of making reverse wrappers for my apl before and ngn initially even had those in his
 
 
3 hours later…
ngn
1:55 PM
@chrispsn *| will be optimised in k7 - see this email. *| is currently the only optimised "digraph" in ngn/k
 
 
3 hours later…
4:56 PM
@ngn ah! Good catch
 
 
6 hours later…
ngn
11:17 PM
mini-challenge: multiset difference, eg: f["seventeen";"there"] -> "svneen". order is not significant in the result. you can assume that the inputs are strings. shorter is better. use any dialect of k. (source)
 

« first day (45 days earlier)      last day (1490 days later) »