1
.[string 10#.z.d;(til 10;4 7);:;"-"]

Does what I want; it replaces char 4 and 7 for each element in a list of dates with "-".

I seem to remember it being possible to elide the top level index (i.e. til 10) in some way. I would expect the below to work, but it doesn't:

.[string 10#.z.d;(0N;4 7);:;"-"]

How can I elide the top level index in dot-amend?

mollmerx
  • 648
  • 1
  • 5
  • 18

1 Answers1

2
q).[string 10#.z.d;(::;4 7);:;"-"]
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"
"2014-04-22"

Same behaviour as when indexing lists:

q)l:1 2 3
q)l[::]
1 2 3
Ryan Hamilton
  • 2,601
  • 16
  • 17
  • Perfect, thanks. Didn't realise the null had to be generic. The difference to `[]` indexing is that there, you can elide by just missing out the argument. e.g. `l[;42]` is enough, you don't need `l[::;42]` – mollmerx Apr 22 '14 at 20:58