Skip to content

Commit 40b4559

Browse files
committed
Removed XC (histcounts) and its associated predefined literals (X7)
The reasons, as stated in the doc, are as follows. `histc`. would be a little redundant; compare histc(x,unique(x)) with 8\#u or SY'; or compare histc(x,y) with !=s. Besides, MATLAB's histc is deprecated and replaced by histcounts. The latter works differently; and I preferred the old histc behaviour: given x = [10 20 30 20 30], histcounts(x,unique(x)) gives [1 4] whereas histc(x,unique(x)) gives [1 2 2].
1 parent 10ee866 commit 40b4559

File tree

14 files changed

+36
-36
lines changed

14 files changed

+36
-36
lines changed

funDef.mat

-408 Bytes
Binary file not shown.

funDef.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ XB 1 1 1 1 1 1 true true true true if ~iscell(in{1}) convert from binary to de
611611
YB 1 2 1 2 1 1 1 true true true true out{1} = dec2bin(in{:}); convert decimal number to binary string \matlab|dec2bin|. \sa \matl|B|
612612
ZB 1 1 1 1 1 1 true true true true out{1} = bin2dec(in{1}); convert binary string to decimal number \matlab|bin2dec|. \sa \matl|XB|
613613
C
614-
XC 1 7 2 1 3 1 true true true true [out{:}] = histcounts(in{:}); histogram bin counts \matlab+histcounts+
614+
XC
615615
YC 2 4 2 1 1 1 true true true true if numel(in{2})==1, if size(in{1},1)==1, in{2} = [1 in{2}]; else in{2} = [in{2} 1]; end; end rearrange array blocks into columns \matlab+im2col+. If the second input is a scalar \matlab+n+, it is transformed into \matlab+[1 n]+ if the first input is a row vector, or to \matlab+[n 1]+ otherwise. First input can also be a cell array. \sa \matl+ZC+
616616
if iscell(in{1})
617617
x = reshape(1:numel(in{1}), size(in{1}));

help.mat

-87 Bytes
Binary file not shown.

outtakes/funDef_Outtakes.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@ U 1 1 1 1 1 1 true true true true if ~ischar(in{1}), in{1} = char(in{1}); end
137137
y = [];
138138
end
139139
out{1} = y; clear ok r valid
140-
Z= 3 3 3 1 1 1 true true true true if isnumeric(in{1}), in{1} = char(in{1}); end; if isnumeric(in{2}), in{2} = char(in{2}); end; out{1} = strncmp(in{:}); compare first characters of strings \matlab+strncmp+. If first or second inputs are numeric they are converted to char
140+
Z= 3 3 3 1 1 1 true true true true if isnumeric(in{1}), in{1} = char(in{1}); end; if isnumeric(in{2}), in{2} = char(in{2}); end; out{1} = strncmp(in{:}); compare first characters of strings \matlab+strncmp+. If first or second inputs are numeric they are converted to char
141+
XC 1 7 2 1 3 1 true true true true [out{:}] = histcounts(in{:}); histogram bin counts \matlab+histcounts+

outtakes/preLit_Outtakes.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
X7
2+
3+
1 'BinWidth'
4+
2 'BinLimits'
5+
3 'Normalization'
6+
4 'count'
7+
5 'probability'
8+
6 'countdensity'
9+
7 'pdf'
10+
8 'cumcount'
11+
9 'cdf'
12+
10 'BinMethod'
13+
11 'auto'
14+
12 'scott'
15+
13 'fd'
16+
14 'integers'
17+
15 'sturges'
18+
16 'sqrt'
19+
20+
121
X9
222

323
1 'shuffle'

preLit.mat

-239 Bytes
Binary file not shown.

preLit.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,6 @@ X6
127127
35 'notpacked'
128128

129129

130-
X7
131-
132-
1 'BinWidth'
133-
2 'BinLimits'
134-
3 'Normalization'
135-
4 'count'
136-
5 'probability'
137-
6 'countdensity'
138-
7 'pdf'
139-
8 'cumcount'
140-
9 'cdf'
141-
10 'BinMethod'
142-
11 'auto'
143-
12 'scott'
144-
13 'fd'
145-
14 'integers'
146-
15 'sturges'
147-
16 'sqrt'
148-
149-
150130
X8
151131

152132
1 'cityblock'

