#!/usr/bin/newlisp
;;; -*- mode: lisp -*-
;;; $Id: takfp-newlisp.code,v 1.1 2004/12/05 21:22:46 bfulgham Exp $
;;; http://shootout.alioth.debian.org/
;;; Contributed by Brent Fulgham
;;; changes L.M. 2004/12/13
;;; switch int-ops to float-ops
(constant '- sub '* mul)
(define (tak x y z)
(if (>= y x)
z
(tak (tak (- x 1) y z) (tak (- y 1) z x) (tak (- z 1) x y))))
(define (main)
(set 'n (integer (last (main-args))))
(println
(format "%.1f" (tak (* n 3.0) (* n 2.0) (* n 1.0) ))))
(main)
(exit)
syntax highlighting with newLISP and syntax.cgi