-
Notifications
You must be signed in to change notification settings - Fork 1
Home
rdbyk edited this page Aug 2, 2018
·
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.
%t./%fsleep 1eye()\1(1:2):31:2:3:4min(1,)a().b=11:null()cell(-1)1.*.eye()1./.eye()1.\.eye()1./int8(0)1:insert()x=[];x()=1x=1;x()=[]sparse(1,1)eye()/eye()eye()\eye()expm(eye())p=%s;p{1}=1s="";s{1}=1{list()(:)}speye(-1,-1)if who(),endx(0:1)=1;x=2mprintf("%%")msprintf("%%")min(eye(),"r")max(eye(),"r")spzeros(-2,-1)[null(),null()]ereduc(eye(),1)sprand(-1,1,.1)while who(),endfor w=who(),end-
read(%io(1),1,1)+ [RETURN] cumsum(eye(),"r")sprand(1e3,1e3,1)cumprod(eye(),"r")fromJSON("{""""}")triu([%s+%i,1;1,1])covStart(["a";"b"])[insert(),insert()]write(6,1:3,"(I2)")strsubst("","","","r")s=speye(2,2);s(s==0)=1strsubst('aaa','aa','a')S=struct();S(2,2)=struct()surf(1:2e3,1:2e3,(1:2e3)'*(1:2e3))f=gcf();xdel();save(TMPDIR+"/f.sod","f")function f(),ver()(1,2),end;macr2tree(f)a={%s};p=TMPDIR+"/a.sod";save(p,"a");listvarinfile(p)
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
-
isprotected,protect,unprotect- Provide an interface to the protection mechanism of arbitrary variables
- They supersede
predefand are easy to use (cf. #420)