grafter icon indicating copy to clipboard operation
grafter copied to clipboard

Add simple coercions for numeric types

Open RickMoynihan opened this issue 8 years ago • 0 comments

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.

RickMoynihan avatar May 19 '16 10:05 RickMoynihan