From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.lisp.guile.user Subject: Re: Applicable structs and vtables Date: Sat, 14 Aug 2021 08:53:16 +0200 Message-ID: <20210814065316.GB11671@tuxteam.de> References: <598960ee-3baf-dca7-ed88-e128d5eb2fe9@posteo.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kXdP64Ggrk/fb43R" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30800"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Sat Aug 14 08:53:51 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEnYF-0007ni-H8 for guile-user@m.gmane-mx.org; Sat, 14 Aug 2021 08:53:51 +0200 Original-Received: from localhost ([::1]:35166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mEnYE-0008C8-De for guile-user@m.gmane-mx.org; Sat, 14 Aug 2021 02:53:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mEnXt-0008Bp-8Z for guile-user@gnu.org; Sat, 14 Aug 2021 02:53:30 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:35692) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1mEnXo-0007U2-Gh for guile-user@gnu.org; Sat, 14 Aug 2021 02:53:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=Ufw+UioaIiPW3G3++OnufJ2lbDPqcw+ovxIG2AMok40=; b=I26hiUO+zWHGjiEa441oPeI3H2fNowgBtzbT757wLlHApFoULDzJcbe38CKup2ECYcm+D8aF+P0nRaPrwGBJ5yn5UsDwNZ+gpciRF+H80U7PmCkG/G/Ag/owD17IuwnqPOGN2kJ8G8BJycXlweOp0aqzX7fISHNjHARWXbhwWY3mE7aacwz5/nY9Xxtna2QlLS8h7q669ZExKQq1ldpzV48pIZfcWwZF1Gu4poLvMz49mR8fuNIKUdQh8HmMnn9EBoMp0k7vfaebW1qfLkxDQ+hwOcJMViGx7ZHlKDHp2t+JWTzJcd7s89rE2A+qMcK7DamigVmSoqMGOcyG9lF4AQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1mEnXg-0003O4-1q for guile-user@gnu.org; Sat, 14 Aug 2021 08:53:16 +0200 Content-Disposition: inline In-Reply-To: <598960ee-3baf-dca7-ed88-e128d5eb2fe9@posteo.de> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17684 Archived-At: --kXdP64Ggrk/fb43R Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 13, 2021 at 08:33:33PM +0000, Zelphir Kaltstahl wrote: > Hi Guile users, >=20 > I have some code, in which I wrap procedures in a record, which contains > members, which express the arity of the procedures. For example one struc= t be: >=20 > I don't know whether what you're after is about generalising what a function can be ("callable objects" or similar), or if procedure arity introspection at run time is your ultimate goal. In the second case, there is `procedure-minimum-arity', which might already cater to your wishes :-) (procedure-minimum-arity cons) ; takes two arguments, no "rest" =3D> (2 0 #f) (procedure-minimum-arity +) ; takes at least 0, takes "rest" =3D> (0 2 #t) (let ((foo (lambda (x y . z) ('some-result)))) ; DIY (procedure-minimum-arity foo)) ; at least 2, with "rest" =3D> (2 0 #t) I don't know (yet) what the middle number is for, though ;-) Cheers - t --kXdP64Ggrk/fb43R Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmEXaFwACgkQBcgs9XrR2kakcgCbBEUrfTsI6hHy7cLPJe1UPMjF cxgAoIDO5OP0LII3+ADyq7HOn/yOb53P =uJhm -----END PGP SIGNATURE----- --kXdP64Ggrk/fb43R--