guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple implementations of low-level functions


From: Keith Wright
Subject: Re: Multiple implementations of low-level functions
Date: Fri, 31 Oct 2003 23:45:09 -0500

> From: "Michael J. Barillier" <address@hidden>
> 
> I've been hacking on a system for which I would like to have multiple
> implementations of low-level functions, which would be called by
> higher-level code.  (e.g. A test version with static data, v. a test
> version with data stored in a database, v. a production version
> running against an Oracle database and communicating with other
> processes.)
>       ...
> Anyone care to weigh in on either method, or propose a sexier
> solution?

Why not just have a variable and assign it the value you want?

(set! compute
      (case version
            ((test1) (lambda(n) 42))
            ((test2) (lambda(n) (+ 1 n)))
            (else (lambda(n) (call-oracle "select answer from air"))) ))

-- 
     -- Keith Wright  <address@hidden>

Programmer in Chief, Free Computer Shop <http://www.free-comp-shop.com>
         ---  Food, Shelter, Source code.  ---




reply via email to

[Prev in Thread] Current Thread [Next in Thread]