From: Matt Wette <matt.wette@gmail.com>
To: guile-user@gnu.org
Subject: Re: CPS mystery
Date: Tue, 29 May 2018 19:58:06 -0700 [thread overview]
Message-ID: <06d710e2-5c4f-daab-d54c-5039bb80963f@gmail.com> (raw)
In-Reply-To: <87lgc2cppx.fsf@netris.org>
On 05/29/2018 10:54 AM, Mark H Weaver wrote:
> Hi Matt,
> The problem here is that 'resolve' returns a variable object, but 'call'
> expects a procedure. So, you need another continuation between
> continuations 6 and 5 above, which does (primcall box-ref <>) to extract
> the procedure from the variable object.
>
> Also, I believe the (values 1) in continuation 2 above is incorrect. It
> expects its argument to be a list, whereas in this case it would be a
> number. It's not needed here.
Thanks. I got it working!
calc@(guile-user)> 1 + 2
(program
(expr-stmt (add (fixed "1") (fixed "2"))))
(0 . #<cps (kfun () 0 1 9)>)
(1 . #<cps (ktail)>)
(2 . #<cps (kargs (arg) (4) (continue 1 (call 2 3 4)))>
(3 . #<cps (kargs (arg) (3) (continue 2 (const 2)))>)
(4 . #<cps (kargs (arg) (2) (continue 3 (const 1)))>)
(5 . #<cps (kargs (bx) (5) (continue 4 (primcall box-ref 5)))>)
(6 . #<cps (kargs (t) (7) (continue 5 (primcall resolve 6 7)))>)
(7 . #<cps (kargs (name) (6) (continue 6 (const #t)))>)
(8 . #<cps (kargs () () (continue 7 (const +)))>)
(9 . #<cps (kclause (() () #f () #f) 8)>)
$1 = 3
prev parent reply other threads:[~2018-05-30 2:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-28 13:49 CPS mystery Matt Wette
2018-05-29 17:54 ` Mark H Weaver
2018-05-30 2:58 ` Matt Wette [this message]
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=06d710e2-5c4f-daab-d54c-5039bb80963f@gmail.com \
--to=matt.wette@gmail.com \
--cc=guile-user@gnu.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).