guile-user
[Top][All Lists]
Advanced

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

Re: no scm_foreign_object_p ?


From: Olivier Dion
Subject: Re: no scm_foreign_object_p ?
Date: Sat, 23 Jan 2021 14:29:13 -0500

On Sat, 23 Jan 2021, Matt Wette <matt.wette@gmail.com> wrote:
> I started using foreign objects but want something akin to number?, 
> string? etc.
> Is there something that works here?
> I was hoping to see scm_foreign_object_p(type, object).

The only thing I see in the manual is `scm_assert_foreign_object_type`.

For something equivalent in scheme, I guess you could do something like:
----------------------------------------------------------------------
(define (foreign? obj)
  (not (or (number? obj)
           (string? obj)
           (null? obj)
           ;; and so on..
           )))
----------------------------------------------------------------------

I agree that such predicate should be part of the buitlin API.

-- 
Olivier Dion
PolyMtl



reply via email to

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