Programming language shootout: sum file
From Gambit wiki
(Difference between revisions)
(sum file benchark from alioth) |
(correct link to alioth) |
||
| Line 1: | Line 1: | ||
| - | This is a Gambit implementation of the [http://shootout.alioth.debian.org/ | + | This is a Gambit implementation of the [http://shootout.alioth.debian.org/gp4sandbox/benchmark.php?test=sumcol&lang=all sum-file] benchmark of the [[Programming language shootout|Computer Language Benchmarks Game]]. |
I have no idea what the real data is supposed to be. | I have no idea what the real data is supposed to be. | ||
Latest revision as of 22:06, 22 February 2008
This is a Gambit implementation of the sum-file benchmark of the Computer Language Benchmarks Game.
I have no idea what the real data is supposed to be.
The program
#!gsi-script
;; The Computer Language Benchmarks Game
;; http://shootout.alioth.debian.org/
;;
;; Derived by Bradley Lucier from the Ikarus variant
;; derived by Michael D. Adams from the MzScheme variant
(declare (standard-bindings)(extended-bindings)(block)(not safe))
(define (main)
(time (let ([in (current-input-port)])
(let loop ([acc 0])
(let ([n (read-line in)])
(if (eof-object? n)
(begin (display acc) (newline))
(loop (+ acc (string->number n)))))))))
Compiling
gsc sum-file
Running
gsi sum-file < sum-file.in