From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: Re: [FEATURE] List all available languages Date: Fri, 25 Jan 2013 17:56:00 +0800 Organization: HFG Message-ID: <1359107760.3676.28.camel@Renee-desktop.suse> References: <1358940518.3676.5.camel@Renee-desktop.suse> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-6ALnhnaVuSvUOuAUkpje" X-Trace: ger.gmane.org 1359107789 19610 80.91.229.3 (25 Jan 2013 09:56:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jan 2013 09:56:29 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Jan 25 10:56:48 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tyg1f-0004vq-B9 for guile-devel@m.gmane.org; Fri, 25 Jan 2013 10:56:47 +0100 Original-Received: from localhost ([::1]:46095 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyg1N-0005sY-WD for guile-devel@m.gmane.org; Fri, 25 Jan 2013 04:56:29 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyg1H-0005bn-17 for guile-devel@gnu.org; Fri, 25 Jan 2013 04:56:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tyg10-0002y4-UZ for guile-devel@gnu.org; Fri, 25 Jan 2013 04:56:22 -0500 Original-Received: from mail-pa0-f42.google.com ([209.85.220.42]:49754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyg10-0002xh-NX for guile-devel@gnu.org; Fri, 25 Jan 2013 04:56:06 -0500 Original-Received: by mail-pa0-f42.google.com with SMTP id rl6so171961pac.29 for ; Fri, 25 Jan 2013 01:56:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:subject:from:to:date:in-reply-to:references :organization:content-type:x-mailer:mime-version; bh=/jKqLI/vu52qbiATqXa2e8l8uXc3kWvWyT3K4de22yY=; b=vHZQ5bQwus3lwFmdlyGi0O285UOKt0PiBUYQxL+TXzItVhdD8+0TgRazdW0BcnyWeQ KJlDGJIksY0CU9ZqMp18UfE7dyx7bDvSNz/l5NPD658qDpmcgowH5O0OjvLtlVNVvJE4 B7Jqyp/VMIG+zZ0cDgTT4EZC1kyETIKR6/wqWPPeFtJULRbdH5UnRbKffzXU0mPLNexO f449NuKTa5dBRDjg1HeSsoCB3xW8WSzsCWyasKZjetLbZTEA1sFsNIrLocEl/g3EPcat BEJ1Wp54Wi93TJjN/eP8lu0CuWrmgKR0Y0UM/6Eg1Q7t5sKhOuukxNx92phr11czKrz1 ebmw== X-Received: by 10.68.252.4 with SMTP id zo4mr12925845pbc.126.1359107765718; Fri, 25 Jan 2013 01:56:05 -0800 (PST) Original-Received: from [147.2.147.112] ([61.14.130.226]) by mx.google.com with ESMTPS id kl3sm402156pbc.15.2013.01.25.01.56.02 (version=SSLv3 cipher=RC4-SHA bits=128/128); Fri, 25 Jan 2013 01:56:04 -0800 (PST) In-Reply-To: <1358940518.3676.5.camel@Renee-desktop.suse> X-Mailer: Evolution 3.4.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.42 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:15588 Archived-At: --=-6ALnhnaVuSvUOuAUkpje Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Wed, 2013-01-23 at 19:28 +0800, Nala Ginrut wrote: > As I talked with Andy, we may add a feature to list all available > languages. And if users add a new language to the %load-path, they may > see it listed out. Besides, this feature could be used in 'guild > compile' to detect all the language available. > > Attached is a proc named 'get-all-available-languages', it'll scan all % > load-path and list the union of the languages available. > > Please review it. > If accepted, I'll format a patch into (ice-9 command-line). > > Thanks! I think Regular Expression would better choice ;-p New patch attached. --=-6ALnhnaVuSvUOuAUkpje Content-Disposition: attachment; filename="lang.scm" Content-Type: text/x-scheme; name="lang.scm"; charset="UTF-8" Content-Transfer-Encoding: 7bit (use-modules (ice-9 ftw) (srfi srfi-1)) (define (not-inner-lang? str) (not (string-match "glil|glil\\.scm|assembly|assembly\\.scm|bytecode|objcode\\.scm|objcode|tree-il|tree-il\\.scm|value|\\.\\.|\\." str))) (define (get-all-available-languages) (let lp((rest (map (lambda (x) (string-append x "/language")) %load-path)) (result '())) (cond ((null? rest) (apply lset-union string=? result)) (else (let ((ll (scandir (car rest) not-inner-lang?))) (lp (cdr rest) (if ll (cons ll result) result))))))) --=-6ALnhnaVuSvUOuAUkpje--