From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8047 invoked by alias); 24 Jul 2014 03:43:49 -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 8037 invoked by uid 89); 24 Jul 2014 03:43:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f178.google.com Received: from mail-pd0-f178.google.com (HELO mail-pd0-f178.google.com) (209.85.192.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 24 Jul 2014 03:43:47 +0000 Received: by mail-pd0-f178.google.com with SMTP id w10so2855905pde.9 for ; Wed, 23 Jul 2014 20:43:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:subject:message-id :mail-followup-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=Dt3k/qaBCTDYyPj/hCatCIgCy5hG0xON1WaooNV9Bd0=; b=SYsC+U/mfDau2EY7DlldHg39dvm7hbgqMFZOkCZzDd31TQBvH+pjMu5xtfc9UGpxiq rdv+bMjD0LNuZEO1zF2Wqccy19uZa8mgN5T4vTGHQFqc+jJxzSijP1geRESz1rU2j9ii AnA2S69zu++ZEZXvBgzbC/lmR3WoRXNqBVhwcLWhcAaesbCpqe0QnPDfukjosDXfFCYF 9FATv7HGuM3nfakX72ZiUSYrrubneOeIUdlIjnc0NLZC/qUtLLwictTOLsUaMzoTmVor yrBMVxgsxkVEi7FQQ/6pazVocgT+1JR4Q/Nw/QSYicmdqpz6C5t8mm4p1QjeSBOSHPhK Q38g== X-Gm-Message-State: ALoCoQmAMf3lM8oOsEzokfokS33kBb85+NGPkCCvPJJ7VCCJVq3fgOZ/RdmSg/ErELer9WU/g7J0 X-Received: by 10.68.166.36 with SMTP id zd4mr7180774pbb.54.1406173425803; Wed, 23 Jul 2014 20:43:45 -0700 (PDT) Received: from odessa ([117.196.37.174]) by mx.google.com with ESMTPSA id yo9sm15597706pac.25.2014.07.23.20.43.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jul 2014 20:43:45 -0700 (PDT) Received: from kumar by odessa with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1XA9wT-0004It-7M for kawa@sourceware.org; Thu, 24 Jul 2014 09:13:41 +0530 Date: Thu, 24 Jul 2014 03:43:00 -0000 From: Kumar Appaiah To: kawa@sourceware.org Subject: Re: Query on using `stream-cons' with srfi-14 Message-ID: <20140724034341.GB14862@odessa> Mail-Followup-To: kawa@sourceware.org References: <20140723112307.GA11004@odessa> <53CFF493.9000706@bothner.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53CFF493.9000706@bothner.com> X-OS: Linux odessa 3.10-2-amd64 x86_64 X-Editor: GNU Emacs 24.3.1 User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2014-q3/txt/msg00019.txt.bz2 On Wed, Jul 23, 2014 at 10:44:51AM -0700, Per Bothner wrote: > > > On 07/23/2014 04:23 AM, Kumar Appaiah wrote: > >Hi. > > > >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: > > > >(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) > > >What am I doing wrong? Please let me know if I am not being clear. > > 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.) > > You would need to define cons-stream as a macro, for > example (untested code): > > (define-syntax cons-stream > (syntax-rules () > ((_ a b) (stream-cons a b)))) Indeed, this works well. I was not acquainted with define-syntax and friends, so thank you for the explanation. Kumar -- Kumar Appaiah