1 ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: RUNES; -*-
2 ;;; ---------------------------------------------------------------------------
3 ;;; Title: Some common utilities for the Closure browser
4 ;;; Created: 1997-12-27
5 ;;; Author: Gilbert Baumann <unk6@rz.uni-karlsruhe.de>
6 ;;; License: Lisp-LGPL (See file COPYING for details).
7 ;;; ---------------------------------------------------------------------------
8 ;;; (c) copyright 1997-1999 by Gilbert Baumann
10 ;;; This code is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the version 2.1 of the GNU Lesser General Public
12 ;;; License as published by the Free Software Foundation, as clarified
13 ;;; by the "Preamble to the Gnu Lesser General Public License" found in
16 ;;; This code is distributed in the hope that it will be useful,
17 ;;; but without any warranty; without even the implied warranty of
18 ;;; merchantability or fitness for a particular purpose. See the GNU
19 ;;; Lesser General Public License for more details.
21 ;;; Version 2.1 of the GNU Lesser General Public License is in the file
22 ;;; COPYING that was distributed with this file. If it is not present,
23 ;;; you can access it from http://www.gnu.org/copyleft/lesser.txt (until
24 ;;; superseded by a newer version) or write to the Free Software
25 ;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 ;; ----------------------------------------------------------------------------
31 ;; 1999-08-24 GB = fixed MULTIPLE-VALUE-OR it now takes any number of
37 ;;; --------------------------------------------------------------------------------
40 (defun curry (fun &rest args
)
41 #'(lambda (&rest more
)
42 (apply fun
(append args more
))))
44 (defun rcurry (fun &rest args
)
45 #'(lambda (&rest more
)
46 (apply fun
(append more args
))))
49 #'(lambda (&rest args
)
50 (funcall f
(apply g args
))))
52 ;;; --------------------------------------------------------------------------------
55 (defmacro while
(test &body body
)
56 `(until (not ,test
) ,@body
))
58 (defmacro until
(test &body body
)
59 `(do () (,test
) ,@body
))
64 "Returns true, iff `n' is prime."
68 (cond ((zerop (mod n i
)) (return nil
))))))
70 (defun nearest-greater-prime (n)
71 "Returns the smallest prime number no less than `n'."
73 ((nearest-greater-prime (+ n
1)))))