Mikael Brockman <phubuh / phubuh.org> wrote in message news:<87llhx2hec.fsf / phubuh.org>...

> In Scheme, sum would be:
> 
>  (define (sum xs)
>    (if (null? xs)
>       0
>      (+ (car xs) (sum (cdr xs)))))

Or in Bigloo with pattern-matching:

(define (sum xs)
   (match-case xs
      (() 0)
      ((?h ???t)
       (+ h (sum t)))))


or with types:

(define (sum::obj xs::pair)
   (match-case xs  
      (() 0)
      ((?h ???t)
       (+ h (sum t)))))


Bigloo its pattern-matching facility is as sophisticated as OCaml its one.

Fensterbrett