Hi, is it possible to define recursive types?
Suppose I have a function (define my-fun (lambda (lst) ...)) and I want to make sure that every odd element is a symbol and every even element is a string. The best I could come up with is something like that: (define-type l-1 (pair symbol (pair string null))) (define-type l-2 (pair symbol (pair string l-1))) (define-type l-3 (pair symbol (pair string l-2))) ... (define-type l (or ... l-3 l-2 l-1)) (: my-fun (l --> ...)) (define my-fun (lambda (lst) ...)) Another question: How could I define something like a "sequence"? Suppose I don't want to pass the parameters in a list but rather do something like this: (define my-fun (lambda (sym-1 str-1 . rest) ...)) How could I define the type for "rest"? If I change my definition for "l" (from above) to (define-type l (or ... l-3 l-2 l-1 null)) I am almost there - except that the compiler expects me to pass the "rest" actually as a list - but I want to do: (print (my-fun 'a "a" 'b "b" ...)) Martin _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
