[gambit-list] various
David St-Hilaire
sthilaid at iro.umontreal.ca
Wed Nov 5 07:10:58 EST 2008
Christoph Bauer wrote:
> Hello Experts,
>
> my favorite feature of gambit is its portability. It compiles so
> easily on SunOS, IRIX, AIX, HP-UX and Linux. (Try to find such a
> common lisp implementation!) So now my questions:
>
> - is there a way to copy a record (define-structure) or
> to convert it to a list, like table-copy and table->list? for tables
> - there is a function to create symbolic links. Is there also
> one for readlink(2)?
I don't know about these... You can always use the object->u8vector (and its
counter part (u8vector->object) to make a copy, but there must be an easier
way. Here is an example:
Gambit v4.2.8
> (define-type t a b)
> (define t1 (make-t 1 2))
> t1
#<t #3 a: 1 b: 2>
> (define t2 (with-input-from-string (with-output-to-string "" (lambda () (write
(object->u8vector (make-t 1 2))))) (lambda () (u8vector->object (read)))))
> t2
#<t #4 a: 1 b: 2>
> (eq? t1 t2)
#f
> - this code, which is written by Olin Shivers, doesn't work:
>
>> (define-syntax let-string-start+end
> (syntax-rules ()
> ((let-string-start+end (start end) proc s-exp args-exp body ...)
> (receive (start end) (string-parse-final-start+end proc s-exp
> args-exp)
> body ...))
> ((let-string-start+end (start end rest) proc s-exp args-exp body
> ...)
> (receive (rest start end) (string-parse-start+end proc s-exp
> args-exp)
> body ...))))
> *** ERROR IN (console)@4.17 -- Ill-formed expression
>
The syntax-case form is not supported by default by gambit-c, it is rather the
"lower level" define-macro form which is used. If you want to use syntax-case
macros, you have to include it with:
(include "~~/syntax-case.scm")
Then, you'll have access to it.
Have fun ^_^
David
More information about the Gambit-list
mailing list