예제 #1
0
        public static Atom ToAtom <T>(T t)
        {
            Type type = typeof(T);

            if (type == typeof(bool))
            {
                return(new Atom(AtomType.Bool, t));
            }
            if (type == typeof(string))
            {
                return(new Atom(AtomType.String, t));
            }
            if (UNumber.IsNumber(t))
            {
                return(new Atom(AtomType.Number, t));
            }
            if (type == typeof(Atom))
            {
                return(t as Atom);
            }
            if (type == typeof(List <Atom>))
            {
                return(ListToAtom(t as List <Atom>));
            }
            return(new Atom(AtomType.Native, t));
        }