[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rest arguments in let-keywords

From: Thien-Thi Nguyen
Subject: Re: rest arguments in let-keywords
Date: Thu, 19 May 2005 02:31:17 -0400

   On Tue, 2005-05-17 at 21:07 -0500, Mario Storti wrote:

   > Is there an easy way to get the rest arguments _without_
   > the keyword arguments?

i use `remove-keys', appended.  munge to taste.


;;; ttn/optargs-kw-utils.scm --- make using (ice-9 optargs-kw) easier

;; Rel:v-0-41-pianto-due-ore
;; Copyright (C) 2003-2005 Thien-Thi Nguyen
;; This file is part of ttn's personal scheme library, released under GNU
;; GPL with ABSOLUTELY NO WARRANTY.  See the file COPYING for details.

;;; Commentary:

;; This module exports:
;;  (remove-keys ls)

;;; Code:

(define-module (ttn optargs-kw-utils)
  #:export (remove-keys))

(define (remove-keys ls)
  (let loop ((ls ls) (acc '()))
    (if (null? ls)
        (reverse! acc)
        (let ((kw? (keyword? (car ls))))
          (loop ((if kw? cddr cdr) ls)
                (if kw? acc (cons (car ls) acc)))))))

;;; ttn/optargs-kw-utils.scm ends here

reply via email to

[Prev in Thread] Current Thread [Next in Thread]