type-conversions.scm 413 B

123456789101112131415
  1. (define-module (data-mining type-conversions))
  2. (define-public (as-symbol v)
  3. (cond ((number? v) (string->symbol (number->string v)))
  4. ((string? v) (string->symbol v))
  5. (else v)))
  6. (define-public (as-string v)
  7. (cond ((number? v) (number->string v))
  8. ((symbol? v) (symbol->string v))
  9. (else v)))
  10. (define-public (as-number v)
  11. (cond ((string? v) (string->number v))
  12. ((symbol? v) (symbol->string v))
  13. (else v)))