spec/MATL_spec.aux

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@
8383
\newlabel{case: 2nd input: help}{{3}{37}{Usage\relax }{Item.11}{}}
8484
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Example of parsed code with automatic comments\relax }}{38}{figure.caption.6}}
8585
\newlabel{fig: code with automatic comments}{{1}{38}{Example of parsed code with automatic comments\relax \relax }{figure.caption.6}{}}
86-
\@writefile{toc}{\contentsline {subsection}{\numberline {9.2}Structure}{38}{subsection.9.2}}
87-
\newlabel{parte: compiler structure}{{9.2}{38}{Structure\relax }{subsection.9.2}{}}
8886
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Example of command-line help\relax }}{39}{figure.caption.7}}
8987
\newlabel{fig: help}{{2}{39}{Example of command-line help\relax \relax }{figure.caption.7}{}}
88+
\@writefile{toc}{\contentsline {subsection}{\numberline {9.2}Structure}{39}{subsection.9.2}}
89+
\newlabel{parte: compiler structure}{{9.2}{39}{Structure\relax }{subsection.9.2}{}}
9090
\@writefile{toc}{\contentsline {section}{\numberline {10}Compatibility with Octave}{41}{section.10}}
9191
\newlabel{parte: compatibility with Octave}{{10}{41}{Compatibility with Octave\relax }{section.10}{}}
9292
\@writefile{toc}{\contentsline {subsection}{\numberline {10.1}Compiler}{41}{subsection.10.1}}
@@ -95,13 +95,13 @@
9595
\newlabel{parte: online}{{11}{46}{Running MATL online\relax }{section.11}{}}
9696
\@writefile{toc}{\contentsline {section}{\numberline {12}Example programs explained}{46}{section.12}}
9797
\newlabel{parte: example programs explained}{{12}{46}{Example programs explained\relax }{section.12}{}}
98-
\@writefile{toc}{\contentsline {subsection}{\numberline {12.1}Example 1: infinite loop}{46}{subsection.12.1}}
98+
\@writefile{toc}{\contentsline {subsection}{\numberline {12.1}Example 1: infinite loop}{47}{subsection.12.1}}
9999
\@writefile{toc}{\contentsline {subsection}{\numberline {12.2}Example 2: first 10 Fibonacci numbers}{47}{subsection.12.2}}
100100
\@writefile{toc}{\contentsline {subsection}{\numberline {12.3}Example 3: unique characters from string in original order}{47}{subsection.12.3}}
101-
\@writefile{toc}{\contentsline {subsection}{\numberline {12.4}Example 4: unique characters from string in original order, manual approach}{47}{subsection.12.4}}
101+
\@writefile{toc}{\contentsline {subsection}{\numberline {12.4}Example 4: unique characters from string in original order, manual approach}{48}{subsection.12.4}}
102102
\@writefile{toc}{\contentsline {section}{\numberline {13}Acknowledgments}{48}{section.13}}
103-
\@writefile{toc}{\contentsline {section}{Appendix \numberline {A}Detailed function definitions}{49}{Appendix.a.A}}
104-
\newlabel{parte: list of functions}{{A}{49}{Detailed function definitions\relax }{Appendix.a.A}{}}
103+
\@writefile{toc}{\contentsline {section}{Appendix \numberline {A}Detailed function definitions}{50}{Appendix.a.A}}
104+
\newlabel{parte: list of functions}{{A}{50}{Detailed function definitions\relax }{Appendix.a.A}{}}
105105
\@writefile{lot}{\contentsline {table}{\numberline {6}{\ignorespaces Function definitions}}{50}{table.6}}
106106
\newlabel{tab: funDef}{{6}{50}{Detailed function definitions\relax }{table.6}{}}
107107
\gdef \LT@i {\LT@entry
@@ -221,5 +221,5 @@
221221
{1}{127.09738pt}\LT@entry
222222
{1}{23.69952pt}\LT@entry
223223
{1}{125.09738pt}}
224-
\@writefile{lot}{\contentsline {table}{\numberline {7}{\ignorespaces Output of predefined literal functions\relax }}{69}{table.caption.8}}
225-
\newlabel{tab: preLit}{{7}{69}{Output of predefined literal functions\relax \relax }{table.caption.8}{}}
224+
\@writefile{lot}{\contentsline {table}{\numberline {7}{\ignorespaces Output of predefined literal functions\relax }}{70}{table.caption.8}}
225+
\newlabel{tab: preLit}{{7}{70}{Output of predefined literal functions\relax \relax }{table.caption.8}{}}

spec/MATL_spec.pdf

-62 Bytes
Binary file not shown.

spec/MATL_spec.tex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ \section{Table of functions}
10441044
\item
10451045
\matlab+issorted+: it can be easily realized by comparing with the result of \matlab+sort+. Of course \matlab+issorted+ would be more time-efficient, but time efficiency is not the main purpose of code golf.
10461046
\item
1047-
\matlab+rem+: probably having \matlab+mod+ is enough.
1047+
\matlab+rem+: having \matlab+mod+ is probably enough.
10481048
\item
10491049
matrix inverse: not used very often; and can be done with \matlab+eye+ and matrix division
10501050
\item
@@ -1061,6 +1061,8 @@ \section{Table of functions}
10611061
\matlab+strcmpi+: there's \matlab+strcmp+.
10621062
\item
10631063
\matlab+convmtx+: \matlab+convmtx(x,n)+ can be realized as \matlab+conv2(x, eye(n))+.
1064+
\item
1065+
\matlab+histcounts+ / \matlab+histc+: \matlab+histc+ would be a little redundant; compare \matlab+histc(x,unique(x))+ with \matl{8\#u} or \matl{SY'}; or compare \matlab+histc(x,y)+ with \matl{!=s}. Besides, MATLAB's \matlab+histc+ is deprecated and replaced by \matlab+histcounts+. The latter works differently; and I preferred the old \matlab+histc+'s behaviour: given \matlab+x = [10 20 30 20 30]+, \matlab+histcounts(x,unique(x))+ gives \matlab+[1 4]+ whereas \matlab+histc(x,unique(x))+ gives \matlab+[1 2 2]+.
10641066
\end{itemize}
10651067

10661068
%Remove these?

0 commit comments

Comments
 (0)