1use std::any::Any;
6use std::rc::Rc;
7
8pub type Obj = Rc<dyn Any>;
10
11#[derive(Eq, PartialEq)]
12pub struct Name(pub String);
13
14pub struct Pair(pub Obj, pub Obj);
16
17pub fn nil() -> Obj {
19 Rc::new(())
20}
21
22pub fn boolean(b: bool) -> Obj {
24 Rc::new(b)
25}
26
27pub fn int(n: i64) -> Obj {
29 Rc::new(n)
30}
31
32pub fn string(s: String) -> Obj {
34 Rc::new(s)
35}
36
37pub(crate) fn name(s: String) -> Obj {
39 Rc::new(Name(s))
40}
41
42pub fn pair(car: Obj, cdr: Obj) -> Obj {
44 Rc::new(Pair(car, cdr))
45}