# Questions & Answers

**URL:** https://racket.discourse.group/c/questions/6.md?page=21

[Latest](https://racket.discourse.group/latest.md) · [Categories](https://racket.discourse.group/categories.md) · [Tags](https://racket.discourse.group/tags.md)

**Page:** 22

---

## [Replacing lexical context in a macro](https://racket.discourse.group/t/replacing-lexical-context-in-a-macro/2004)

<div class="topic-metadata">

**Author:** [@rscho](https://racket.discourse.group/u/rscho)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 2:43pm UTC](https://racket.discourse.group/t/replacing-lexical-context-in-a-macro/2004 "2023-06-13T14:43:46Z")

</div>

Hi, I'm trying to do something about typed/racket issue #1286, and hopefully racket/math issue #75 at some point. I patched require/untyped-contract as below: (define-syntax (require/untyped-contract stx) (syntax-par…

---

## [Unable to use parser-tools/lex::lexer with in-port](https://racket.discourse.group/t/unable-to-use-parser-tools-lex-lexer-with-in-port/1982)

<div class="topic-metadata">

**Author:** [@rscho](https://racket.discourse.group/u/rscho)\
**Replies:** 3\
**Last updated:** [June 8, 2023, 11:42pm UTC](https://racket.discourse.group/t/unable-to-use-parser-tools-lex-lexer-with-in-port/1982 "2023-06-08T23:42:31Z")

</div>

Hi, I may be missing something, but I think this fails when it should yield a list. This expression makes racket enter an infinite loop, due to an apparent conflict between in-port and lexer: (require parser-tools/lex)…

---

## [How do I convert a list written on a text field from string to list?](https://racket.discourse.group/t/how-do-i-convert-a-list-written-on-a-text-field-from-string-to-list/1945)

<div class="topic-metadata">

**Author:** [@louberlu](https://racket.discourse.group/u/louberlu)\
**Replies:** 4\
**Last updated:** [June 1, 2023, 9:28am UTC](https://racket.discourse.group/t/how-do-i-convert-a-list-written-on-a-text-field-from-string-to-list/1945 "2023-06-01T09:28:07Z")

</div>

I'm not an English native, so if there are any mistakes, please correct me. I have written a program that take an arithmetic expression and reduce it. It takes a list and return a list like this one: '((a + 2) \* b). The …

---

## [Articles in scribble](https://racket.discourse.group/t/articles-in-scribble/1970)

<div class="topic-metadata">

**Author:** [@joskoot](https://racket.discourse.group/u/joskoot)\
**Replies:** 2\
**Last updated:** [May 31, 2023, 7:46am UTC](https://racket.discourse.group/t/articles-in-scribble/1970 "2023-05-31T07:46:12Z")

</div>

Scribble may render an article at the end of a line (depending of the width of the window), but in my taste this is ugly. I prefer This is an article. Over This is an article Is there tool that automatically conve…

---

## [Newline in scribble/manual interaction](https://racket.discourse.group/t/newline-in-scribble-manual-interaction/1969)

<div class="topic-metadata">

**Author:** [@joskoot](https://racket.discourse.group/u/joskoot)\
**Replies:** 2\
**Last updated:** [May 30, 2023, 5:38pm UTC](https://racket.discourse.group/t/newline-in-scribble-manual-interaction/1969 "2023-05-30T17:38:04Z")

</div>

\#lang scribble/manual @(require scribble/eval) @interaction\['aap (newline) (printf " ~n") 'noot\] Yields: No newline written. Not a big problem, I can write (printf " n").

---

## [Code compression options](https://racket.discourse.group/t/code-compression-options/908)

<div class="topic-metadata">

**Author:** [@LiberalArtist](https://racket.discourse.group/u/LiberalArtist)\
**Replies:** 5\
**Last updated:** [May 27, 2023, 1:38pm UTC](https://racket.discourse.group/t/code-compression-options/908 "2023-05-27T13:38:38Z")

</div>

A while ago, someone asked me this question about Chez code compression options when building Racket: Would it be an option to instead turn off compression and keep doing things as usual? In theory, this should be…

---

## [Correctly using directory scope to install packages](https://racket.discourse.group/t/correctly-using-directory-scope-to-install-packages/1921)

<div class="topic-metadata">

**Author:** [@Occhioverde](https://racket.discourse.group/u/Occhioverde)\
**Replies:** 4\
**Last updated:** [May 21, 2023, 7:39am UTC](https://racket.discourse.group/t/correctly-using-directory-scope-to-install-packages/1921 "2023-05-21T07:39:14Z")

</div>

Good morning. I'm currently experimenting with directory scope in Raco with the objective of managing packets in a more efficient way, but I'm stuck with a strange behavior that I can't seem to understand just by lookin…

---

## [How to distribute programs that require Gregor?](https://racket.discourse.group/t/how-to-distribute-programs-that-require-gregor/1948)

<div class="topic-metadata">

**Author:** [@Dexter](https://racket.discourse.group/u/Dexter)\
**Replies:** 7\
**Last updated:** [May 21, 2023, 12:21pm UTC](https://racket.discourse.group/t/how-to-distribute-programs-that-require-gregor/1948 "2023-05-21T12:21:41Z")

</div>

Hello there, I had asked a question related to Gregor, and the fact that it is not currently possible to run a Racket program compiled on one system with Gregor on another system, if Gregor and Racket haven't been insta…

---

## [Accessing C constants from Racket](https://racket.discourse.group/t/accessing-c-constants-from-racket/1933)

<div class="topic-metadata">

**Author:** [@shawnw](https://racket.discourse.group/u/shawnw)\
**Replies:** 6\
**Last updated:** [May 21, 2023, 6:53am UTC](https://racket.discourse.group/t/accessing-c-constants-from-racket/1933 "2023-05-21T06:53:49Z")

</div>

The scenario: Trying to use the Racket FFI to call a C functions that have arguments whose values should be taken from one or more #define'd constants, that might be different numbers on different OSes, making just hard-…

---

## [Function not reading all the element in a list](https://racket.discourse.group/t/function-not-reading-all-the-element-in-a-list/1918)

<div class="topic-metadata">

**Author:** [@louberlu](https://racket.discourse.group/u/louberlu)\
**Replies:** 10\
**Last updated:** [May 13, 2023, 7:11pm UTC](https://racket.discourse.group/t/function-not-reading-all-the-element-in-a-list/1918 "2023-05-13T19:11:30Z")

</div>

Hi, I am not an English native, so, if you see any fault or incoherence, please correct me. I'm currently learning SCHEME language, and our teacher told us to create two programs: one which counts the number of occurre…

---

## [MB at the right in the status line of DrRacket](https://racket.discourse.group/t/mb-at-the-right-in-the-status-line-of-drracket/1934)

<div class="topic-metadata">

**Author:** [@joskoot](https://racket.discourse.group/u/joskoot)\
**Replies:** 2\
**Last updated:** [May 13, 2023, 10:52am UTC](https://racket.discourse.group/t/mb-at-the-right-in-the-status-line-of-drracket/1934 "2023-05-13T10:52:51Z")

</div>

What amount of memory is shown at the right in the status line of DrRacket? The Task Manager of Windows always shows a consumption of 200 to 300 MB more, even immediately after opening DrRacket without file.

---

## [How to reuse current-input-port after piping input from stdin](https://racket.discourse.group/t/how-to-reuse-current-input-port-after-piping-input-from-stdin/1926)

<div class="topic-metadata">

**Author:** [@LessThanZero](https://racket.discourse.group/u/LessThanZero)\
**Replies:** 7\
**Last updated:** [May 13, 2023, 5:47am UTC](https://racket.discourse.group/t/how-to-reuse-current-input-port-after-piping-input-from-stdin/1926 "2023-05-13T05:47:09Z")

</div>

Consider this test.rkt program: #lang racket (let loop () (display "\> ") (define input (read-line)) (displayln input) (loop)) When invoked as racket test.rkt it will just display whatever it gets from stdin: …

---

## [Finding srcloc for modules in fully-expanded code](https://racket.discourse.group/t/finding-srcloc-for-modules-in-fully-expanded-code/1932)

<div class="topic-metadata">

**Author:** [@greghendershott](https://racket.discourse.group/u/greghendershott)\
**Replies:** 2\
**Last updated:** [May 10, 2023, 5:25pm UTC](https://racket.discourse.group/t/finding-srcloc-for-modules-in-fully-expanded-code/1932 "2023-05-10T17:25:26Z")

</div>

TL;DR: I can't figure out how to get original srclocs for spliced module+ forms in fully-expanded code. Background: Racket Mode has a run command much like Dr Racket: Run the module for the file, as well as optionally …

---

## [Create New data types](https://racket.discourse.group/t/create-new-data-types/1911)

<div class="topic-metadata">

**Author:** [@mohanr](https://racket.discourse.group/u/mohanr)\
**Replies:** 6\
**Last updated:** [May 9, 2023, 2:09am UTC](https://racket.discourse.group/t/create-new-data-types/1911 "2023-05-09T02:09:51Z")

</div>

Hi, I tried to port a Haskell data type to racket. Can I create these types ? What is the equivalent racket structure ? (define-struct Error i e (\[ errorOffset : Offset \] \[ error : ErrorType…

---

## [Racket Mode emacs, test coverage not working on match?](https://racket.discourse.group/t/racket-mode-emacs-test-coverage-not-working-on-match/1898)

<div class="topic-metadata">

**Author:** [@jlucero805](https://racket.discourse.group/u/jlucero805)\
**Replies:** 4\
**Last updated:** [May 6, 2023, 2:50pm UTC](https://racket.discourse.group/t/racket-mode-emacs-test-coverage-not-working-on-match/1898 "2023-05-06T14:50:41Z")

</div>

In racket-mode for emacs, there is a command racket-test, that can be run with test coverage using C-u C-u C-c C-t (Racket Mode). When running this, everything gets covered, besides match expressions. When using other …

---

## [How to set the stderr correctly?](https://racket.discourse.group/t/how-to-set-the-stderr-correctly/1922)

<div class="topic-metadata">

**Author:** [@Antigen-11](https://racket.discourse.group/u/Antigen-11)\
**Replies:** 2\
**Last updated:** [May 5, 2023, 12:21pm UTC](https://racket.discourse.group/t/how-to-set-the-stderr-correctly/1922 "2023-05-05T12:21:41Z")

</div>

According to the racket reference, When provided as a port, stdout is used for the launched process’s standard output, stdin is used for the process’s standard input, and stderr is used for the process’s standard error…

---

## [Is typed racket compilation slow when using prefab structs?](https://racket.discourse.group/t/is-typed-racket-compilation-slow-when-using-prefab-structs/1904)

<div class="topic-metadata">

**Author:** [@sebas](https://racket.discourse.group/u/sebas)\
**Replies:** 9\
**Last updated:** [May 2, 2023, 6:24pm UTC](https://racket.discourse.group/t/is-typed-racket-compilation-slow-when-using-prefab-structs/1904 "2023-05-02T18:24:12Z")

</div>

I was trying to write an AST using something like this: (define-type Exp (U Const Op ...)) (struct Const (...) #:prefab) without prefab it is ok, but when I added prefab it takes more than a minute from clicking Run t…

---

## [Can I change keyword syntax?](https://racket.discourse.group/t/can-i-change-keyword-syntax/1907)

<div class="topic-metadata">

**Author:** [@RobertC](https://racket.discourse.group/u/RobertC)\
**Replies:** 1\
**Last updated:** [May 1, 2023, 7:39pm UTC](https://racket.discourse.group/t/can-i-change-keyword-syntax/1907 "2023-05-01T19:39:44Z")

</div>

I'm new and poking around in the docs. Is there a way to adjust the language so that keywords are :foo, instead of #:foo? I really like using keyword arguments, but I don't like the look of the latter.

---

## [For\* remains looping when an inner suequence already is empty](https://racket.discourse.group/t/for-remains-looping-when-an-inner-suequence-already-is-empty/1901)

<div class="topic-metadata">

**Author:** [@joskoot](https://racket.discourse.group/u/joskoot)\
**Replies:** 3\
**Last updated:** [May 1, 2023, 7:46am UTC](https://racket.discourse.group/t/for-remains-looping-when-an-inner-suequence-already-is-empty/1901 "2023-05-01T07:46:38Z")

</div>

Consider: #lang racket/base (define r '()) (time (for\* ((i (in-range 10000000)) (k (in-list r))) (writeln (list i k)))) (time (for\* ((i (in-range 1 )) (k (in-list r))) (writeln (list i k)))) Produces: cpu time: …

---

## [Coordinate \`generator?\` with \`eval\`?](https://racket.discourse.group/t/coordinate-generator-with-eval/1900)

<div class="topic-metadata">

**Author:** [@Antigen-11](https://racket.discourse.group/u/Antigen-11)\
**Replies:** 4\
**Last updated:** [May 1, 2023, 12:20am UTC](https://racket.discourse.group/t/coordinate-generator-with-eval/1900 "2023-05-01T00:20:45Z")

</div>

I want to use eval to produce a generator and enforce generator? on the result of the evaluation. But it seems that the result is just an ordinary procedure instead of a generator. Welcome to Racket v8.8.0.8 \[cs\]. \> (d…

---

## [Function contracts for multiple return values](https://racket.discourse.group/t/function-contracts-for-multiple-return-values/284)

<div class="topic-metadata">

**Author:** [@badkins](https://racket.discourse.group/u/badkins)\
**Replies:** 13\
**Last updated:** [April 27, 2023, 1:26pm UTC](https://racket.discourse.group/t/function-contracts-for-multiple-return-values/284 "2023-04-27T13:26:43Z")

</div>

I would like to specify the following (which doesn't work) for the return values of a function: (or/c (values t1 t2) (values t3 t4)) In other words, I'd like to verify that either the function returns two values …

---

## [Macro syntax error in some Scheme](https://racket.discourse.group/t/macro-syntax-error-in-some-scheme/1895)

<div class="topic-metadata">

**Author:** [@damien\_mattei](https://racket.discourse.group/u/damien_mattei)\
**Replies:** 2\
**Last updated:** [April 27, 2023, 1:15pm UTC](https://racket.discourse.group/t/macro-syntax-error-in-some-scheme/1895 "2023-04-27T13:15:02Z")

</div>

hello, why this macro good for Guile is not correct for Racket or Chicken: (define-macro (quote-all . Largs) (if (null? Largs) \`(quote ,Largs) \`(cons (quote ,(car Largs)) (quote-all ,@(cdr Largs))))) err…

---

## [Unable to create a Windows registry 'folder'](https://racket.discourse.group/t/unable-to-create-a-windows-registry-folder/1893)

<div class="topic-metadata">

**Author:** [@Dexter](https://racket.discourse.group/u/Dexter)\
**Replies:** 4\
**Last updated:** [April 26, 2023, 10:23pm UTC](https://racket.discourse.group/t/unable-to-create-a-windows-registry-folder/1893 "2023-04-26T22:23:51Z")

</div>

I tried every possible combination of params to write-resource to no avail. All I want to do is create a folder in HKEY\_CLASSES\_ROOT, and write entries into it. I tried: (write-resource "HKEY\_CLASSES\_ROOT\\\\MyFolder" "…

---

## [Feedback for glossary entry on formatting/print/write/display](https://racket.discourse.group/t/feedback-for-glossary-entry-on-formatting-print-write-display/1877)

<div class="topic-metadata">

**Author:** [@sschwarzer](https://racket.discourse.group/u/sschwarzer)\
**Replies:** 15\
**Last updated:** [April 21, 2023, 3:01pm UTC](https://racket.discourse.group/t/feedback-for-glossary-entry-on-formatting-print-write-display/1877 "2023-04-21T15:01:12Z")

</div>

I'm currently preparing the Racket Glossary entry for formatting and showing Racket values. My current notes are here. (The title for the entry may change; but I'm not yet sure to what. :wink: .) I've read most of the c…

---

## [How to programmatically generate a newline using scribble-slideshow?](https://racket.discourse.group/t/how-to-programmatically-generate-a-newline-using-scribble-slideshow/1869)

<div class="topic-metadata">

**Author:** [@janus](https://racket.discourse.group/u/janus)\
**Replies:** 0\
**Last updated:** [April 15, 2023, 10:55pm UTC](https://racket.discourse.group/t/how-to-programmatically-generate-a-newline-using-scribble-slideshow/1869 "2023-04-15T22:55:31Z")

</div>

I am generating code listings in Scribble that I highlight myself. Example: todo list I have been using (make-element 'newline '()) to generate newlines which work when rendered to HTML, but when shown in slideshow, the…

---

## [What's the easiest way to experience TCR in DrRacket?](https://racket.discourse.group/t/whats-the-easiest-way-to-experience-tcr-in-drracket/1862)

<div class="topic-metadata">

**Author:** [@danprager](https://racket.discourse.group/u/danprager)\
**Replies:** 3\
**Last updated:** [April 13, 2023, 10:07pm UTC](https://racket.discourse.group/t/whats-the-easiest-way-to-experience-tcr-in-drracket/1862 "2023-04-13T22:07:24Z")

</div>

Is there a neat way to try out the TCR (Test & Commit or Revert) in Dr Racket? TCR test && commit || revert is an alternative programming workflow similar to TDD. Run the tests after every change. If they pass, commit.…

---

## [Can Racket programs be modified at run time?](https://racket.discourse.group/t/can-racket-programs-be-modified-at-run-time/1839)

<div class="topic-metadata">

**Author:** [@Decabytes](https://racket.discourse.group/u/Decabytes)\
**Replies:** 2\
**Last updated:** [March 27, 2023, 4:40pm UTC](https://racket.discourse.group/t/can-racket-programs-be-modified-at-run-time/1839 "2023-03-27T16:40:54Z")

</div>

I was thinking about how to write gui programs whose behaviors and features could be modified by beginner programmers and non-programmers. I think scheme would be a great language for this as it's much smaller than a lot…

---

## [Supress reader abbreviation in scribble interaction](https://racket.discourse.group/t/supress-reader-abbreviation-in-scribble-interaction/1830)

<div class="topic-metadata">

**Author:** [@joskoot](https://racket.discourse.group/u/joskoot)\
**Replies:** 3\
**Last updated:** [March 24, 2023, 5:55pm UTC](https://racket.discourse.group/t/supress-reader-abbreviation-in-scribble-interaction/1830 "2023-03-24T17:55:48Z")

</div>

In general it is nice that scribble/manual applies reader abbreviations, but in some cases I want to suppress abbreviation, especially in an interaction. I have made several attempts like (interaction #:eval (…

---

## [Scribble library for exam creation?](https://racket.discourse.group/t/scribble-library-for-exam-creation/1831)

<div class="topic-metadata">

**Author:** [@jbclements](https://racket.discourse.group/u/jbclements)\
**Replies:** 0\
**Last updated:** [March 24, 2023, 5:26pm UTC](https://racket.discourse.group/t/scribble-library-for-exam-creation/1831 "2023-03-24T17:26:38Z")

</div>

I'm still using an ancient exam construction framework based on (a) a bunch of relatively simple TeX macros that I got from Matthias, (b) Dorai Sitaram's slatex, and (c) a cheap-hack scribble language that expands into T…

---

## [Can I reliably use integers directly as indices for immutable hash table iteration?](https://racket.discourse.group/t/can-i-reliably-use-integers-directly-as-indices-for-immutable-hash-table-iteration/1776)

<div class="topic-metadata">

**Author:** [@MartianMoorGrove](https://racket.discourse.group/u/MartianMoorGrove)\
**Replies:** 16\
**Last updated:** [March 21, 2023, 2:29am UTC](https://racket.discourse.group/t/can-i-reliably-use-integers-directly-as-indices-for-immutable-hash-table-iteration/1776 "2023-03-21T02:29:23Z")

</div>

For immutable hash tables, can I reliably use integers ranged 0 to (- (hash-count ht) 1) directly as indices for the hash-iterate- variant procedures rather than return indices from hash-iterate-first and hash-iterate-ne…

[Previous page](https://racket.discourse.group/c/questions/6.md?page=20)

[Next page](https://racket.discourse.group/c/questions/6.md?page=22)
