# Cond different in definitions and interactions of DrRacket

**URL:** <https://racket.discourse.group/t/cond-different-in-definitions-and-interactions-of-drracket/1586>\
**Category:** Questions & Answers\
**Tags:** drracket\
**Created:** [December 31, 2022, 12:15am UTC](https://racket.discourse.group/t/cond-different-in-definitions-and-interactions-of-drracket/1586 "2022-12-31T00:15:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joskoot](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joskoot/32/1964_2.png) [@joskoot](https://racket.discourse.group/u/joskoot)\
**Post date:** [December 31, 2022, 12:15am UTC](https://racket.discourse.group/t/cond-different-in-definitions-and-interactions-of-drracket/1586/1 "2022-12-31T00:15:11Z")

</div>

DrRacket version 7.8 (both CS and BC), Windows 10.

In definitions window:  
(not running it, background expansion enabled) or  
(back-ground expansion disabled and running it):  
(cond (#t 'monkey) (is this ignored?)) --\> exception is: unbound identifier in: is

In interactions-window followed by return key:  
(cond (#t 'monkey) (is this ignored?)) --\> monkey

Is this intentional behaviour?  
If not I'll be happy to issue an issue.  
It's not a hot issue, though, I think.

---

<div class="post-metadata">

**Author:** ![sorawee](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sorawee](https://racket.discourse.group/u/sorawee)\
**Post date:** [December 31, 2022, 12:50am UTC](https://racket.discourse.group/t/cond-different-in-definitions-and-interactions-of-drracket/1586/2 "2022-12-31T00:50:36Z")

</div>

This is intentional behavior.

In the interaction window, you can incrementally evaluate expressions. So in a state, you might evaluate an expression that has a forward reference, but that reference has no corresponding definition _yet_. Here is an example.

```scheme
> (define (even? x)
    (cond [(zero? x) #t] [else (odd? (sub1 x))])) 

;; --> at this point, odd? is not yet defined

> (define (odd? x)
    (cond [(zero? x) #f] [else (even? (sub1 x))]))

;; --> at this point, odd? is defined

```

Racket REPL wants to support this, so it must tolerate the situation.

In a module, there is no incrementality. So in:

```scheme
#lang racket
(define (even? x)
  (cond [(zero? x) #t] [else (odd? (sub1 x))]))

```

Racket can conclude immediately that `odd?` is unbound.

What you observed is a consequence of this difference in the REPL / module.

---

<div class="post-metadata">

**Author:** ![joskoot](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joskoot/32/1964_2.png) [@joskoot](https://racket.discourse.group/u/joskoot)\
**Post date:** [December 31, 2022, 9:41am UTC](https://racket.discourse.group/t/cond-different-in-definitions-and-interactions-of-drracket/1586/3 "2022-12-31T09:41:38Z")

</div>

Thanks, I did not think of that, stupid me, for i have heard the story earlier.
