From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user Subject: Re: call-with-values and primitives Date: Fri, 11 Jan 2013 17:56:27 +0100 Message-ID: <87pq1bzmis.fsf@pobox.com> References: <24558.128.117.43.92.1357914200.squirrel@lavabit.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1357923406 26336 80.91.229.3 (11 Jan 2013 16:56:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2013 16:56:46 +0000 (UTC) Cc: guile-user@gnu.org To: bromley@lavabit.com Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jan 11 17:57:01 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tthuf-0006cl-8a for guile-user@m.gmane.org; Fri, 11 Jan 2013 17:57:01 +0100 Original-Received: from localhost ([::1]:33390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TthuP-00031U-7e for guile-user@m.gmane.org; Fri, 11 Jan 2013 11:56:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TthuF-00030w-Fl for guile-user@gnu.org; Fri, 11 Jan 2013 11:56:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TthuC-00071B-Pf for guile-user@gnu.org; Fri, 11 Jan 2013 11:56:35 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:33130 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TthuC-00070r-MG for guile-user@gnu.org; Fri, 11 Jan 2013 11:56:32 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 1EE60AEB5; Fri, 11 Jan 2013 11:56:31 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=n2rb2vmCDk3za05TEJXenOJB2FQ=; b=P5sVLp twdSX0WKMjVo8K8F+K2BxzmoUVT56M3DS1VgSH4CLT5V6Ip96ROhp2x/kROlc2Z7 rqmhvXs5aTNuO6nbcP9rXRrEDaQAZwnngy47fNTfn0luHuNopcYPoEN9vjLedTsU 2jY7Usaka2fSOF5uJdtOqP+eVEZjm0404dO/o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=PMEsPea+8odKDN5C4IN3MDXdryZ9NgtE UuJpUJJsxEQLO1qfzkWFEOiLZBJjFSt5zNlHo9r2uJiiiIRO0dbWGCMdPRrfgNf3 B9H28vhp2mSu28VTCK5qR+UDcMGhqW07zQ1mDboaiL8EzmaBjNBzuZ3P+c9dYwTk bIRcGYAyvTc= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 179F9AEB4; Fri, 11 Jan 2013 11:56:31 -0500 (EST) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 9A0E7AEB3; Fri, 11 Jan 2013 11:56:30 -0500 (EST) In-Reply-To: <24558.128.117.43.92.1357914200.squirrel@lavabit.com> (bromley@lavabit.com's message of "Fri, 11 Jan 2013 09:23:20 -0500 (EST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: D8E3A698-5C0F-11E2-96F4-0A4F0E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 208.72.237.25 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9843 Archived-At: On Fri 11 Jan 2013 15:23, bromley@lavabit.com writes: > (call-with-values * -) > ⇒ -1 So it's like: (call-with-values producer consumer) The producer is called with no arguments, then the results of that call are passed to the consumer. So first `*' is called with no arguments, like this: (*) Calling `*' always returns just one value, so in this case it's equivalent to binding a single value, so the original expression is completely equivalent to: (let ((tmp (*))) (- tmp)) Reducing this further: => (let ((tmp 1)) (- tmp)) => (- 1) => -1 See the R5RS for more, including the definition of (*) and (+). > (call-with-values + +) > 0 (let ((tmp (+))) (+ tmp)) > (call-with-values + -) > 0 (let ((tmp (+))) (- tmp)) > (call-with-values - -) (let ((tmp (-))) (- tmp)) > ERROR: Wrong number of arguments to - > ABORT: (wrong-number-of-args) (-) has no sensible answer. Happy hacking, Andy -- http://wingolog.org/