[Jprogramming] How #: should have been designed
Raul Miller
rauldmiller at gmail.com
Tue Dec 13 23:21:50 HKT 2011
After some thought, I am in favor of this version (I think first
proposed by Henry):
((* * <&0) ,. #:) i:3
_1 0 1
_1 1 0
_1 1 1
0 0 0
0 0 1
0 1 0
0 1 1
#. ((* * <&0) ,. #:) i:3
_3 _2 _1 0 1 2 3
Note also:
2 | ((* * >&0) ,. #:) i:3
0 0 1
0 1 0
0 1 1
0 0 0
1 0 1
1 1 0
1 1 1
That said this could be further "improved" by making the #: result
follow the p. result pattern (least significant bit first):
(|.@#: ,. * * <&0) i:3
1 1 _1
1 0 _1
0 1 _1
0 0 0
1 1 0
1 0 0
0 1 0
(|.@#: , * * <&0)"0 i:3
1 0 _1
0 1 _1
1 _1 0
0 0 0
1 0 0
0 1 0
1 1 0
#.@|. :(#. |.)"1 (|.@#: ,. * * <&0) i:3
_1 _3 _2 0 3 1 2
#.@|. :(#. |.)"1 (|.@#: , * * <&0)"0 i:3
_3 _2 _1 0 1 2 3
2 p.~ (|.@#: , * * <&0)"0 i:3
_3 _2 _1 0 1 2 3
--
Raul
More information about the Programming
mailing list