From 7d700662132fb32a65372ef977598c1899f4ec47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Tue, 31 Mar 2026 04:09:52 +0200 Subject: [PATCH] feat(expr): from fixed sized array to Expr --- lispers-core/src/lisp/expression.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lispers-core/src/lisp/expression.rs b/lispers-core/src/lisp/expression.rs index e7dbce6..08dd417 100644 --- a/lispers-core/src/lisp/expression.rs +++ b/lispers-core/src/lisp/expression.rs @@ -192,6 +192,18 @@ impl From> for Expression { } } +impl From<[Expression; N]> for Expression { + fn from(mut value: [Expression; N]) -> Self { + let mut current = Expression::Nil; + + for e in value.iter_mut().rev() { + current = Expression::Cell(Box::new(e.to_owned()), Box::new(current)); + } + + current + } +} + impl From<(Expression, Expression)> for Expression { fn from(value: (Expression, Expression)) -> Self { Expression::Cell(Box::new(value.0), Box::new(value.1))