[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Request for comments on the SQLite3 egg API
From: |
Ivan Shmakov |
Subject: |
Re: [Chicken-users] Request for comments on the SQLite3 egg API |
Date: |
Mon, 2 Jul 2007 15:06:44 +0700 |
John Cowan <address@hidden> writes:
>> 1. Introduce a new separate singleton type for SQL NULL values and
>> refrain from using booleans altogether, because there is no SQL
>> boolean type in SQLite3.
> I favor a variant of this: introduce a singleton type for SQL NULL
> values, and map #t and #f inbound to 1 and 0 respectively (but not
> outbound, of course). Ideally, the singleton type would be the same
> in all SQL eggs rather than SQLite-specific: one could use the symbol
> sql:null or even the empty list, which some people already pronounce
> "nil".
I'd rather like it be a type disjoint from all the other Scheme
types.
May we have a library to implement SQL-like ternary logic as
well? E. g.:
;; Ivan Shmakov, 2007
;; Public domain
(require-extension syntax-case)
(define-record-type :sql-null
(sql-null)
sql-null?)
(define (sql-not o)
(if (not (sql-null? o))
(not o)
o))
(define-syntax sql-or
(syntax-rules ()
((sql-or) #f)
((sql-or a) a)
((sql-or a b ...)
(if (or (sql-null? a) (not a))
(sql-or b ...)
a))))
(define-syntax sql-and
(syntax-rules ()
((sql-and) #t)
((sql-and a) a)
((sql-and a b ...)
(if (and a (not (sql-null? a)))
(sql-and b ...)
a))))
;; (sql-not (sql-null)) => SQL NULL ;
;; (sql-or (sql-null) 1) => 1 ;
;; (sql-or (sql-null) #f) => SQL NULL ;
;; (sql-and (sql-null) 1) => SQL NULL ;
[...]
- Re: [Chicken-users] Request for comments on the SQLite3 egg API,
Ivan Shmakov <=
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Thomas Christian Chust, 2007/07/02
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Ivan Shmakov, 2007/07/03
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, John Cowan, 2007/07/03
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Thomas Christian Chust, 2007/07/03
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Ivan Shmakov, 2007/07/03
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Peter Keller, 2007/07/03
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Thomas Christian Chust, 2007/07/04
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Ivan Shmakov, 2007/07/06
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, Thomas Christian Chust, 2007/07/06
- Re: [Chicken-users] Request for comments on the SQLite3 egg API, John Cowan, 2007/07/06