From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tomtom Newsgroups: gmane.lisp.guile.user Subject: manipulating continuations Date: Sat, 12 Feb 2011 09:35:06 +0100 Message-ID: <4D56463A.6080508@herbesfolles.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1297533863 9851 80.91.229.12 (12 Feb 2011 18:04:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 12 Feb 2011 18:04:23 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Feb 12 19:04:19 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PoJpR-0004qc-It for guile-user@m.gmane.org; Sat, 12 Feb 2011 19:04:17 +0100 Original-Received: from localhost ([127.0.0.1]:34209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoJpQ-00040H-DU for guile-user@m.gmane.org; Sat, 12 Feb 2011 13:04:16 -0500 Original-Received: from [140.186.70.92] (port=51617 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoAwm-0001Rg-Tx for guile-user@gnu.org; Sat, 12 Feb 2011 03:35:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PoAwi-0007Aa-UC for guile-user@gnu.org; Sat, 12 Feb 2011 03:35:13 -0500 Original-Received: from a4nancy.globenet.org ([80.67.172.114]:45328 helo=mail.herbesfolles.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PoAwi-0007AA-O7 for guile-user@gnu.org; Sat, 12 Feb 2011 03:35:12 -0500 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) with ESMTPSA id 319841D5E6 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101227 Icedove/3.0.11 X-Enigmail-Version: 1.0.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.67.172.114 X-Mailman-Approved-At: Sat, 12 Feb 2011 13:01:17 -0500 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8431 Archived-At: Hello list First of all, I'm new to scheme and guile - started using them a few days ago for a project. So here we go: this is the bit of code that causing me troubles: (define (foo) (call/cc (lambda (return) (display "first part") (newline) (call/cc (lambda (cont) (return cont))) (display "second part") (newline)))) Basically, I use call/cc to stop the procedure foo after printing "first part" and return a continuation. Then, if I call this continuation it prints "second part" and ends. To test this code, I did this: guile> (define c (foo)) first part guile> (c) second part yay, it works. But now, what if I want to run the continuation directly, rather than storing it and calling it later ? This is what I get: guile> ((foo)) first part second part Backtrace: In current input: 15: 0* [#] :15:1: In expression ((foo)): :15:1: Wrong type to apply: # ABORT: (misc-error) There. I don't understand why I get this error message. Cheers Tom