pub fn to_string(&self) -> String {
        use self::SafasCell::*;

        match self {
            Nil                                                         => "()".to_string(),
            Atom(atom_id)                                               => name_for_atom_with_id(*atom_id),
            Boolean(value)                                              => if *value { "=t" } else { "=f" }.to_string(),
            Number(number)                                              => number.to_string(),
            BitCode(bitcode)                                            => format!("{}", hexdump(&bitcode_to_bytes(bitcode.iter().cloned()))),
            String(string_value)                                        => format!("\"{}\"", string_value),         // TODO: character quoting
            Char(chr_value)                                             => format!("'{}'", chr_value),              // TODO: character quoting,
            FrameReference(cell, frame, ReferenceType::Value)           => format!("cell#({},{})", cell, frame),
            FrameReference(cell, frame, ReferenceType::Monad)           => format!("monadcell#({},{})", cell, frame),
            FrameReference(cell, frame, ReferenceType::ReturnsMonad)    => format!("monadfncell#({},{})", cell, frame),
            Monad(cell, monad)                                          => format!("monad#{}#{}", cell.to_string(), monad.to_string()),
            FrameMonad(monad)                                           => monad.description(),
            Syntax(syntax, parameter)                                   => format!("compile#{}#{}", syntax.description(), parameter.to_string()),
            BoundSyntax(syntax)                                         => format!("bound_syntax#{:p}", syntax),
            Any(val)                                                    => format!("any#{:p}", val),
            Error(err)                                                  => format!("error#{:?}", err),
            BTree(_, _)                                                 => format!("btree#({}\n)", self.btree_to_string()),
            List(first, second)                                         => {
                let mut result  = format!("({}", first.to_string());
                let mut next    = second;

                loop {
                    match &**next {
                        Nil                 => { break; },
                        List(first, second) => {
                            result.push_str(&format!(" {}", first.to_string()));
                            next = second;
                        },
                        other               => {
                            result.push_str(&format!(" . {}", other.to_string()));
                            break;
                        }
                    }
                }

                result.push(')');

                result
            }
        }
    }
///
/// Converts this cell to a string
///
Converts this cell to a string
Converts this cell to a string
pub fn to_string(&self) -> String {
        use self::SafasCell::*;
        match self {
            Nil                                                         => "()".to_string(),
            Atom(atom_id)                                               => name_for_atom_with_id(*atom_id),
            Boolean(value)                                              => if *value { "=t" } else { "=f" }.to_string(),
            Number(number)                                              => number.to_string(),
            BitCode(bitcode)                                            => format!("{}", hexdump(&bitcode_to_bytes(bitcode.iter().cloned()))),
            String(string_value)                                        => format!("\"{}\"", string_value),         // TODO: character quoting
            Char(chr_value)                                             => format!("'{}'", chr_value),              // TODO: character quoting,
            FrameReference(cell, frame, ReferenceType::Value)           => format!("cell#({},{})", cell, frame),
            FrameReference(cell, frame, ReferenceType::Monad)           => format!("monadcell#({},{})", cell, frame),
            FrameReference(cell, frame, ReferenceType::ReturnsMonad)    => format!("monadfncell#({},{})", cell, frame),
            Monad(cell, monad)                                          => format!("monad#{}#{}", cell.to_string(), monad.to_string()),
            FrameMonad(monad)                                           => monad.description(),
            Syntax(syntax, parameter)                                   => format!("compile#{}#{}", syntax.description(), parameter.to_string()),
            BoundSyntax(syntax)                                         => format!("bound_syntax#{:p}", syntax),
            Any(val)                                                    => format!("any#{:p}", val),
            Error(err)                                                  => format!("error#{:?}", err),
            BTree(_, _)                                                 => format!("btree#({}\n)", self.btree_to_string()),
            List(first, second)                                         => {
                let mut result  = format!("({}", first.to_string());
                let mut next    = second;
                loop {
                    match &**next {
                        Nil                 => { break; },
                        List(first, second) => {
                            result.push_str(&format!(" {}", first.to_string()));
                            next = second;
                        },
                        other               => {
                            result.push_str(&format!(" . {}", other.to_string()));
                            break;
                        }
                    }
                }
                result.push(')');
                result
            }
        }
    }
pub fn to_string ( & self ) -> String { use self :: SafasCell :: * ; match self { Nil => " " . to_string ( ) , Atom ( atom_id ) => name_for_atom_with_id ( * atom_id ) , Boolean ( value ) => if * value { " " } else { " " } . to_string ( ) , Number ( number ) => number . to_string ( ) , BitCode ( bitcode ) => format ! ( " " hexdump ( bitcode_to_bytes ( bitcode iter ( ) cloned ( ) ) ) ) , String ( string_value ) => format ! ( " \" \" " string_value ) , // TODO: character quoting Char ( chr_value ) => format ! ( " " chr_value ) , // TODO: character quoting, FrameReference ( cell , frame , ReferenceType :: Value ) => format ! ( " " cell frame ) , FrameReference ( cell , frame , ReferenceType :: Monad ) => format ! ( " " cell frame ) , FrameReference ( cell , frame , ReferenceType :: ReturnsMonad ) => format ! ( " " cell frame ) , Monad ( cell , monad ) => format ! ( " " cell to_string ( ) monad to_string ( ) ) , FrameMonad ( monad ) => monad . description ( ) , Syntax ( syntax , parameter ) => format ! ( " " syntax description ( ) parameter to_string ( ) ) , BoundSyntax ( syntax ) => format ! ( " " syntax ) , Any ( val ) => format ! ( " " val ) , Error ( err ) => format ! ( " " err ) , BTree ( _ , _ ) => format ! ( " \n " self btree_to_string ( ) ) , List ( first , second ) => { let mut result = format ! ( " " first to_string ( ) ) ; let mut next = second ; loop { match & * * next { Nil => { break ; } , List ( first , second ) => { result . push_str ( & format ! ( " " first to_string ( ) ) ) ; next = second ; } , other => { result . push_str ( & format ! ( " " other to_string ( ) ) ) ; break ; } } } result . push ( ')' ) ; result } } }
Converts this cell to a string
Converts this cell to a string
&self
&self