public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Chuah Teong Leong <teongleong@gmail.com>
To: kawa@sourceware.org
Subject: numArgs of a lambda procedure
Date: Sun, 12 Aug 2012 07:10:00 -0000	[thread overview]
Message-ID: <CAHxu6d-6HAa3X435f9gxadhBSvvNscvWo3uFSuRrCzXnHDROQg@mail.gmail.com> (raw)

Is there a simple way to get the number of required arguments from a
procedure object?

I tried the following

(define lamb0 (lambda () #f)
(define lamb1 (lambda (a) #f)
(define lamb2 (lambda (a b) #f)
(define lamb3 (lambda (a b c) #f)
(define lamb4 (lambda (a b c d) #f)

(display lamb0:numArgs)(newline)

(display lamb1:numArgs)(newline)

(display lamb2:numArgs)(newline)

(display lamb3:numArgs)(newline)

(display lamb4:numArgs)(newline)

0
4097
8094
12291
16388

Through this i can just match the value for 0 to 4 but I'm thinking
there must be a more orthodox means to do this.

Is there something I can do like
(procedure-property lamb0 'num-args)
to get the number of arguments?

Thank you in advance

             reply	other threads:[~2012-08-12  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-12  7:10 Chuah Teong Leong [this message]
2012-08-12  7:22 ` Per Bothner

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=CAHxu6d-6HAa3X435f9gxadhBSvvNscvWo3uFSuRrCzXnHDROQg@mail.gmail.com \
    --to=teongleong@gmail.com \
    --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).