return list of list on c# from IronScheme

92 Views Asked by At

I want return a list in Visual Studio but, only print IronScheme.Runtime.Cons on visual studio console.

I have this code

    public void f1()
        {
            var exp = "(car '((1 (8 7 2) 3) 4 5 6))"; // this must eval as "(1 (8 7 2) 3)"
            var result = exp.Eval<Cons>(); 

            var list = result.Cast<string>().ToList();

          /*  foreach(string value in list)
            {
                Console.WriteLine(list);
            }
          */
        }

the above code show System.InvalidCastException, I want return the list as a string like a:
"(1 (8 7 2) 3)" or a List<string>, but this dont work :(

1

There are 1 best solutions below

0
On

The schemish way :)

var exp = "(car '((1 (8 7 2) 3) 4 5 6))";
var result = "(format \"~a\" {0})".Eval<string>(exp);
Console.WriteLine(result);