// Path: lang/src/main/java/mumbler/truffle/MumblerException.java
// public class MumblerException extends RuntimeException {
//     private static final long serialVersionUID = 1L;
// 
//     public MumblerException(String message) {
//         super(message);
//     }
// 
//     @Override
//     public Throwable fillInStackTrace() {
//         CompilerAsserts.neverPartOfCompilation();
//         return fillInMumblerStackTrace(this);
//     }
// 
//     public static Throwable fillInMumblerStackTrace(Throwable t) {
//         final List<StackTraceElement> stackTrace = new ArrayList<>();
//         Truffle.getRuntime().iterateFrames((FrameInstanceVisitor<Void>) frame -> {
//             Node callNode = frame.getCallNode();
//             if (callNode == null) {
//                 return null;
//             }
//             RootNode root = callNode.getRootNode();
// 
//             /*
//              * There should be no RootNodes other than SLRootNodes on the stack. Just for the
//              * case if this would change.
//              */
//             String methodName = "$unknownFunction";
//             if (root instanceof MumblerRootNode) {
//                 methodName = ((MumblerRootNode) root).name;
//             }
// 
//             SourceSection sourceSection = callNode.getEncapsulatingSourceSection();
//             Source source = sourceSection != null ? sourceSection.getSource() : null;
//             String sourceName = source != null ? source.getName() : null;
//             int lineNumber;
//             try {
//                 lineNumber = sourceSection != null ? sourceSection.getStartLine() : -1;
//             } catch (UnsupportedOperationException e) {
//                 /*
//                  * SourceSection#getLineLocation() may throw an UnsupportedOperationException.
//                  */
//                 lineNumber = -1;
//             }
//             stackTrace.add(new StackTraceElement("mumbler", methodName, sourceName, lineNumber));
//             return null;
//         });
//         t.setStackTrace(stackTrace.toArray(new StackTraceElement[stackTrace.size()]));
//         return t;
//     }
// }


import static java.util.Arrays.asList;
import java.util.Iterator;
import java.util.List;
import mumbler.truffle.MumblerException;
    }

    private MumblerList(T car, MumblerList<T> cdr) {
        this.car = car;
        this.cdr = cdr;
        this.length = cdr.length + 1;
    }

    @SafeVarargs
    public static <T> MumblerList<T> list(T... objs) {
        return list(asList(objs));
    }

    public static <T> MumblerList<T> list(List<T> objs) {
        @SuppressWarnings("unchecked")
        MumblerList<T> l = (MumblerList<T>) EMPTY;
        for (int i=objs.size()-1; i>=0; i--) {
            l = l.cons(objs.get(i));
        }
        return l;
    }

    public MumblerList<T> cons(T node) {
        return new MumblerList<T>(node, this);
    }

    public T car() {
        if (this != EMPTY) {
            return this.car;
        }
// Path: lang/src/main/java/mumbler/truffle/MumblerException.java
// public class MumblerException extends RuntimeException {
//     private static final long serialVersionUID = 1L;
// 
//     public MumblerException(String message) {
//         super(message);
//     }
// 
//     @Override
//     public Throwable fillInStackTrace() {
//         CompilerAsserts.neverPartOfCompilation();
//         return fillInMumblerStackTrace(this);
//     }
// 
//     public static Throwable fillInMumblerStackTrace(Throwable t) {
//         final List<StackTraceElement> stackTrace = new ArrayList<>();
//         Truffle.getRuntime().iterateFrames((FrameInstanceVisitor<Void>) frame -> {
//             Node callNode = frame.getCallNode();
//             if (callNode == null) {
//                 return null;
//             }
//             RootNode root = callNode.getRootNode();
// 
//             /*
//              * There should be no RootNodes other than SLRootNodes on the stack. Just for the
//              * case if this would change.
//              */
//             String methodName = "$unknownFunction";
//             if (root instanceof MumblerRootNode) {
//                 methodName = ((MumblerRootNode) root).name;
//             }
// 
//             SourceSection sourceSection = callNode.getEncapsulatingSourceSection();
//             Source source = sourceSection != null ? sourceSection.getSource() : null;
//             String sourceName = source != null ? source.getName() : null;
//             int lineNumber;
//             try {
//                 lineNumber = sourceSection != null ? sourceSection.getStartLine() : -1;
//             } catch (UnsupportedOperationException e) {
//                 /*
//                  * SourceSection#getLineLocation() may throw an UnsupportedOperationException.
//                  */
//                 lineNumber = -1;
//             }
//             stackTrace.add(new StackTraceElement("mumbler", methodName, sourceName, lineNumber));
//             return null;
//         });
//         t.setStackTrace(stackTrace.toArray(new StackTraceElement[stackTrace.size()]));
//         return t;
//     }
// }


// Path: lang/src/main/java/mumbler/truffle/type/MumblerList.java
import static java.util.Arrays.asList;
import java.util.Iterator;
import java.util.List;
import mumbler.truffle.MumblerException;

    }

    private MumblerList(T car, MumblerList<T> cdr) {
        this.car = car;
        this.cdr = cdr;
        this.length = cdr.length + 1;
    }

    @SafeVarargs
    public static <T> MumblerList<T> list(T... objs) {
        return list(asList(objs));
    }

    public static <T> MumblerList<T> list(List<T> objs) {
        @SuppressWarnings("unchecked")
        MumblerList<T> l = (MumblerList<T>) EMPTY;
        for (int i=objs.size()-1; i>=0; i--) {
            l = l.cons(objs.get(i));
        }
        return l;
    }

    public MumblerList<T> cons(T node) {
        return new MumblerList<T>(node, this);
    }

    public T car() {
        if (this != EMPTY) {
            return this.car;
        }
        throw new MumblerException("Cannot car the empty list");