From: Kevin Ryde <user42@zip.com.au>
Subject: srfi-1 circular-list
Date: Sat, 20 Mar 2004 08:11:27 +1000 [thread overview]
Message-ID: <87fzc4h4hc.fsf@zip.com.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 103 bytes --]
* srfi-1.scm (circular-list): Rewrite using set-cdr!, no need to copy
parameter list.
[-- Attachment #2: srfi-1.scm.circular-list.diff --]
[-- Type: text/plain, Size: 956 bytes --]
--- srfi-1.scm.~1.31.~ 2003-12-03 07:14:46.000000000 +1000
+++ srfi-1.scm 2004-03-18 14:59:56.000000000 +1000
@@ -1,6 +1,6 @@
;;; srfi-1.scm --- List Library
-;; Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
;;
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -247,16 +247,10 @@
acc
(lp (- n 1) (cons (init-proc (- n 1)) acc)))))
-(define (circular-list elt1 . rest)
- (let ((start (cons elt1 '())))
- (let lp ((r rest) (p start))
- (if (null? r)
- (begin
- (set-cdr! p start)
- start)
- (begin
- (set-cdr! p (cons (car r) '()))
- (lp (cdr r) (cdr p)))))))
+(define (circular-list . lst)
+ (if (not (null? lst))
+ (set-cdr! (last-pair lst) lst))
+ lst)
(define (iota count . rest)
(check-arg-type non-negative-integer? count "iota")
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
next reply other threads:[~2004-03-19 22:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-19 22:11 Kevin Ryde [this message]
2004-03-19 22:24 ` srfi-1 circular-list Paul Jarc
2004-03-19 22:32 ` Kevin Ryde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fzc4h4hc.fsf@zip.com.au \
--to=user42@zip.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).