From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.sources Subject: symbol-prefix-proc that allows re-prefixing Date: Sat, 29 May 2004 14:05:34 +0200 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: Reply-To: ttn@glug.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1086007879 17399 80.91.224.253 (31 May 2004 12:51:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 31 May 2004 12:51:19 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon May 31 14:51:13 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BUmG1-0000Xt-00 for ; Mon, 31 May 2004 14:51:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BUmGB-0006Cd-FE for guile-user@m.gmane.org; Mon, 31 May 2004 08:51:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BUmFn-0005zx-TV for guile-user@gnu.org; Mon, 31 May 2004 08:51:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BUmFl-0005yu-PI for guile-user@gnu.org; Mon, 31 May 2004 08:50:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BUmFa-0005wa-Hn; Mon, 31 May 2004 08:50:46 -0400 Original-Received: from [151.38.173.154] (helo=surf.glug.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BUmEx-0002M1-HL; Mon, 31 May 2004 08:50:07 -0400 Original-Received: from ttn by surf.glug.org with local (Exim 3.35 #1 (Debian)) id 1BU2ak-0000sS-00; Sat, 29 May 2004 14:05:34 +0200 Original-To: guile-sources@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:3220 gmane.lisp.guile.sources:129 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3220 example usage: (use-modules ((database postgres) #:renamer (symbol-prefix-proc 'PG|||))) ;;; no `cut' ;; => PG|||pg-exec, ... (use-modules ((database postgres) #:renamer (symbol-prefix-proc 'PG||| 3))) ;;; `cut' ;; => PG|||exec, ... (this will appear in guile 1.4.1.99.) thi _______________________________________________________________ ;; Return a procedure that prefixes its arg (a symbol) with ;; @var{prefix} (also a symbol). Optional arg @var{cut} specifies ;; the number of characters to remove from the head of the original symbol ;; before prefixing (useful for substitution). ;; ;;-sig: (prefix [cut]) ;; (define (symbol-prefix-proc prefix . cut-spec) ;; Insert gratuitous C++ slam here. --ttn (if (null? cut-spec) (lambda (symbol) (symbol-append prefix symbol)) (let ((cut (car cut-spec))) (lambda (symbol) (string->symbol (format #f "~A~A" prefix (substring (symbol->string symbol) cut))))))) _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user