Permalink
Browse files

additional arity for table, also now accepts just rows

(columns are the keys from the first row)
  • Loading branch information...
joegallo committed Mar 5, 2011
1 parent 1e250db commit 528da5135763ea853f010bc533e190aaa65e3a17
Showing with 10 additions and 5 deletions.
  1. +10 −5 src/doric/core.clj
View
@@ -120,9 +120,14 @@
(str "| " (join " | " tr) " |\n"))
[spacer]))))
-(defn table [cols rows]
- (let [cols (columns1 cols rows)
- rows (format-rows cols rows)
- cols (columns2 cols rows)]
- (render (cons (header cols) (body cols rows)))))
+(defn table
+ ([rows]
+ (table (keys (first rows)) rows))
+ ([cols rows]
+ (let [cols (columns1 cols rows)
+ rows (format-rows cols rows)
+ cols (columns2 cols rows)]
+ (render (cons (header cols) (body cols rows))))))
+
+

0 comments on commit 528da51

Please sign in to comment.