[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs Lisp, macros
From: |
Andy Wingo |
Subject: |
Re: Emacs Lisp, macros |
Date: |
Fri, 24 Jul 2009 00:09:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) |
Hello!
On Tue 14 Jul 2009 21:48, Daniel Kraft <address@hidden> 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/