private static void Open(Evaluator eval, StackFrame frame)
        {
            var(path, accessType, modeType) = StructureUtils.Split3(frame.args);

            if (path == null || !path.IsString)
            {
                throw new ArgumentException("Path must be string!");
            }
            string file = (string)path.value;

            FileAccess access = ArgUtils.GetEnum <FileAccess>(accessType, 1, FileAccess.Read);
            FileMode   mode   = ArgUtils.GetEnum <FileMode>(modeType, 2, FileMode.Open);

            if (access == FileAccess.Read)
            {
                StreamReader reader = new StreamReader(File.Open(file, mode, access));

                eval.Return(new Atom(AtomType.Native, reader));
                return;
            }

            if (access == FileAccess.Write)
            {
                StreamWriter writer = new StreamWriter(File.Open(file, mode, access));

                eval.Return(new Atom(AtomType.Native, writer));
                return;
            }

            eval.Return(null);
        }
        private static void ReadDirectory(Evaluator eval, StackFrame frame)
        {
            Atom args = frame.args;

            Atom path = args?.atom;

            if (path == null || !path.IsString)
            {
                throw new ArgumentException("Path must be string!");
            }
            string       directory = (string)path.value;
            Atom         pattern   = args?.next?.atom;
            Atom         mode      = args?.next?.next?.atom;
            SearchOption option    = ArgUtils.GetEnum <SearchOption>(mode, 3);

            string[] dirs = null;
            if (pattern == null)
            {
                dirs = Directory.GetDirectories(directory);
            }
            else
            {
                dirs = Directory.GetDirectories(directory, (string)pattern.value, option);
            }

            string[] files = null;
            if (pattern == null)
            {
                files = Directory.GetFiles(directory);
            }
            else
            {
                files = Directory.GetFiles(directory, (string)pattern.value, option);
            }

            Atom[] elements = new Atom[dirs.Length + files.Length];
            for (int i = 0; i < dirs.Length; i++)
            {
                elements[i] = new Atom(AtomType.String, dirs[i]);
            }
            for (int i = 0; i < files.Length; i++)
            {
                elements[i + dirs.Length] = new Atom(AtomType.String, files[i]);
            }

            eval.Return(StructureUtils.List(elements));
        }