From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9935 invoked by alias); 23 Jul 2014 18:01:02 -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 9920 invoked by uid 89); 23 Jul 2014 18:01:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Wed, 23 Jul 2014 18:00:59 +0000 Received: from [10.11.21.54] (unknown [10.11.21.54]) by mail.theptrgroup.com (Postfix) with ESMTPS id 64B06E093B for ; Wed, 23 Jul 2014 14:00:57 -0400 (EDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: Query on using `stream-cons' with srfi-14 From: Jamison Hope In-Reply-To: <53CFF493.9000706@bothner.com> Date: Wed, 23 Jul 2014 18:01:00 -0000 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20140723112307.GA11004@odessa> <53CFF493.9000706@bothner.com> To: "kawa@sourceware.org list" X-IsSubscribed: yes X-SW-Source: 2014-q3/txt/msg00017.txt.bz2 On Jul 23, 2014, at 1:44 PM, Per Bothner wrote: > On 07/23/2014 04:23 AM, Kumar Appaiah wrote: >> Hi. >>=20 >> I'm trying out the SICP examples on streams using kawa. I am currently >> stuck on a stream example. The particular blurb of code is: >>=20 >> (define cons-stream stream-cons) >> (define the-empty-stream stream-null) >> ... >> Running this gives me the following error: >> Argument '#' to 'apply-to-args' has wrong type (kawa= .lang.Macro) (expected: procedure) >> at gnu.kawa.functions.ApplyToArgs.applyN(ApplyToArgs.java:165) >=20 >> What am I doing wrong? Please let me know if I am not being clear. >=20 > stream-cons is syntax - specifically a macro. > It doesn't work to treat it as a value that is > available at run-time. (It might be reasonable for Kawa > to warn about this.) >=20 > You would need to define cons-stream as a macro, for > example (untested code): >=20 > (define-syntax cons-stream > (syntax-rules () > ((_ a b) (stream-cons a b)))) It'll also work to define cons-stream as an alias: (define-alias cons-stream stream-cons) At least that works at the REPL with a slightly out-of-date build of Kawa circa r7863 or so. BTW the streams stuff is in SRFI-41, not SRFI-14. At first I was very confused by what the char-set library had to do with streams working or not working. -- Jamison Hope The PTR Group www.theptrgroup.com