Re: Case independence and (case)

Subject: Re: Case independence and (case)
From: Tony Graham <tgraham@xxxxxxxxxxxxxxxx>
Date: Fri, 17 Apr 1998 22:35:05 -0400 (EDT)
At 17 Apr 1998 19:12 -0400, Russell Steven Shawn O'Connor wrote:
 > On Fri, 17 Apr 1998, Chris Maden wrote:
 > 
 > > (assoc) isn't part of dsssl-o, and Jade 1.1's documentation doesn't
 > > list it among the supported additional procedures.  Otherwise yes, it
 > > would be perfect for what I'm trying to do in this case.
 > 
 > Everytime I find that Jade doesn't support a function in the standard
 > that I want to use, I write my own:
 > 
 > (define (assoc elm lst)
 >         (cond ((null? lst) #f)
 >               ((equal? elm (caar lst)) (car lst))
 >               (#t (assoc elm (cdr lst)))
 >         )
 > )

There is also a version of assoc in the DSSSL procedure library (part
of the DSSSL documentation project) at
http://www.mulberrytech.com/dsssl/dsssldoc/procedures

(define (assoc obj alist)
  ;; Given an associative list, returns the pair that has obj as a car
  ;; or #f if no such pair exists
  ;; (("a" "b") ("c" "d")), "a" => ("a" "b")
  (let loop ((al alist))
    (if (null? al)
	#f
	(if (equal? obj (car (car al)))
	    (car al)
	    (loop (cdr al))))))

Contributions (marked up to DocBook 3.0) are always welcome.

Regards,


Tony Graham
=======================================================================
Tony Graham
Mulberry Technologies, Inc.                         Phone: 301-315-9632
17 West Jefferson Street, Suite 207                 Fax:   301-315-8285
Rockville, MD USA 20850                 email: tgraham@xxxxxxxxxxxxxxxx
=======================================================================


 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread
  • HTML table stylesheet announcement (was Case independence and (case)), (continued)
      • Chris Maden - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id QAA01928Fri, 17 Apr 1998 16:32:27 -0400 (EDT)
    • Reynolds, Gregg - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id QAA02506Fri, 17 Apr 1998 16:59:50 -0400 (EDT)
      • Chris Maden - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id RAA02755Fri, 17 Apr 1998 17:11:13 -0400 (EDT)
        • Russell Steven Shawn O'Connor - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id TAA04352Fri, 17 Apr 1998 19:16:48 -0400 (EDT)
        • Tony Graham - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id WAA06429Fri, 17 Apr 1998 22:43:23 -0400 (EDT) <=
        • Russell Steven Shawn O'Connor - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA18706Sat, 18 Apr 1998 12:44:17 -0400 (EDT)
        • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id UAA13060Thu, 23 Apr 1998 20:51:52 -0400 (EDT)