This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem setting value of symbol passed to function


I would like to use Scheme as extension language in some projects, but
I need to add access to specialized hardware in Scheme.  I was going
to copy the same API for hardware access that I already did for Emacs
lisp, but I'm stuck now.

Here is an example of what I'm trying to do (in Elisp)

(defun test (s v)
  (if (not (symbolp s))
      (error "s must be symbol"))
  (if (not (integerp (eval s)))
      (error "s must evaluate to integer"))
  (set s v))

(let ((x 0))
  (test 'x 10)
  x)

Real function should either use result of evaluation of s internally
or set value of symbol "pointed" by s and return status of operation.

I have tried to rewrite that code in Scheme (both scm5d0 and guile)
and failed.  I am a newbie in Scheme, so perhaps I'm missing something
obvious.

Perhaps, if it can not be done in Scheme, then I'm sure it should be
possible on C level (I need it in C anyway, for performance), but I
don't know how to write that either, it is not as obvious for me as it
was with Elisp.

BTW, I'm using guile-1.3 with DJGPP 2.02 (this is development
environment for ms-dos, based on gcc and friends).

Thank you,

-- 
Michael Bukin