import lab import sys import json import pytest TEST_DIRECTORY = os.path.dirname(__file__) class NotImplemented: def __eq__(self, other): return False try: nil_rep = lab.result_and_env(lab.parse(['nil']))[0] except: nil_rep = NotImplemented() def list_from_ll(ll): if isinstance(ll, lab.Pair): if ll.cdr == nil_rep: return [list_from_ll(ll.car)] return [list_from_ll(ll.car)] + list_from_ll(ll.cdr) elif ll == nil_rep: return [] elif isinstance(ll, (float, int)): return ll else: return 'SOMETHING'
import os import lab import sys import json import unittest TEST_DIRECTORY = os.path.dirname(__file__) class NotImplemented: def __eq__(self, other): return False try: nil_rep = lab.result_and_env('nil')[0] except: nil_rep = NotImplemented() def list_from_ll(ll): if isinstance(ll, lab.Pair): if ll.cdr == nil_rep: return [list_from_ll(ll.car)] return [list_from_ll(ll.car)] + list_from_ll(ll.cdr) elif ll == nil_rep: return [] elif isinstance(ll, (float, int)): return ll else: return 'SOMETHING'