grafter
grafter copied to clipboard
Add simple coercions for numeric types
I think we need protocol based coercers for coercing strings into specific numeric types etc (and some general ones too).
Probably in a namespace like grafter.tabular.coercers
or grafter.coercions
.
-
(->int "10") (->int 10)
-
(->double "10.0") (->double 10.0)
-
(->float "5.5")
-
(->byte "128")
- ... one for all java/clj numeric types
And a more generic one that coerces more like you do there - by looking for .
:
-
(->number "10.21")
They should probably raise an exception on an invalid parse.