-
Notifications
You must be signed in to change notification settings - Fork 1
Home
rdbyk edited this page Dec 4, 2020
·
133 revisions
- Use
typeinstead oftypeof, whenever possible. - Use
nargin,nargoutinstead ofargn. - Use
x==[]instead ofisempty(x), whenever possible. - Use
x<>[]instead of~isempty(x), whenever possible. - Use
issquareinstead ofsize, whenever possible. - Use
length(x)instead ofsize(x,'*'), whenever possible. - Use
x(length(x))orx(size(x,'*')instead ofx($), whenever possible. - Use
&&,||instead of&,|, whenever possible. - Use
~(A || B)instead of~A && ~B(cf. De Morgan's Laws). - Use
~(A && B)instead of~A || ~B(cf. De Morgan's Laws). - Use
execstrinstead ofevstr, whenever possible. - Use
tokensinstead ofstrsplit, whenever possible. - Use
matrix(A,length(A),1)instead ofA(:), whenever possible. - Use
A.Binstead ofA("B")orgetfield("B",A), whenever possible. - Use
ones(m,n).*.Ainstead ofrepmat(A,m,n), whenever possible. - Use
size(x)==1instead ofisscalar(x)orsize(x,'*')==1, whenever possible. - Use
A=[]instead ofA(:)=[], whenever possible. - Use
.*and./instead*of/for integer types, whenever possible. - Use
a & binstead ofbitand(a,b), whenever possible. - Use
a | binstead ofbitor(a,b), whenever possible. - Use
(a | b) & ~(a & b)instead ofbitxor(a,b), whenever possible. - Use
// Blah Blahonly sparingly (cf. #488). - Use
eye()instead ofeye(A)oreye(n,m), whenever possible. - Use
{}instead ofcell(), whenever possible. - Use
a+imult(b)instead ofcomplex(a,b), whenever possible. - Use
[f,e]=frexp(x)instead of[f,e]=log2(x), whenever possible. - Use
xinstead ofx<>0, whenever possible. - Use
x.^(1./n)instead ofnthroot(x,n), whenever possible. - Use
a+b*%iinstead ofcomplex(a,b)ora+imult(b), whenever possible. - Use
A(:,size(A,2):-1:1)instead offlipdim(A,2), whenever possible. - Use
A==Binstead ofisequal(A,B), whenever possible. - Use
list(A(:),B(:))instead oflstcat(A,B), whenever possible. - Use
a:(b-a)/(n-1):binstead oflinspace(a,b,n), whenever possible. - Use
strrchr(file,'.') instead offileparts(file,'extension')`, whenever possible. - Use
strncpy(x,n)instead ofpart(x,1:n), whenever possible. - Use
X=[]instead ofX(:)=[]orX(:,:,...)=[], whenever possible.
{1:$}~who()sleep 1a().b=11|who()atan(1,)cell(-1)sin{1}=11.*.eye()1./.eye()1.\.eye()imult(%s){1,2}'(1)1./int8(0)int8(0).\1x=1;x()=[]p=1:$;p(:)a(list())=1eye()/eye()eye()\eye()expm(eye()){list()(:)}if who(),endA=1;A(1,%nan)for i=1:$,endmin(eye(),"r")max(eye(),"r")struct("a",{})[null(),null()]ereduc(eye(),1)sprand(-1,1,.1)while who(),endfor w=who(),endisvector(list())cumsum(eye(),"r")sprand(1e3,1e3,1)sparse([1 0.5],1)cumprod(eye(),"r")fromJSON("{""""}")triu([%s+%i,1;1,1])covStart(["a";"b"])[insert(),insert()]write(6,1:3,"(I2)")matrix(1,ones(34,1))s.a=1;getfield("b",s)saveafterncommands(1)strsubst("","","","r")permute([2,2],40:-1:1)strsubst('aaa','aa','a')S=struct();S(2,2)=struct()L=list();L(2)=insert();L(1)u=["a","b"];v(1,:)=u,u(:,:)gcf().color_map=rand(2e6,3)a=struct("b",null());a.b=a.bsurf(1:2e3,1:2e3,(1:2e3)'*(1:2e3))x=tlist("x");function %x_s(a),end;-xf=gcf();xdel();save(TMPDIR+"/f.sod","f")deff('f(a,b)','plot2d(a,a,style=b)'),f(1,)A=ones(1000,1001);for i=1:1e4,try,inv(A),end,endC{1}=null();save("/tmp/T","C");clear("C");load("/tmp/T")
to be continued ...
-
%balisc- Useful to check whether it is Balisc, e.g. use
exists("%balisc"). - Returns a single integer (e.g.
0), which indicates the version of Balisc
- Useful to check whether it is Balisc, e.g. use
-
–- Shorthand for
void() - Ignore outputs of functions, e.g.
[–,b]=frexp(7.93)(cf. #1003)
- Shorthand for
-
bitpack,bitunpack -
errmsgs- Returns predefined error messages and associated error numbers
-
fflush- Flushes streams opened by
mopenorpopen
- Flushes streams opened by
-
flintmax- Return the largest integer that can be represented consecutively in a floating point value
-
funname -
funref -
inner- Move or create a variable to or in the inner (current) scope
-
intmax- Return the largest integer that can be represented in an integer type
-
intmin- Return the smallest integer that can be represented in an integer type
-
isprotected,protect,unprotect- Provide an interface to the protection mechanism of arbitrary variables
- They supersede
predefand are easy to use (cf. #420)
-
macrofile -
outer- Move or create a variable to or in the outer (previous) scope
-
popen- Executes a command and connects a pipe to the corresponding process
-
rmfield -
swapbytes -
typecast -
void
-
lstcatwas buggy and slow, uselist -
bitstringis a very specialized function and is (now) redundant- e.g. use
dec2base(typecast(%pi,'uint64'),2,64)instead ofbitstring(%pi)
- e.g. use
-
argnwas redundant and rather slow, usenarginandnargoutinstead.
-
getscilabkeywordsredundant, useisprotected,librarieslist,libraryinfo, ... -
predefhad limited functionality, useisprotected,protect,unprotect
-
banneruseless, nobody needs it -
funptroutdated and useless -
getURLredundant, usehttp_xxxfunctions -
oldEmptyBehaviourwas annoying, thus completely removed -
otherwiseundocumented and redundant, useelse -
predefhad limited functionality, useisprotected,protect,unprotect -
read_csvredundant, usecsvRead -
resumeredundant, usereturn -
splitURL, usemsscanffunction to do the job -
switchundocumented and redundant, useselect -
write_csvredundant, usecsvWrite