From 64013639ca0dda8dd6484b262259cc87c8addd95 Mon Sep 17 00:00:00 2001 From: Marcus Rossel Date: Wed, 3 Apr 2024 21:04:54 +0200 Subject: [PATCH] Add example in doc comment of 'RecExpr' (#308) --- src/language.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/language.rs b/src/language.rs index 79f32c4d..23616387 100644 --- a/src/language.rs +++ b/src/language.rs @@ -369,7 +369,9 @@ impl LanguageChildren for Id { /// a list of enodes. /// /// [`RecExpr`]s must satisfy the invariant that enodes' children must refer to -/// elements that come before it in the list. +/// elements that come before it in the list. For example, the expression +/// `(+ (* x 5) x)` could be represented by a recursive expression of the form +/// `[Num(5), Var("x"), Mul(1, 0), Add(2, 1)]`. /// /// If the `serde-1` feature is enabled, this implements /// [`serde::Serialize`](https://docs.rs/serde/latest/serde/trait.Serialize.html).