Changeset 5805


Ignore:
Timestamp:
02/13/04 08:34:24 (17 years ago)
Author:
asimon
Message:

error report

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/lcm.lisp

    r3694 r5805  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: lcm.lisp,v 1.1 2003-09-11 01:44:15 piso Exp $
     4;;; $Id: lcm.lisp,v 1.2 2004-02-13 08:34:24 asimon Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2626         (/ (abs (* n m)) (gcd n m)))))
    2727
    28 (defun lcm (&rest numbers)
    29   (unless (every #'integerp numbers)
    30     (error 'type-error "arguments to LCM must be integers"))
    31   (case (length numbers)
     28(defun lcm (&rest integers)
     29  (unless (every #'integerp integers)
     30    (error 'type-error :datum (find-if-not #'integerp integers) :expected-type 'integer))
     31  (case (length integers)
    3232    (0 1)
    33     (1 (abs (car numbers)))
    34     (2 (two-arg-lcm (car numbers) (cadr numbers)))
     33    (1 (abs (car integers)))
     34    (2 (two-arg-lcm (car integers) (cadr integers)))
    3535    (t
    36      (do ((result (car numbers) (two-arg-lcm result (car rest)))
    37           (rest (cdr numbers) (cdr rest)))
     36     (do ((result (car integers) (two-arg-lcm result (car rest)))
     37          (rest (cdr integers) (cdr rest)))
    3838         ((null rest) result)))))
Note: See TracChangeset for help on using the changeset viewer.