Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Database Bindings for Scheme? 12

alexhmit01 asks: "One of my classes requires us to write a system that will deal with accessing huge amounts of random data. The catch? The project must be done in scheme. Storing the data in a Database would make indexing and searching the data MUCH easier than manually creating hash tables and other ugliness for which scheme is AMAZINGLY inefficient at. Does anyone know of ODBC, Postgres or MySQL bindings for Scheme (preferably MIT Scheme, but we could use a different Scheme if need be)?" While perusing around, I found this page which which contains some information about Scheme and Databases. Are there any other bindings for Scheme that will allow you to connect to various database backends?
This discussion has been archived. No new comments can be posted.

Database Bindings for Scheme?

Comments Filter:
  • by Anonymous Coward
    I actually found a Scheme PostgreSQL interface at http://www.techiescripts.com/ [techiescripts.com]. This should make your life a lot easier (and fun!) :-)
  • by woggo ( 11781 ) on Friday December 01, 2000 @11:34AM (#590528) Journal
    Don't write your own hash table. MIT Scheme has a built-in hash table facility.
  • What do you mean by "huge amounts of random data"? Perhaps proffie just wants you to implement a binary tree for storage? You could store a smooth billion records in the leaves of a binary tree only 30 layers deep. The access would hardly qualify as "inefficient", in Scheme or any other language.

    --
  • by multriha ( 206019 ) on Thursday November 30, 2000 @07:50PM (#590530)
    What do you care about database binding?

    If you're supposed to write it in scheme, I would assume that if your prof wants you to write it in scheme, using a very large piece of code that somebody else wrote in different language wouldn't be acceptable.

  • I'm suprised that this was modded up. There are non-homework reasons to use scheme. Modern implementations are suprisingly fast.

    While you might not want to port those numerical apps yet, the expressiveness and interactivity of scheme allows you to churn out applications at an amazing rate.

    I tend to use python for small sys-admin programs ("python - a better shell") and web toys, but for anything larger than a few pages, I find myself pining for scheme. I never do get around to installing it tho, so I end up using java and jpython. I'm going to look into kawa right now.

    Thanks for the kick in the pants!
  • I wouldn't suggest you put ANY data through the above-mentioned interface. It'll all come out smelling like shit.

    Instead, use bigloo, scheme48, or some other Scheme with a decent FFI. Then you can use the native Scheme calls.

    An even-better alternative is to use SILK [norvig.com] or KAWA [gnu.org], which are scheme systems that can interface with Java, thus using JDBC.

    There's a great paper called "Java reflects easily through Scheme" [brandeis.edu] which discusses SILK and extending Scheme to allow access to Java code.

    Good luck -- but with Scheme, you won't need it. What a great language!


    ~wog

  • There a rep bindings to SQL here: http://www.dcs.warwick.ac.uk/~john/sw/rep-sql.html [warwick.ac.uk]
    The link to squile was broken when I tried it. Maybe google will turn up something.
  • For those of us who like strong typing (yes, I'm a masochist) I'd like to tip the hat towards Java ML or Haskell-to-Java.

    JML [ed.ac.uk]
    J HS [ex.ac.uk]

    Neither is an interpreter, but for sheer perversity, they're both worth a look.

    Johan
  • Instead, use bigloo, scheme48, or some other Scheme with a decent FFI. Then you can use the native Scheme calls.

    er, I mean "C API calls". In any case, the SILK->JDBC approach is better.

    ~wog

  • by drix ( 4602 ) on Friday December 01, 2000 @09:49AM (#590536) Homepage
    You know it's funny: this assignment sounds like a lot of homework I've had to do this semester. Just in my experience, want to know what the answer was in every case? A Scheme program.

    Scheme is not AMAZINGLY bad or inefficient at anything. In fact, it (and more generally, Lisp) is arguably the greatest computer language in the history of the world. It still scares me to realize that designers of almost every other language in the modern computing era have had Lisp staring them in the face for the past half-century yet somehow still manage to miss the boat when it comes to simple, powerful things that should be in every language. A few examples would include: first-class procedures; lambda/unnamed functions; "scalar"/typeless variables; simple, non-ambiguous prefix notation; automatic memory management ... I could go on.

    My advice to you is to write your own hash table. It will consist of lists, car, and cdr - in others words, the same simple, basic things you've used to make pretty much everything else in Scheme. It will look infinitely more elegant that a bunch of cruddy database bindings which may or may not function as advertised.

    Oh, and don't forget: Scheme can be compiled. I find this fact is frequently overlooked by C(++) bigots who shit on Scheme for being slow. Bigloo will almost always be within a few percentage points of an equivalent C program. With that in mind I'd remind you that Scheme isn't AMAZINGLY slow at anything: your algorithms are. If your program isn't running up to snuff then well my friend, as buddies in tech support used to say: PEBUAK.

    (Problem Exists Between User And Keyboard)
  • If your program isn't running up to snuff then well my friend, as buddies in tech support used to say: PEBUAK.

    (Problem Exists Between User And Keyboard)

    What, might I ask, is there between the user and the keyboard? I think that's why the expression is usually "Problem Exists Between Keyboard And Chair".

  • ...of a project that was assigned in a class on Artificial Intelligence using LISP several years ago. We were assigned to write an TCP interface for an internet agent in Mac Lisp. The trick was that there was already a C++ version implemented, and we could use it for reference.

    Well, most of the other students were experienced C programmers, and so they just wrote a bunch of LISP wrappers for the available api. They ended being less efficient, buggier, and more difficult to deal with, and the students didn't learn how to use lisp to do actual tasks.

    Probably any scheme/database library you find will be poorly documented and buggy. Its not worth it--do yourself a favor and use the power of the native language to solve your problem. It may even give you ideas about how to design better databases in the future.

"When the going gets tough, the tough get empirical." -- Jon Carroll

Working...