Linas Vepstas <[email protected]> writes: > I have no clue why it never occurred to me to use the above paradigm, > I will definitely start experimenting with it. > > Any clue on how to indicate that func returns type 'X' ? > > I don't know if you were trying to make this point but: if one were to > code in the above paradigm, and also throw some srfi-9000 syntactic > sugar at it, one might be able to get something that resembled > ocaml/haskell type declarations. And, for the code that I deal with, > this might be the bees knees.
Just because scheme doesn't have type declarations doesn't mean you can't add them. I often write code that looks like ; partition : (A -> Boolean) Listof(A) -> Listof(A) Listof(A) (define (partition pred list) ...) and I also make heavy use of 'assert', and less frequently, a macro of mine called 'assert-lambda' which looks like (lambda ((a procedure?) (b list?)) ...) I don't, in general, check return types, but I do try and make sure that they obey the declaration comment. Having a built-in type/contract syntax, like Racket has, would be nice as I could move these comments into code, but this is better than nothing. -- Ian Price "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"
