[racket] TLS "atom?" definition for Scheme does not work in DrRacket

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Mar 4 16:11:37 EST 2015

On Mar 4, 2015, at 1:18 PM, Rufus <rlaggren at mail.com> wrote:

> To All
> 
> Using BSL-Lists:
> 
> Matt't basic test works.
> 
> (define rufus 0)
> 
> Run, then type and execute "rufus" in the I-pane which displays 0
> 
> 
> 
> If I then add Alexander's example define so the def file appears as follows:
> ---------
> (define rufus 0)
> 
> (define atom? (lambda (arg1)
>                (and (not (pair? arg1))
>                     (not (null? arg1)))))
> -------------
> 
> and hit Run I get an error in the I-pane:
> 
> "pair?; this function is not defined".


It is called cons? not pair? because BSL and friends restrict it to list construction, like TLL. 


> 
> OK, so the BSL-Lists doesn't have that function. Then when I again type
> "rufus"/Enter in the I-pane I get an error "rufus; this variable is not
> defined"



When you have an error in a program, you get no interactions. You'd never know what these interactions really mean in the presence of an error in your definitions. 

0 == 1 



> So it appears the Run procedure deletes the existing environment before
> running the defs file and if it finds any error in the defs file it does
> not run _anything_ from that file. So "Run" will leave an empty
> environment (right word?) if there is any error in the defs file.

Yes. 

> On that note. It seems like the problems I've had relate directly to my
> leaving noobie errors in the defs file. My confusion about how the defs
> file code is Run - thinking that after a Run that throws and error
> either the old environment (from the last successful Run) would remain
> intact AND/OR that those lines which evaluate correctly in the new file
> would be run despite some errors on other lines in that particular file
> - slowed my understanding.
> 
> I believe that I do have a defs file w/errors which, on Run, does not
> cause an error to display in the I-panealthough it does delete the
> environment. I will try to recreate it this afternoon or evening.
> 
> As a last thought it still appears that the "#lang racket" yields better
> effect than the BSL-Lists when trying follow through the TLS because
> some functions shown in the TLS notes aimed at making examples and
> exercises work in Scheme (eg. pair?) are not defined in the BSL-Lists.
> Matt, I'm pretty sure you have reasons for recommending the BSL-Lists so
> maybe I'm missing something else?
> 
> Thank you all.
> 
> Rufus
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.