PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, August 17, 2022

[FIXED] How to run a Racket program without output being quoted?

 August 17, 2022     output, quotation-marks, racket, scheme, string     No comments   

Issue

I have a basic Racket program:

hello.rkt:

(write "Hello, World!")

When I run it with racket -f hello.rkt, I get the following output:

"Hello, World!"

Is there a special compiler flag, or special version of "write/print" that removes the quotes from string output, so that it shows:

Hello, World!

Solution

The write function is the dual to read: it outputs (or at least attempts to output) datums that could be read back in to produce the original value. In my experiences, it is not often terribly useful even for that purpose, but it can be helpful when you’re debugging.

For actual output, the function you want is display. This outputs the actual data itself to the output port, not a formatted representation of it.


For completeness, Racket has an additional printing function, called print. Unlike display and write, print is explicitly designed to be used for debugging. Its output can be customized by a variety of different parameters, so the output format is uses it not necessarily predictable, and it shouldn’t be used for anything other than debugging. For that purpose, though, it’s quite useful.



Answered By - Alexis King
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing