Arc Forumnew | comments | leaders | submitlogin
Database interface implementation: Functional-Relational Mapping (by wfarr)
5 points by almkglor 5810 days ago | 4 comments
Reviewing some of the applications for the GSOC, I came across an older application by wfarr regarding a database implementation.

Originally (it seems) wfarr's intention was simply a portable (as in portable across PostgreSQL, MySQL, etc.) SQL interface. However, matt knox suggested using an alternative - functional-relational mapping.

The site he referred to was this: http://enfranchisedmind.com/blog/2006/06/17/the-functional-relational-impedance-match/

Other references suggested by matt knox are schemeQL, Roe, and http://lists.canonical.org/pipermail/kragen-hacks/2004-April/000394.html .

I think this is interesting and I'd like to ask wfarr what the state of this is?

It might be useful to handle queries as plain functions, and use combinator functions to combine simpler queries into more complex ones, a-la parser combinators; or even just have queries as some kind of object, while retaining the combinator-like syntax.

As an aside, 'scanner is actually a lazy-list implementation, so you might be able to use it (I mention this because the referred site mentioned lazy lists, and I'm not one to pass up --warning-blatant-self-promotion--), however I probably need to create new methods for map1 and keep:

  (defm map1 (f (t l scanner))
    ; no need to check for nil - nil
    ; will be handled as if it were a list
    (scanner
      'car (f (car l))
      'cdr (map1 f (cdr l))))
  (def keep (f (t l scanner))
    (zap testify f)
    (while (and l (~f (car l)))
      (zap cdr l))
    (if l
      (scanner 'car (car l)
               'cdr (keep f (cdr l)))))
Edit: looking through some docs for SchemeQL - SchemeQL!cursor == Anarki!scanner


2 points by wfarr 5809 days ago | link

The application is undergoing a large bit of a rewrite before the deadline, in order to address some of Fare's concerns about the proposal. =)

Ideally, a first pass at a rough API should be done by then (obviously, not in ANY way representative of a final project, since the proposal itself is writing a library and an API).

-----

1 point by almkglor 5809 days ago | link

Okay^^. Want to post a draft here so you can get reactions about it?

-----

1 point by wfarr 5809 days ago | link

I should have one by tonight, ideally.

-----

1 point by wfarr 5807 days ago | link

I've dropped you an email. =)

-----