Mercurial > lasercutter
comparison src/clojure/contrib/test_contrib/pprint/examples/props.clj @ 10:ef7dbbd6452c
added clojure source goodness
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 21 Aug 2010 06:25:44 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:35cf337adfcf | 10:ef7dbbd6452c |
---|---|
1 ;;; props.clj -- part of the pretty printer for Clojure | |
2 | |
3 ;; by Tom Faulhaber | |
4 ;; April 3, 2009 | |
5 | |
6 ; Copyright (c) Tom Faulhaber, Dec 2008. All rights reserved. | |
7 ; The use and distribution terms for this software are covered by the | |
8 ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
9 ; which can be found in the file epl-v10.html at the root of this distribution. | |
10 ; By using this software in any fashion, you are agreeing to be bound by | |
11 ; the terms of this license. | |
12 ; You must not remove this notice, or any other, from this software. | |
13 | |
14 ;; This example displays a nicely formatted table of the java properties using | |
15 ;; cl-format | |
16 | |
17 (ns clojure.contrib.pprint.examples.props | |
18 (:use clojure.contrib.pprint)) | |
19 | |
20 (defn show-props [stream] | |
21 (let [p (mapcat | |
22 #(vector (key %) (val %)) | |
23 (sort-by key (System/getProperties)))] | |
24 (cl-format true "~30A~A~%~{~20,,,'-A~10A~}~%~{~30A~S~%~}" | |
25 "Property" "Value" ["" "" "" ""] p))) |