Trying out match:
match=: I.@:E.
7 30 $ sc
872 1000 886 988 920 936 930 946 944 1004 1016 962 962 1136 914 1004 962
880 1022 946 944 1018 950 890 1000 1070 972 1026 980 978
946 944 1108 964 1002 878 956 966 1002 940 988 906 1028 988 1000 1046 980
948 1158 716 946 892 950 904 1110 832 838 916 976 874
926 938 1038 986 1016 850 868 936 840 800 970 1090 810 866 922 824 884 894
934 1108 958 902 858 878 832 916 1054 1012 908 794
846 1086 860 1046 956 924 928 1144 1004 792 984 986 1002 978 894 986 886
872 1054 954 1002 1098 922 822 940 842 894 982 798 962
1102 942 906 1122 926 946 920 996 1076 976 1022 912 988 1006 998 858 974
908 1018 964 910 946 940 948 1024 974 936 854 966 944
1026 950 898 980 904 944 976 936 840 1076 876 904 1114 874 974 920 888 846
982 1068 940 1024 1036 956 796 884 1058 886 838 1030
890 988 824 940 1038 948 1034 882 1054 1062 884 964 948 1002 1036 790 1050
960 1012 918 768 872 1000 886 988 920 936 930 946 944
sc1 =: , 7 30 $ sc
sc1
872 1000 886 988 920 936 930 946 944 1004 1016 962 962 1136 914 1004 962
880 1022 946 944 1018 950 890 1000 1070 972 1026 980 978 946 944 1108 964
1002 878 956 966 1002 940 988 906 1028 988 1000 1046 980 948 1158 716 946
892 950 904 1110 832 838 916 976 87...
$sc1
210
+/ 946 = sc1 How many 946's in sc1?
7
946 match sc1 NB. So we want to know where the 946's are.
NB. What gives? match doesn't see the 7 matches!
(sc1=946)#i.#sc1 NB. Try a different way.
7 19 30 50 125 141 208
946 match 50 {. sc1 NB. Try a smaller list of integers with match.
7 19 30 NB. That works.
946 match 100 {. sc1 NB. A little bigger works.
7 19 30 50
946 match 150 {. sc1 NB. Nope! match doesn't work on 150 integers.
946 944 match 50 {. sc1 NB. Let's try matching a short list of two
integers
7 19 30 NB. That works.
946 944 match 150 {. sc1
NB. That doesn't work.
It looks like match (I.@:E.) is limited to fairly small lists.
Skip
Skip Cave
Cave Consulting LLC
On Sun, Dec 18, 2016 at 3:38 PM, Henry Rich <[email protected]> wrote:
> match1 =: (#~ 1 < #@>)@:(]\ </. i.@((- <:)~ #))
>
>
> I changed the spec to produce a list of boxes, since there may be
> differing numbers of matches
>
> Henry Rich
>
>
>
> On 12/18/2016 3:32 PM, Skip Cave wrote:
>
>> aa =: 2 3 4 5 4 3 2 5 6 7 6 5 4 3 2 3 4 5 4
>>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm