In J5.04 no-match also return shape 0 5,
But beware, 1!:0 for linux returns 6 columns not 5, eg,
1!:0 '/tmp'
+---+------------------+-----+---+------+----------+
|tmp|2008 6 30 11 41 22|12288|rwx|----d-|drwxrwxrwt|
+---+------------------+-----+---+------+----------+
Henry Rich wrote:
On 6.02, no-match does return shape 0 5:
$ 1!:0 '\bin\kdfslgjskd'
0 5
For concatenating such lists I use
endtoend =: 1 : ';@:(<@u)'
1!:0"0 endtoend 'C:\J\bin\*.dll';'C:\J\bin\*.ijs';'C:\J\bin\*.nonexist'
+---------------------+------------------+-------+---+------+
|j.dll |2008 3 4 10 0 36 |1642496|rw-|-----a|
+---------------------+------------------+-------+---+------+
|jnative.dll |2008 2 23 11 30 42|53248 |rw-|-----a|
+---------------------+------------------+-------+---+------+
|profile.ijs |2008 2 9 18 34 40 |1219 |rw-|-----a|
+---------------------+------------------+-------+---+------+
|profilex.ijs |2008 2 2 17 33 25 |783 |rw-|-----a|
+---------------------+------------------+-------+---+------+
|profilex_template.ijs|2008 2 9 18 41 0 |882 |rw-|-----a|
+---------------------+------------------+-------+---+------+
Henry Rich
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Saturday, June 28, 2008 11:55 PM
To: [email protected]
Subject: Re: [Jprogramming] Extra empty item from an empty table
Don Guinn wrote:
(2 2$;:'abc de fg h'),;2#<,:;:'ww xxxx'
(2 2$;:'abc de fg h'),;1#<,:;:'ww xxxx'
(2 2$;:'abc de fg h'),;0#<,:;:'ww xxxx'
Why is there a third item which is empty in the last case? Am I
misunderstanding something about append?
Take a look at the shapes of your three right sides, i.e.
;2#<,:;:'ww xxxx'
;1#<,:;:'ww xxxx'
;0#<,:;:'ww xxxx'
and compare this with the (much simpler) right sides
2 # ,: ;: 'ww xxxx'
1 # ,: ;: 'ww xxxx'
0 # ,: ;: 'ww xxxx'
which all append nicely.
Returning to your original problem: I consider the design of
1!:0 to be botched. I'd prefer it to return an empty 0 6 matrix
in the case of non-matches. Also, it should work on the
root directory as it does on any other directory. I always
have to code around these special cases. (The standard
'dir' wrapper doesn't extend nicely to empty matches, either.)
Martin
----------------------------------------------------------------------
For information about J forums see
http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm