Yeah, that does it. Thanks.

On Tuesday, December 6, 2016 at 3:33:30 PM UTC-2, Luis Sanjuán wrote:
> On Saturday, December 3, 2016 at 12:41:31 PM UTC+1, Fernando Basso wrote:
> > I am doing this course:
> > 
> > https://www.edx.org/xseries/how-code-systematic-program-design
> > 
> > It uses the Basic Student Language and they use DrRacket, which is fine. 
> > Still, I happen to also use other editors, like vim and emacs. With emacs, 
> > I use racket-mode and I am able to run tests with check-expect and things 
> > work fine.
> > 
> > Still, I have not been able to figure out how to make the repl print 
> > numbers with repeating decimal instead of fractions.
> > 
> > If I create a file in DrRacket itself and set the language to Basic Student 
> > Language, I can check "Details" in the "Choose Language" dialog and choose 
> > between fractions and repeating decimal. The resulting file then contains 
> > something like this:
> > 
> > #reader(lib "htdp-beginner-reader.ss" "lang")((modname area-tests) 
> > (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor 
> > repeating-decimal #f #t none #f () #f)))
> > 
> > My question is: why doesn't it work if I have that line on top of .rkt 
> > files and run the code from racket-mode (which invokes racket behind the 
> > scenes and opens the repl) or from the command line with `racket file.rkt`‽
> > 
> > In short, how can I get repeating decimals when I am not using DrRacket?
> > 
> > Thanks in advance for any help or insights.
> 
> Since your main issue is the final printing representation and you are on 
> BSL, the easiest way is to coerce the resulting number to inexact (that is 
> printed as decimal) by calling exact->inexact, which is also available from 
> BSL.
> 
> Example (from the REPL):
> 
> > (exact->inexact (/ 2 3))
> 0.6666666666666666

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to