Commit | Line | Data |
---|---|---|
bce5cb56 | 1 | ;;; srfi-88.scm --- Keyword Objects -*- coding: utf-8 -*- |
189681f5 | 2 | |
bce5cb56 | 3 | ;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
189681f5 LC |
4 | ;; |
5 | ;; This library is free software; you can redistribute it and/or | |
6 | ;; modify it under the terms of the GNU Lesser General Public | |
7 | ;; License as published by the Free Software Foundation; either | |
83ba2d37 | 8 | ;; version 3 of the License, or (at your option) any later version. |
189681f5 LC |
9 | ;; |
10 | ;; This library is distributed in the hope that it will be useful, | |
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | ;; Lesser General Public License for more details. | |
14 | ;; | |
15 | ;; You should have received a copy of the GNU Lesser General Public | |
16 | ;; License along with this library; if not, write to the Free Software | |
17 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
18 | ||
bce5cb56 | 19 | ;;; Author: Ludovic Courtès <ludo@gnu.org> |
189681f5 LC |
20 | |
21 | ;;; Commentary: | |
22 | ||
23 | ;; This is a convenience module providing SRFI-88 "keyword object". All it | |
24 | ;; does is setup the right reader option and export keyword-related | |
25 | ;; convenience procedures. | |
26 | ||
27 | ;;; Code: | |
28 | ||
29 | (define-module (srfi srfi-88) | |
30 | #:re-export (keyword?) | |
31 | #:export (keyword->string string->keyword)) | |
32 | ||
33 | (cond-expand-provide (current-module) '(srfi-88)) | |
34 | ||
35 | \f | |
9c2224f2 LC |
36 | ;; Change the keyword syntax both at compile time and run time; the latter is |
37 | ;; useful at the REPL. | |
f6ddf827 | 38 | (eval-when (expand load eval) |
9c2224f2 | 39 | (read-set! keywords 'postfix)) |
189681f5 LC |
40 | |
41 | (define (keyword->string k) | |
42 | "Return the name of @var{k} as a string." | |
43 | (symbol->string (keyword->symbol k))) | |
44 | ||
45 | (define (string->keyword s) | |
46 | "Return the keyword object whose name is @var{s}." | |
47 | (symbol->keyword (string->symbol s))) | |
48 | ||
49 | ;;; Local Variables: | |
50 | ;;; coding: latin-1 | |
51 | ;;; End: | |
52 | ||
53 | ;;; srfi-88.scm ends here |