From 91bd7571dc0baf8d17047d553e4616dd587c0ffb Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 26 Sep 2009 13:49:18 +0000 Subject: * interp/: More cleanup. --- src/interp/termrw.boot | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/interp/termrw.boot') diff --git a/src/interp/termrw.boot b/src/interp/termrw.boot index 36380e04..937dcdf4 100644 --- a/src/interp/termrw.boot +++ b/src/interp/termrw.boot @@ -58,14 +58,14 @@ term1RW(t,R) == for r in varRules until not (SL='failed) repeat SL:= termMatch(CAR r,t,NIL,vars) not (SL='failed) => - t:= subCopy(copy CDR r,SL) + t:= subCopy(copy rest r,SL) t term1RWall(t,R) == -- same as term1RW, but returns a list [vars,:varRules]:= R - [not (SL='failed) and subCopy(copy CDR r,SL) for r in varRules | - not EQ(SL:= termMatch(CAR r,t,NIL,vars),'failed)] + [not (SL='failed) and subCopy(copy rest r,SL) for r in varRules | + not EQ(SL:= termMatch(first r,t,NIL,vars),'failed)] termMatch(tp,t,SL,vars) == -- t is a term pattern, t a term @@ -73,7 +73,7 @@ termMatch(tp,t,SL,vars) == tp=t => SL atom tp => MEMQ(tp,vars) => - p:= ASSOC(tp,SL) => ( CDR p=t ) + p:= ASSOC(tp,SL) => ( rest p=t ) CONS(CONS(tp,t),SL) 'failed atom t => 'failed @@ -93,14 +93,14 @@ termMatch(tp,t,SL,vars) == -- -- v must not be NIL -- EQ(v,t) => 'T -- atom t => NIL --- isContained(v,CAR t) or isContained(v,CDR t) +-- isContained(v,first t) or isContained(v,rest t) augmentSub(v,t,SL) == -- destructively adds the pair (v,t) to the substitution list SL -- t doesn't contain any of the variables of SL q:= CONS(v,t) null SL => [q] --- for p in SL repeat RPLACD(p,SUBSTQ(t,v,CDR p)) +-- for p in SL repeat RPLACD(p,SUBSTQ(t,v,rest p)) CONS(q,SL) mergeSubs(S1,S2) == @@ -108,8 +108,8 @@ mergeSubs(S1,S2) == -- S1 doesn't contain any of the variables of S2 null S1 => S2 null S2 => S1 - S3 := [p for p in S2 | not ASSQ(CAR p, S1)] --- for p in S1 repeat S3:= augmentSub(CAR p,CDR p,S3) + S3 := [p for p in S2 | not ASSQ(first p, S1)] +-- for p in S1 repeat S3:= augmentSub(first p,rest p,S3) APPEND(S1,S3) subCopy(t,SL) == @@ -119,7 +119,7 @@ subCopy(t,SL) == subCopy0(t,SL) subCopy0(t, SL) == - p := subCopyOrNil(t, SL) => CDR p + p := subCopyOrNil(t, SL) => rest p t subCopyOrNil(t,SL) == @@ -128,9 +128,9 @@ subCopyOrNil(t,SL) == atom t => NIL [t1,:t2]:= t t0:= subCopyOrNil(t1,SL) => - t2 => CONS(t, CONS(CDR t0, subCopy0(t2,SL))) - CONS(t,CONS(CDR t0,t2)) - t2 and ( t0:= subCopyOrNil(t2,SL) ) => CONS(t, CONS(t1,CDR t0)) + t2 => CONS(t, CONS(rest t0, subCopy0(t2,SL))) + CONS(t,CONS(rest t0,t2)) + t2 and ( t0:= subCopyOrNil(t2,SL) ) => CONS(t, CONS(t1,rest t0)) NIL @@ -141,17 +141,17 @@ deepSubCopy(t,SL) == deepSubCopy0(t,SL) deepSubCopy0(t, SL) == - p := deepSubCopyOrNil(t, SL) => CDR p + p := deepSubCopyOrNil(t, SL) => rest p t deepSubCopyOrNil(t,SL) == -- the same as subCopy, but the result is NIL if nothing was copied - p:= ASSOC(t,SL) => CONS(t, deepSubCopy0(CDR p, SL)) + p:= ASSOC(t,SL) => CONS(t, deepSubCopy0(rest p, SL)) atom t => NIL [t1,:t2]:= t t0:= deepSubCopyOrNil(t1,SL) => - t2 => CONS(t, CONS(CDR t0, deepSubCopy0(t2,SL))) - CONS(t,CONS(CDR t0,t2)) - t2 and ( t0:= deepSubCopyOrNil(t2,SL) ) => CONS(t, CONS(t1,CDR t0)) + t2 => CONS(t, CONS(rest t0, deepSubCopy0(t2,SL))) + CONS(t,CONS(rest t0,t2)) + t2 and ( t0:= deepSubCopyOrNil(t2,SL) ) => CONS(t, CONS(t1,rest t0)) -- cgit v1.2.3