1 ;;; utils.rkt -- generic utilities
3 ;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz
5 ;; This program is free software; you can redistribute it and/or
6 ;; modify it under the terms of the Modified BSD License. You should
7 ;; have received a copy of the license along with this program. If
8 ;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>.
10 ;; Start date: Sun May 03, 2009 03:09
18 (define (pair->list pair)
19 (let loop ([d pair] [s '()])
20 (cond [(null? d) (reverse s)]
21 [(symbol? d) (reverse (cons d s))]
22 [else (loop (cdr d) (cons (car d) s))])))
24 (define keyword->symbol (compose string->symbol keyword->string))
25 (define (symbol->keyword sym) (string->keyword (format "~a" sym)))