@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?
@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?
@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)
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
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)