guile-user
[Top][All Lists]
Advanced

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

Re: one C function to many Scheme functions


From: Krzysztof Garus
Subject: Re: one C function to many Scheme functions
Date: Thu, 9 Jan 2003 11:26:22 +0100
User-agent: Mutt/1.3.28i

On Wed, Jan 08, 2003 at 08:45:43PM +0000, Neil Jerram wrote:
> >>>>> "bajcik" == bajcik  <address@hidden> writes:
> 
>     bajcik> But I want to declare many functions in a loop. I have a
>     bajcik> table of names and a table of C-functions [ mytype_t
>     bajcik> function(my_type arg) ] and only ONE C-function that
>     bajcik> converts SCM to mytype_t. It is a wrapper.
> 
> Guile does not have anything like gh_new_procedure_data.  However your
> general objective can easily be achieved like this ...

[ cut ]

> Then in Scheme:
> 
> (define (name0 arg) (wrapper arg 0))
> (define (name1 arg) (wrapper arg 1))
> (define (name2 arg) (wrapper arg 2))
> ...
> 
> Does this help?

I am using similar workaround on similar concept, also with definitions.

Last question: what is cost this definition? I suppose it is small, but
if I call Scheme callback very frequent?

bajcik (not English spoken :> )
-- 
Krzysztof Garus <address@hidden>            Linux User 171721
  Stronka: http://kolos.math.uni.lodz.pl/~bajcik/
  Polecam: http://kolos.math.uni.lodz.pl/~bajcik/duskc/




reply via email to

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