X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=2%2Futils.lisp;h=2a6877fefa71ffec67082d44a23742f0911b21f3;hb=dfca04d9b53264cb05872767a95eecaf4162bc65;hp=a275a3e95eac802a7b0b8ebbff5c2e9504865e8e;hpb=37624f5d0755676f834ab17c373c711689b04e9f;p=lml.git diff --git a/2/utils.lisp b/2/utils.lisp index a275a3e..2a6877f 100644 --- a/2/utils.lisp +++ b/2/utils.lisp @@ -1,6 +1,18 @@ -;;; $Id: utils.lisp,v 1.2 2003/06/28 08:18:21 kevin Exp $ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION ;;;; -;;;; General purpose utilities +;;;; Name: utils.lisp +;;;; Purpose: General purpose utilities +;;;; Author: Kevin M. Rosenberg +;;;; Date Started: June 2002 +;;;; +;;;; $Id: utils.lisp,v 1.4 2003/07/15 04:28:56 kevin Exp $ +;;;; +;;;; This file, part of LML2, is copyrighted and open-source software. +;;;; Rights of modification and redistribution are in the LICENSE file. +;;;; +;;;; ************************************************************************* (in-package #:lml2) @@ -12,26 +24,6 @@ `(aif ,test-form (progn ,@body))) -(defun keyword-symbol? (x) - "Returns T if object is a symbol in the keyword package" - (and (symbolp x) - (string-equal "keyword" (package-name (symbol-package x))))) - -(defun list-to-spaced-string (list) - (format nil "~{~A~^ ~}" list)) - -(defun print-n-chars (char n stream) - (declare (fixnum n) - (optimize (speed 3) (safety 0) (space 0))) - (do ((i 0 (1+ i))) - ((= i n) char) - (declare (fixnum i)) - (write-char char stream))) - -(defun indent-spaces (n &optional (stream *standard-output*)) - "Indent n*2 spaces to output stream" - (print-n-chars #\space (+ n n) stream)) - (defun print-file-contents (file &optional (strm *standard-output*)) "Opens a reads a file. Returns the contents as a single string" (when (probe-file file) @@ -81,3 +73,7 @@ #-(or allegro clisp cmu scl sbcl cormanlisp lispworks lucid mcl) (truename ".")) + +(defun fformat (&rest args) + (declare (dynamic-extent args)) + (apply #'format args))