perm filename SAMPLE.SES[206,LMM] blob sn#097613 filedate 1974-04-09 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	SAMPLE SESSION WITH PDP10
C00016 ENDMK
C⊗;
n. }

@TYPE <206LIB>NEWS.TXT	{See if there is anything new}
⊂...⊃ ↑C		{abort with ctrl-C}
@ILISP.SAV;12		{ this gets the UCI LISP system }


%DEFINE(((SUBSET(LAMBDA(X Y)(COND((MEMBER (BAR X)Y)(SUBSET (CDR X) Y))
% (T NIL]
(SUBSET)
{ This is a simple recursive (but wrong, as it turns out)
definition of SUBSET.  Let's try it }

%SUBSET((A B) (A B C D))
BAR
UNDEFINED FUNCTION

(BAR BROKEN)
1:USE CAR FOR BAR		{See UCI MANUAL, P. 1.10}


1:OK			{continue the computation}


NIL
{ That was the value of SUBSET. It should have been T.
Lets print out the function we have now by calling the
editor.}
%EDITF(SUBSET)

EDIT 
#PP

(LAMBDA (X Y) (COND ((MEMBER (CAR X) Y) (SUBSET (CDR X) Y)) (T NIL)))

{ Note that the "USE" command to the break monitor
above has changed the function definition automatically!
I don't understand my error yet. Let's try some more test
cases. }

#OK	{First exit the editor}
SUBSET 
%SUBSET ((A)(A))

NIL			{this should be T}
%SUBSET ((A) (B))

NIL			{well, this works! }
%SUBSET ((A) NIL)

NIL			{ This is the right answer }
{ let's try to figure out the trace facilities so we can 
figure out why we always get NIL.}
%TRACE(SUBSET)		{UCI MANUAL, P. 1.19}

(SUBSET) 
%SUBSET((A B)(C B A]
ENTER SUBSET:
!     X = (A B)
!     Y = (C B A)
!  ENTER SUBSET:
!  !     X = (B)
!  !     Y = (C B A)
!  !  ENTER SUBSET:
!  !  !     X = NIL
!  !  !     Y = (C B A)
!  !  SUBSET = NIL
!  SUBSET = NIL
SUBSET = NIL
NIL 

{ I see the problem now. If X is NIL then SUBSET
should return T.  We can put another clause at the front
of the COND clause }

{Oops, it's five o'clock! I have to go now, so I'll
save what I have and finish tomorrow}

%SET(FNLIST (SUBSET]

(SUBSET)
%DSKOUT((SAVEIT . LMM) FNLIST]

NIL
{ I should now have a file called saveit on my directory. }
%↑C		{ Now get back to EXEC by hitting ctrl-C }
@DIR		{ Let's see if my file is there by
		  printing out my directory }

   <nnLISP>
 INIT.LSP;3
 MESSAGE.TXT;1
 SAVEIT.LMM;1
  3 FILES, 3 PAGES

@TY SAVEIT.LMM

;  <nnLISP>SAVEIT.LMM;1   MON 8-APR-74 11:32PM        PAGE 1


(DEFPROP FNLIST
 (FNLIST SUBSET)
VALUE)

(DEFPROP SUBSET
 (LAMBDA (X Y) (COND ((MEMBER (CAR X) Y) (SUBSET (CDR X) Y)) (T NIL)))
EXPR)
↑L
{ That's my function! Now to logoff ... }

@K
 [CONFIRM] 
KILLED JOB 23, USER nnLISP, ACCT 206, TTY 22, AT  4/08/74 2333
  USED 0:0:8 IN 0:10:26

 STANFORD-TENEX 1.28;1, HELLO  EXEC: 3-26-74
@LOG 11LISP  206
⊂...⊃
@ILISP.SAV;12

%SKI↑U##		{abort line with ctrl-U}
%DSKIN((SAVEIT.LMM))	{ this gets my SUBSET back }
FNLIST 
SUBSET 
FILES-LOADED 
{ Now, let's fix up the definition }
%EDITF(SUBSET)

EDIT 
#P

(LAMBDA (X Y) (COND &  & ))
#3 P

(COND (&  & ) (T NIL))
#(-2 ((NULL X) T$
#PP

(COND ((NULL X) T) ((MEMBER (CAR X) Y) (SUBSET (CDR X) Y)) (T NIL))

#OK			{ This should work now }

SUBSET 
%SUBSET((A B)(C B A]

T			{ Hooray! }
%SUBSET((C)(A B))

NIL			{ Hooray! }
{ That does it. I'll save my results and quit now}
%DSKOUT((SAVEIT.LMM) FNLIST)	{ FNLIST still has its value }

NIL 
%↑C
@DIR *.LMM

   <nnLISP>
 SAVEIT.LMM;2,1
  2 FILES, 2 PAGES

@DEL SAVEIT.LMM;1 
@DIR,
@@DEL

   <nnLISP>
 SAVEIT.LMM;1
  1 FILES, 1 PAGES
{the only deleted file is mine; ignore MESSAGE.TXT if it is deleted}
@EXP
@K
 [CONFIRM] 
⊂...⊃