From: Per Bothner <per@bothner.com>
To: kawa@sourceware.org, Kumar Appaiah <a.kumar@alumni.iitm.ac.in>
Subject: Re: Query on using `stream-cons' with srfi-14
Date: Wed, 23 Jul 2014 17:45:00 -0000 [thread overview]
Message-ID: <53CFF493.9000706@bothner.com> (raw)
In-Reply-To: <20140723112307.GA11004@odessa>
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 '#<macro stream-cons>' 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))))
--
--Per Bothner
per@bothner.com http://per.bothner.com/
next prev parent reply other threads:[~2014-07-23 17:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 11:23 Kumar Appaiah
2014-07-23 17:45 ` Per Bothner [this message]
2014-07-23 18:01 ` Jamison Hope
2014-07-24 3:42 ` Kumar Appaiah
2014-07-24 3:43 ` Kumar Appaiah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53CFF493.9000706@bothner.com \
--to=per@bothner.com \
--cc=a.kumar@alumni.iitm.ac.in \
--cc=kawa@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).