From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Kraft Newsgroups: gmane.lisp.guile.devel Subject: Emacs Lisp, macros Date: Tue, 14 Jul 2009 21:48:09 +0200 Message-ID: <4A5CE0F9.4080904@domob.eu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1247600917 19384 80.91.229.12 (14 Jul 2009 19:48:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Jul 2009 19:48:37 +0000 (UTC) Cc: guile-devel To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 14 21:48:30 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MQnzK-0007RJ-4j for guile-devel@m.gmane.org; Tue, 14 Jul 2009 21:48:30 +0200 Original-Received: from localhost ([127.0.0.1]:43111 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQnzJ-0004cF-Ky for guile-devel@m.gmane.org; Tue, 14 Jul 2009 15:48:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MQnyg-0004M4-DD for guile-devel@gnu.org; Tue, 14 Jul 2009 15:47:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MQnyb-0004Ip-LX for guile-devel@gnu.org; Tue, 14 Jul 2009 15:47:49 -0400 Original-Received: from [199.232.76.173] (port=53174 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQnyb-0004Id-8a for guile-devel@gnu.org; Tue, 14 Jul 2009 15:47:45 -0400 Original-Received: from taro.utanet.at ([213.90.36.45]:37204) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MQnya-0006Sp-HH for guile-devel@gnu.org; Tue, 14 Jul 2009 15:47:44 -0400 Original-Received: from plenty.xoc.tele2net.at ([213.90.36.8]) by taro.utanet.at with esmtp (Exim 4.69) (envelope-from ) id 1MQnyY-0003eR-IQ; Tue, 14 Jul 2009 21:47:42 +0200 Original-Received: from d86-33-197-33.cust.tele2.at ([86.33.197.33] helo=[192.168.1.18]) by plenty.xoc.tele2net.at with esmtpa (Exim 4.69) (envelope-from ) id 1MQnyY-0003kl-DP; Tue, 14 Jul 2009 21:47:42 +0200 User-Agent: Thunderbird 2.0.0.0 (X11/20070425) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8870 Archived-At: Hi Andy and all, yesterday and today I implemented lambda expressions and defvar/defconst/defun for elisp as well as found a (hopefully good) solution to automatically create fluids not yet present on reference. With these additions and some basic built-ins (mainly arithmetic/numbers so far, but trivial to extend), I think elisp is already quite usable as a language for simple tasks. I just pushed the elisp branch with my additions. For instance, this simple code works in guile's elisp language: ; Check if p is prime, but start looking for divisors at from if ; present. It seems that recursion using anonymous functions is ; not that nicely to do in elisp as in scheme (at least not before ; defining funcall/apply), so this is done using while. (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 (primep 1283937) -> #f (primep 1283937 1000) -> #t 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). Besides some "important" built-ins like makunbound, boundp, set, funcall, apply, fset and others, I think the next big thing to work on will be macro support (for a more extensive list of implemented things and stuff still missing see module/language/elisp/README) as well as a real testsuite. 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 #:from 'elisp) arguments to compiled code) to do this; or is there some other way to do this that would be better for this situation? 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? Good night! Daniel -- Done: Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz To go: Hea-Kni-Mon-Pri