Nikita Karetnikov <nik...@karetnikov.org> writes: > How would you rewrite the following function in Guile? > > foo :: [Int] -> String -> [Int] > foo (x:y:ys) "+" = (x + y):ys > foo (x:y:ys) "-" = (x - y):ys > foo xs num = read num:xs
Daniel covered most of this already, but instead you might consider (define foo (match-lambda* ....)) rather than (define (foo . args) (match args ....)) the nearest analogue to read is object->string, but it is not a generic. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled"