Wednesday, October 19, 2016

This is why we have lamda

####  Helpers
SIndex = lambda j : ("%d.0")%(j)
DPtr = lambda str,chr : str.find(chr,0,len(str))
Atom = lambda x,y : x[0:DPtr(x,y)-1]
iLine = lambda index : int(index[0:DPtr(index,'.')])
iChar = lambda index : int(index[DPtr(index,'.')-1:3])
WFormat = lambda s1,s2 : ("%s      %s\n") % (s1, s2)
SLine = lambda i : SourceText.get(SIndex(i),SIndex(i+1))

See how I build up the assemblage scheme for handling indices and grabbing lines of code from the fake text box.   I use these all over, if you look.

Atom is a macro, return a delimited symblol, the actual characters even.  WFormat is my standard watch window format.  I read and wtite the watch windo, ity is both my display and dictionary.

A lot of function calls are simple re-assemblages making arguments match between interfaces.  Lambda works just find, and looking ay the list, we can something of a translation list, easily visible.

exec(Sline(1))

means execute the first line of code.  All it did was format indices, do one call to get,after two or three layers of macro.  This is an old microsoft trick, but it goes way back farther.

I better list the issues in the debugger

It does not know line continuation.  In fact, I don't. haven;t learnt it.
Generally the way to avoid long lines is avoid comments and use lamda.
Somethings did not yet work, like the interpreter could not find StringVar.set, I have to get on that.
At the end of code, it will happily step blank lines to the interpreter.
There is no centering function in the source window, so if you are off screen, the scroll bars work.
The line number is not compared to the line nuber eval thinks of.  They likely march,but I have to put in check on that.
Run does not work, only step.  I a thinking of something clever for run.
It only counts tabs as block delimiters, but that will be fixed soon.

No comments: