unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Daniel Kraft <d@domob.eu>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Emacs Lisp, macros
Date: Fri, 24 Jul 2009 00:09:53 +0200	[thread overview]
Message-ID: <m3fxcnf3v2.fsf@pobox.com> (raw)
In-Reply-To: <4A5CE0F9.4080904@domob.eu> (Daniel Kraft's message of "Tue, 14 Jul 2009 21:48:09 +0200")

Hello!

On Tue 14 Jul 2009 21:48, Daniel Kraft <d@domob.eu> writes:

> (defun primep (p &optional from)
>   (let ((i (if from from 2)))
>     (while (and (/= (% p i) 0) (<= (* i i) p))
>       (setq i (1+ i)))
>     (/= (% p i) 0)))
>
> (primep 1283939) -> #t

This is fantastic.

> While of course the #f should be %nil, this is simply because I use #f
> at the moment for nil (but that will be redefined once the falsity of
> %nil is corrected).

Yes. Hopefully we can pull in Mark's patch by the next release.

> For macros (and also for funcall/apply, which ought to be able to
> execute functions in form of an uncompiled list like '(lambda (a b) (+ a
> b))) I will probably need some means of compiling and executing a
> certain piece of code 'by hand' from within compilation.  It seems that
> I can do something along
>
> ((compile <my code here> #:from 'elisp) arguments to compiled code)

Yes this is exactly right.

> Regarding the test-suite:  It seems to me there's no 'very extensive'
> and 'complete' single test-suite for guile at the moment, but I might be
> mistaken.  So maybe I should create testsuite/elisp and a
> run-elisp-tests.scm like the one for vm which loads/compiles/runs and
> all that the individual tests?  Or is there some existing framework I
> can plug my tests into?

You should add tests under test-suite/test/elisp.test (note the dash),
and add your file to TESTS in test/Makefile.am. But you've probably
figured that out already :)

Happy hacking,

Andy
-- 
http://wingolog.org/




      parent reply	other threads:[~2009-07-23 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 19:48 Emacs Lisp, macros Daniel Kraft
2009-07-14 22:15 ` Ludovic Courtès
2009-07-15  8:36   ` Daniel Kraft
2009-07-23 22:14     ` Andy Wingo
2009-07-24  7:00       ` Daniel Kraft
2009-07-23 22:09 ` Andy Wingo [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=m3fxcnf3v2.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=d@domob.eu \
    --cc=guile-devel@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).