[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

formerly <NEWLISP>TRYHARDER.TXT



i have removed the automatic spelling correctionfor movd, putd, getd,
setq etc on typein. instead i have replaced it with a new feature
which i ae been working on and which is very neat.

the feature looks much like the ? feature in that it is expliitly
involked after the fact, and is not always guaranteed
to be able to do anything. it is invokved via the old $ command
which is still used to specify a reexecution 
following an error so that you dont have to specify the target.
if an object to be substituted is also not specified,
e.g. user justtypes $ , or $ IN event spec, it means
"try harder".

the p.a. looks in the indicated event and begins processing it.
if it can find a form with quoted arguments, such that
car of the form has the property TRYHARDER on it, and 
one of the elements of this value apples, it will
perform the indicated transformation.

for example, on the propety list of GETPROPLIST is
the property ((GETPROPLIST ATM)). this may seem circular,
but in the case f the GETPROPLIST on the proprty, this
means that ATM (the argument to getproplist) is supposed to
have a property list, so that the system will try to coerce
the quoted argument to be such an atom, by spelling correction
against userwords. e.g.if i type
GETPROPLIST(FOOO) or (SETPROPLIST 'FIE (GETPROPLIST 'FOOO))
and then type $, the system will correcct FOOO to FOO.

here is a more interesting example:

on property list of GETPROP is
((GETPROPLIST ATM) (OR (MEMB PROP (PROPNAMES ATM)) (MEMB PROP SYSPROPS)))

this says to try to fix the first argument if quoted)
to be an atom with a property lit, and try to fix the second
argument so that it is either one of theproperties on
the list (PROPNAMES is simply (MAPLIST (GETPROPLIST X) (FUNCTION CAR)(FUNCTION
CDDR)))  and if that fails, then spelling correct against SYSPROPS.


here is another example:
on property list of SETQ is value ((BOUNDP XSET)).

this says that if the use types $, then the variable that
was set should (have been) bound at the time, i.e. not
a new variable. (for thi reason, before checking any of
the predicates, the system undoes the indicated event, and then
undoes that if it doesnt make any change). thus
if yu type SETQ(FOO --)  and then SETQ(FOOO --) and
notice that the syste didnt type (FOO RESET), you just
type $ and it unsets FOOO and fixes it to be FOO.

one fnal example:

on property list of EDITF is an expression like
(SOME FILELST (FUNCTION (LAMBDA (FL) (MEMB FN (FILEFNSLST FL]
in this case, i you type EDITF(MUMBLLE) and system
doesnt know abut MUMBLLE< thouh it is in one of the files
it knows abut, and you type $, it will correct MUMBLLE.

notice that the information on tryharder is in  declarative
form so thatit can be used first to check to see if th condition
already holds, and then to make it hold. i debated separating
thatout into two different expressions, but so far havent done so.
currently, tryharder knows about GETPROPLIST, GETD,
BOUNDP, MEMB, OR , and SOME, whic in fact covers a wide variety
of spelling correction situations.

the thing i like about this is that there are a lot of
places in the system where spelling correction is built in
because an error is going to occur anyway, but for something
like GETD(FOOO), NIL might in fact be a reasonable thing to
return. only the usr knows if he mistyped, so that being able
to quickly say tryharder seems like a win. the feature is
also useful for those cases where the system may not want
to try a really involved correction, e.g. mapping through
all of filelst to do a spelling correction, unless the user
expliitly instructs it to do so knowing thatit will succeed.


warren
-------