# \#struct

**URL:** https://racket.discourse.group/tag/struct/118.md

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

---

## [Exporting a struct invariant contract](https://racket.discourse.group/t/exporting-a-struct-invariant-contract/3694)

<div class="topic-metadata">

**Author:** [@KevinW](https://racket.discourse.group/u/KevinW)\
**Replies:** 2\
**Last updated:** [April 18, 2025, 10:23pm UTC](https://racket.discourse.group/t/exporting-a-struct-invariant-contract/3694 "2025-04-18T22:23:45Z")

</div>

Hi, I'm trying to create a struct with a contract that involves a relationship between two fields. The struct needs to be exported. It seems like what I need is an "invariant contract" as in struct/dc: 8.1 Data-structur…

---

## [Partially override gen:custom-write for the display case only](https://racket.discourse.group/t/partially-override-gen-custom-write-for-the-display-case-only/3616)

<div class="topic-metadata">

**Author:** [@rvdalen](https://racket.discourse.group/u/rvdalen)\
**Replies:** 2\
**Last updated:** [March 11, 2025, 4:32am UTC](https://racket.discourse.group/t/partially-override-gen-custom-write-for-the-display-case-only/3616 "2025-03-11T04:32:59Z")

</div>

I am trying to customize the printing of a struct for the display case to something that displays more user-friendly but I am not sure how to express: "do the default action for print and write cases". Here is the code …

---

## [Function and macro to define unique values](https://racket.discourse.group/t/function-and-macro-to-define-unique-values/1097)

<div class="topic-metadata">

**Author:** [@sschwarzer](https://racket.discourse.group/u/sschwarzer)\
**Replies:** 9\
**Last updated:** [June 27, 2022, 5:29am UTC](https://racket.discourse.group/t/function-and-macro-to-define-unique-values/1097 "2022-06-27T05:29:33Z")

</div>

I've seen the idiom (struct unique-value ()) to create unique values, for example as default arguments in a function to check with (eq? argument unique-value) if anything was passed for the argument. Since I have only…

---

## [Custom equality predicate - in struct/gen:equal+hash or extra function?](https://racket.discourse.group/t/custom-equality-predicate-in-struct-gen-equal-hash-or-extra-function/1086)

<div class="topic-metadata">

**Author:** [@sschwarzer](https://racket.discourse.group/u/sschwarzer)\
**Replies:** 1\
**Last updated:** [June 19, 2022, 1:58am UTC](https://racket.discourse.group/t/custom-equality-predicate-in-struct-gen-equal-hash-or-extra-function/1086 "2022-06-19T01:58:12Z")

</div>

Assuming you have a struct (struct foo (a b c) #:transparent) and you want a custom equality predicate. For example, two foo instances should be equal? if their corresponding a and b fields are equal?, regardless of …
