Re: Missing in misc.e
- Posted by Pete Lomax <petelomax at blueyo?der.co.uk> Jul 20, 2007
- 709 views
Juergen Luethje wrote: > They are not necessary, because it's so easy to write > }}} <eucode> > minVal = y > if x < y then > minVal = x > end if > </eucode> {{{ False. I use min and max all the time: C:\Program Files\Edita\eacca.e:95 baseline=Min(selY,CursorY) C:\Program Files\Edita\eacolor.ew:427 y=Max(MAXnColours-4,18)*20+95 C:\Program Files\Edita\eacolor.ew:522 y+=Max(0,16-MAXnColours)*20+40 C:\Program Files\Edita\eaerror.ew:258 pukkaWidth=Max(dX+30,200) -- set initial width C:\Program Files\Edita\eamisc.e:53 global function Min(integer a, integer b) C:\Program Files\Edita\eamisc.e:58 global function Max(integer a, integer b) C:\Program Files\Edita\eaqj.ew:83 setIndex(ROUTINELIST, Min(ind+5,tally)) C:\Program Files\Edita\easynld.e:573 bracelevel=Min(ch-'0',7) C:\Program Files\Edita\eaundo.ew:269 mY=Min(selY,CursorY) C:\Program Files\Edita\eaundo.ew:270 mX=Min(selX,CursorX) C:\Program Files\Edita\eaundo.ew:286 CursorX=Min(selX,CursorX) C:\Program Files\Edita\edita.exw:964 paintRqd=Min(paintRqd,Min(linefrom,lineto)) C:\Program Files\Edita\edita.exw:966 paintLast=Max(paintLast,Max(linefrom,lineto)) C:\Program Files\Edita\edita.exw:969 paintRqd=Min(linefrom,lineto) C:\Program Files\Edita\edita.exw:970 paintLast=Max(linefrom,lineto) C:\Program Files\Edita\edita.exw:2711 for idx = Min(ixFrom,ixTo) to Max(ixFrom,ixTo) do C:\Program Files\Edita\edita.exw:3355 CursorY=Min(selY,CursorY) C:\Program Files\Edita\edita.exw:3356 cX=Min(selX,CursorX) C:\Program Files\Edita\edita.exw:3374 cY=Min(selY,CursorY) C:\Program Files\Edita\edita.exw:3375 cX=Min(selX,CursorX) C:\Program Files\Edita\edita.exw:3376 sX=Max(selX,CursorX) C:\Program Files\Edita\edita.exw:4699 CursorY = Min(adjustLine(CursorY,+linesPerPage,CursorX),filelen-1) C:\Program Files\Edita\edita.exw:5112 newY = Min(adjustLine(TopLine,linesPerPage-1,TopChunk),length(filetext[currfile])-1) C:\Program Files\Edita\edita.exw:5244 CursorY = Min(length(filetext[currfile])-1, C:\Program Files\Edita\edita.exw:5248 CursorY = Min(adjustLine(TopLine,floor((y-ClipRect[2])/CharHeight),TopChunk), C:\Program Files\Edita\edita.exw:5281 CursorX = Min(Column+floor((x-ClipRect[1]-foldMargin)/CharWidth), C:\Program Files\Edita\edita.exw:5383 Min(Column+floor((x-ClipRect[1])/CharWidth), C:\Program Files\Edita\edita.exw:5385 Min(adjustLine(TopLine,floor((y-ClipRect[2])/CharHeight),TopChunk), C:\Program Files\Edita\edita.exw:6914 CursorY = Min(adjustLine(TopLine,screenY,CursorX),length(filetext[currfile])-1) C:\Program Files\Edita\edita.exw:6918 -- CursorY = Min(adjustLine(CursorY,+linesPerPage,CursorX),filelen-1) > And as I already wrote: > | If they actually are going to be implemented, then their names IMHO > | should be min2() and max2() (because they compare 2 values). This is > | easier to remember. > For me it is pretty ingrained that min() takes two parameters and returns the smaller. Finding the smallest element of an arbitrary length list is a much rarer thing, and even rarer still to want the value not the idx IMHO. Regards, Pete