# Running format procedure code example results in error

**URL:** https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051
**Category:** Questions & Answers
**Tags:** question
**Created:** [December 22, 2025, 6:34am UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051 "2025-12-22T06:34:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![a-user](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@a-user](https://racket.discourse.group/u/a-user)
#### Post date: [December 22, 2025, 6:34am UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/1 "2025-12-22T06:34:52Z")

</div>

Typing one of the code example for format in DrRacket returns error.

Racket version: 9.0  
Language: BSL  
Documentation link: [format](https://docs.racket-lang.org/htdp-langs/beginner.html#(def._htdp-beginner._((lib._lang%252Fhtdp-beginner..rkt)._format)))

Code: `(format "the value of ~s is ~a" '(+ 1 1) (+ 1 1))`  
Error: `quote: expected the name of a symbol or () after the quote, but found a part`

---

<div class="post-metadata">

### Author: ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)
#### Post date: [December 22, 2025, 7:18am UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/2 "2025-12-22T07:18:46Z")

</div>

`'(+ 1 1)` is beyond the BSL level. The only valid syntax is [having `name` or a `()` after `'`](https://docs.racket-lang.org/htdp-langs/beginner.html#%28form._%28%28lib._lang%2Fhtdp-beginner..rkt%29._quote%29%29), e.g., `'apple`. So this works:

```scheme
#lang htdp/bsl
(define apple "🍎")
(format "the value of ~a is ~s" 'apple apple)

```

But not this:

```scheme
(format "the value of ~s is ~a" '(+ 1 1) (+ 1 1))

```

To allow expressions like `'(+ 1 1)`, the minimum level needed is [**Beginning Student with List Abbreviations**](https://docs.racket-lang.org/htdp-langs/beginner-abbr.html):

```scheme
#lang htdp/bsl+
(format "the value of ~s is ~a" '(+ 1 1) (+ 1 1))

```

---

<div class="post-metadata">

### Author: ![a-user](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@a-user](https://racket.discourse.group/u/a-user)
#### Post date: [December 22, 2025, 8:18am UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/3 "2025-12-22T08:18:21Z")

</div>

> [@shhyou](#):
>
> ```scheme
> (format "the value of ~s is ~a" '(+ 1 1) (+ 1 1))
> 
> ```

Thank you for the quick reply. I guess the documentation for BSL format needs to be updated to remove that particular example.

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [December 22, 2025, 2:11pm UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/4 "2025-12-22T14:11:23Z")

</div>

Take a look. The [grammar of BSL](https://docs.racket-lang.org/htdp-langs/beginner.html#(def._htdp-beginner._((lib._lang%252Fhtdp-beginner..rkt)._format))) allows ' (quote) in two places:

- '()
- 'name

That's it.

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [December 22, 2025, 2:15pm UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/5 "2025-12-22T14:15:20Z")

</div>

Following up on my own post:

I see the `format` comes with this misleading example.  
Thanks for pointing out this example. I have removed it.

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/4e853055ae989ed00f69341cd98bee95980776c4.png) [@system](https://racket.discourse.group/u/system)
#### Post date: [December 29, 2025, 6:59am UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/6 "2025-12-29T06:59:36Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/4e853055ae989ed00f69341cd98bee95980776c4.png) [@system](https://racket.discourse.group/u/system)
#### Post date: [December 29, 2025, 8:18am UTC](https://racket.discourse.group/t/running-format-procedure-code-example-results-in-error/4051/7 "2025-12-29T08:18:29Z")

</div>


