Differences running HtDP programs from DrRacket IDE vs racket command line

136 views
Skip to first unread message

Nick Lee

unread,
Oct 5, 2020, 5:32:45 PM10/5/20
to Racket Users

Hello,
I noticed there are differences when I run HtDP programs in DrRacket IDE vs the "racket" command line.

For example, the following program's test passes in DrRacket IDE:

;; file.rkt - Set to Beginning Student
(check-expect (exact? (string->number "1.0")) true)

But when I run "raco test file.rkt", the test fails.

As another example, the follow Beginning Student program generates an error when run in DrRacket IDE (the error being read-syntax: illegal use of ```):

;; file.rkt - Set to Beginning Student
(define (quasiquote x) x)
(define (f x) 123)
`(f 888)

But when I run "racket file.rkt", no error is generated, and 123 is printed.

Is there a way I can run HtDP programs from the command-line and get behavior that's the same as when I click "Run" button in the IDE?

Thanks


Robby Findler

unread,
Oct 5, 2020, 9:16:35 PM10/5/20
to Nick Lee, Racket Users
On Mon, Oct 5, 2020 at 4:32 PM Nick Lee <nick.l...@gmail.com> wrote:

Hello,
I noticed there are differences when I run HtDP programs in DrRacket IDE vs the "racket" command line.

For example, the following program's test passes in DrRacket IDE:

;; file.rkt - Set to Beginning Student
(check-expect (exact? (string->number "1.0")) true)

But when I run "raco test file.rkt", the test fails.


This looks like a bug to me. Probably related is that this program prints #false and not #true.

#lang htdp/bsl

(exact? (string->number "1.0"))
 
As another example, the follow Beginning Student program generates an error when run in DrRacket IDE (the error being read-syntax: illegal use of ```):

;; file.rkt - Set to Beginning Student
(define (quasiquote x) x)
(define (f x) 123)
`(f 888)

But when I run "racket file.rkt", no error is generated, and 123 is printed.


This one behaves the same for me. It says "quasiquote: this name was defined in the language or a required library and cannot be re-defined".

 
Is there a way I can run HtDP programs from the command-line and get behavior that's the same as when I click "Run" button in the IDE?


This is supposed to work. Sorry for the bugs!

Robby
 

Nick Lee

unread,
Oct 6, 2020, 2:50:14 AM10/6/20
to Racket Users
Thank you very much Robby for the quick reply! I should have mentioned that our students are using Beginning Student by setting the Language to that, rather than adding #lang htdp/bsl. It appears this makes a difference. So the whole file looks like:

;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname file) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))

(define (quasiquote x) x)
(define (f x) 123)
`(f 888)


Running this file in command line with "racket file.rkt" doesn't show any errors for me. I'm using DrRacket 7.8 if it matters.

Robby Findler

unread,
Oct 6, 2020, 9:23:49 AM10/6/20
to Nick Lee, Racket Users
On Tue, Oct 6, 2020 at 1:50 AM Nick Lee <nick.l...@gmail.com> wrote:
Thank you very much Robby for the quick reply! I should have mentioned that our students are using Beginning Student by setting the Language to that, rather than adding #lang htdp/bsl.

Right, I got that. I merely meant to say that those are likely to be the same bug.
 
It appears this makes a difference. So the whole file looks like:

;; The first three lines of this file were inserted by DrRacket. They record metadata
;; about the language level of this file in a form that our tools can easily process.
#reader(lib "htdp-beginner-reader.ss" "lang")((modname file) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f)))
(define (quasiquote x) x)
(define (f x) 123)
`(f 888)


Running this file in command line with "racket file.rkt" doesn't show any errors for me. I'm using DrRacket 7.8 if it matters.


Ah, oops. I had mistakenly tested with BSL+. I see this error too, now.

Robby

Nick Lee

unread,
Oct 6, 2020, 10:04:23 AM10/6/20
to Racket Users
Thanks again Robby! I will create issues on the drracket github issues page.

Robby Findler

unread,
Oct 6, 2020, 12:16:06 PM10/6/20
to Nick Lee, Racket Users
Great! No guarantee, but probably this is the right repo: https://github.com/racket/htdp/issues

Robby


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/f86ec3c9-e0c3-4616-b242-cc419ef33059n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages