From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84869 invoked by alias); 22 Sep 2017 18:29:05 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 84859 invoked by uid 89); 22 Sep 2017 18:29:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=sk:www.the, sk:wwwthe, HX-HELO:sk:mail.th, H*r:sk:kawa@so X-HELO: mail.theptrgroup.com Received: from mail.theptrgroup.com (HELO mail.theptrgroup.com) (71.178.251.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 22 Sep 2017 18:29:01 +0000 Received: from [10.11.21.6] (unknown [10.11.21.6]) by mail.theptrgroup.com (Postfix) with ESMTPS id 1EB24401A5 for ; Fri, 22 Sep 2017 14:28:59 -0400 (EDT) From: Jamison Hope Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: no class-of ? Date: Fri, 22 Sep 2017 18:29:00 -0000 References: To: Kawa mailing list In-Reply-To: Message-Id: <425B3BC8-31F3-4299-ADB1-9E064C1E8D3E@theptrgroup.com> X-IsSubscribed: yes X-SW-Source: 2017-q3/txt/msg00075.txt.bz2 On a somewhat related note, is there a way to define a macro that can determine the type of an expression at macro expansion time, without actually evaluating the expression? I'd like to be able to do something along the lines of: (define-syntax (ensure-boolean form) (syntax-case form () ((_ expr) (let ((the-type (???? #'expr))) (cond ((eq? the-type boolean) #'expr) ((eq? the-type void) #'(begin expr #t)) ((eq? the-type int) #'(=3D expr 0)) (else (syntax-error "unsupported expression type"))))))) to be used as in: (define (f x::double) ::boolean ...) (define (g) ::int ...) (define (h) ::void ...) (list (ensure-boolean (let ((x 1.0)) (f x))) (ensure-boolean (g)) (ensure-boolean (h))) =3D> (list (let ((x 1.0)) (f x)) (=3D (g) 0) (begin (h) #t)) > On Sep 21, 2017, at 11:23 AM, Per Bothner wrote: >=20 > On 09/21/2017 04:11 AM, Sonny To wrote: >> there seems to be class-of function to get the type of the r-value of a = symbol. >=20 > You can use the Java getClass method: > (VALUE:getClass) > or: > (invoke VALUE 'getClass) > or the "property" short-hand: > VALUE:class >=20 >> I'm not familiar with with the standard libraries of scheme and i'm >> googling to get documentation and find various scheme documentation >> from mit-scheme/racket/guile but are not available in kawa. >> Is there a place where I can find a list of functions built into kawa? >=20 > The Kawa manual attempts to document all the Kawa functions. > In the past I concentrated on documenting only Kawa extensions/differences > from standard Scheme (so you needed to also have a copy of R5RS/R7RS), but > I'm gradually making the Kawa manual more complete and self-contained. > (There may still be some R7RS procedures missing, though.) >=20 > There are also some implemented SRFIs, not all of which are fully documen= ted > in the Kawa manual. See: > https://www.gnu.org/software/kawa/Implemented-SRFIs.html >=20 > Of course all of the Java APIs are always available, by using Java > method calls: > https://docs.oracle.com/javase/8/docs/api/overview-summary.html > That is where you will find getClass documented: > https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass= -- > (the final '--' in the URL seems to be needed.) > --=20 > --Per Bothner > per@bothner.com http://per.bothner.com/ -- Jamison Hope The PTR Group www.theptrgroup.com