s = sexpr(1, 2, 3) print(s) s = sexpr(1, 2, 3, nil) print(s) s = sexpr(sexpr(1, 2), sexpr(3, 4), nil) print(s) s = sexpr(mpz("100000000000000"), mpq(3)/2, sexpr(1, 2, 3, nil), nil) print(s) print(sexpr():is_nil()) print(sexpr(1):is_nil()) print(sexpr(true):is_bool()) print(sexpr(true):to_bool()) print(sexpr(false):to_bool()) check_error(function() sexpr(10):to_bool() end) print(sexpr(name("foo",1)):to_name()) check_error(function () print(sexpr(10):to_name()) end) print(sexpr(mpq(10)/3):to_mpq()) print(sexpr(mpz("10000000000000000000000000000000000")):to_mpz()) print(sexpr(10, 20, 30, 40, nil):length()) print(sexpr(10, 20, nil):head()) print(sexpr(10, 20, nil):tail()) print(sexpr(10, 20):head()) print(sexpr(10, 20):tail()) check_error(function () sexpr(10):head() end) check_error(function () sexpr(10):tail() end) check_error(function () sexpr(10):to_mpz() end) check_error(function () sexpr(10):to_mpq() end) check_error(function () sexpr(10):to_string() end) check_error(function () sexpr(10):to_bool() end) check_error(function () sexpr(10):to_double() end) print(sexpr("hello"):to_string())