From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alin Soare Newsgroups: gmane.emacs.devel Subject: Generating an unique symbol in elisp Date: Fri, 3 Dec 2010 23:19:41 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00151750ea12b59e9a0496881886 X-Trace: dough.gmane.org 1291411199 6631 80.91.229.12 (3 Dec 2010 21:19:59 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Dec 2010 21:19:59 +0000 (UTC) To: Emacs Dev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 03 22:19:55 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1POd2p-0002It-1J for ged-emacs-devel@m.gmane.org; Fri, 03 Dec 2010 22:19:55 +0100 Original-Received: from localhost ([127.0.0.1]:38796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POd2o-0003DN-DE for ged-emacs-devel@m.gmane.org; Fri, 03 Dec 2010 16:19:54 -0500 Original-Received: from [140.186.70.92] (port=59053 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POd2e-0003BV-S7 for emacs-devel@gnu.org; Fri, 03 Dec 2010 16:19:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POd2c-0004EL-H4 for emacs-devel@gnu.org; Fri, 03 Dec 2010 16:19:44 -0500 Original-Received: from mail-yw0-f41.google.com ([209.85.213.41]:58723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POd2c-0004E3-Cl for emacs-devel@gnu.org; Fri, 03 Dec 2010 16:19:42 -0500 Original-Received: by ywk9 with SMTP id 9so934190ywk.0 for ; Fri, 03 Dec 2010 13:19:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=sPc1RrHkzL9L8Tv6mtE0zeqkjO3kdDOzREDreFDF7NU=; b=Yix1eiFwRU4EQwJm+SBWsQc649fOonDa6ZBAKjxb3OQQtei+L/ReEJkK3ifzBsL9fn jDnKDu32UbVsnURruW009RkugmrkwUZTh4G+t4a6q5KFOHdiGxVzEKEUAl+WxSeK8g7r J11Ynwl0E+8BnUdTVa9vl4NhQZKBV76RbdihA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=tsOm1QgF78P25DdUyLN4dC7FiWIEDtyNFMcG3rnEmrckLJ9WBLpMNd9+Agiil1iJoA N9+wTxehkcNHewNRTbmVExU9SZYkxEck26KUjW6BWTO6oYrlpEssMt0TlrnGORn5ue1n Sqo3u+QL8Dwzkfw+JyEHimcxuAiGExsPCqFRA= Original-Received: by 10.151.51.3 with SMTP id d3mr4487503ybk.388.1291411181116; Fri, 03 Dec 2010 13:19:41 -0800 (PST) Original-Received: by 10.150.95.21 with HTTP; Fri, 3 Dec 2010 13:19:41 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133352 Archived-At: --00151750ea12b59e9a0496881886 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable A very useful function for generating private environments is the (gensym&optional x) in common lisp. It can replace in some places the closures. In Clisp it is defined in C something like this: char* gensym (char *x) { static int x; char a[100]; snprintf(a, 100, "%s%d", x? x:"G", x++); return strdup (a); } Does this function already exist in elisp ? I looked in the manual and did not find it... Alin * --- * Wenn ich 'Kultur' h=C3=B6re, nehme ich meine Pistole Hermann G=C3=B6ring * * --00151750ea12b59e9a0496881886 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable A very useful function for generating private environments is the (gensym&a= mp;optional x) in common lisp. It can replace in some places the closures.<= br>

In Clisp it is defined in C something like this:

char* gensym (char *x)
{
=C2=A0static int x;
=C2=A0char a[100];
=C2= =A0snprintf(a, 100, "%s%d", x? x:"G",=C2=A0 x++);
= =C2=A0return strdup (a);
}

Does this function already exist in el= isp ? I looked in the manual and did not find it...


Alin


---

Wenn ich 'Kultur' h=C3=B6= re, nehme ich meine Pistole
Hermann G=C3=B6ring

--00151750ea12b59e9a0496881886--