Overview
Comment:Added string to pgint
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: be70f56b97e57ed0798932c1b6695418f05eada0
User & Date: matt on 2011-06-09 05:09:38
Other Links: manifest | tags
Context
2011-09-24
22:13
Yikes. Changes sitting around on disk for long time.... s:any->pgint fix? check-in: 7807ffe39b user: matt tags: trunk
2011-06-09
05:09
Added string to pgint check-in: be70f56b97 user: matt tags: trunk
2011-06-08
04:48
Added minor detail to howto check-in: ea14aab600 user: matt tags: trunk
Changes

Modified misc-stml.scm from [f82d8a5d54] to [7db3e6d38a].

193
194
195
196
197
198
199














200
201
202
203
204
205
206

(define (s:any->number val)
  (cond
   ((number? val)  val)
   ((string? val)  (string->number val))
   ((symbol? val)  (string->number (symbol->string val)))
   (else     #f)))















;; string is a string and non-zero length
(define (misc:non-zero-string str)
  (if (and (string? str)
           (> (string-length str) 0))
      str
      #f))







>
>
>
>
>
>
>
>
>
>
>
>
>
>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220

(define (s:any->number val)
  (cond
   ((number? val)  val)
   ((string? val)  (string->number val))
   ((symbol? val)  (string->number (symbol->string val)))
   (else     #f)))

;; NB// this is *illegal* pgint
(define (s:illegal-pgint val)
  (cond
   ((> n 2147483647) 1)
   ((< n -2147483648) -1)
   (else #f)))

(define (s:any->pgint val)
  (let ((n (s:any->number val)))
    (if n
	(if (s:illegal-pgint val)
	    #f
	    n))))

;; string is a string and non-zero length
(define (misc:non-zero-string str)
  (if (and (string? str)
           (> (string-length str) 0))
      str
      #f))