Keyword arguments...

Subject: Keyword arguments...
From: Alexander Taranov <tay@xxxxxxxxxx>
Date: Thu, 6 Aug 1998 18:59:11 +0400 (MSD)
Norman Walsh writes:
 > Is it the case, as it appears to be, that in user-defined
 > functions with keyword arguments, the keyword arguments must
 > always appear last?
 > 
 > I'd like to define a function, "make-element", so that it could
 > be used just like the sgml backend's "make element" function.
 > 
 >   (make-element gi: "foo" attributes: '() some-sosofo)
 > 
 > But it seems I'm stuck with either
 > 
 >   (make-element some-sosofo gi: "foo" attributes: '())
 > 
 > or 
 > 
 >   (make-element gi: "foo" attributes: '() sosofo: some-sosofo)
 > 
 > Is that the case, or am I overlooking something?
To my knowlege that's the case.
to begin with keyword args MUST appear in pairs -- key - value
Once i wrote such fucnction and here it is:

;;; (html-markup 'tag' [attrs: 'list of attr/val lists'] sosofo ...)
;;; results in tagging (with opt attributes) of sosofos
(define (html-markup tag #!rest args)
  (let* (
	 (tag (force-string tag))
	 (atrs? (member attrs: args))
	 (atrs (if atrs? (car (cdr atrs?)) #f))
	 (sfs (if atrs? (cdr (cdr atrs?)) args)))
    (sosofo-append
     (make formatting-instruction
	   data: (string-append "<" 
				tag
				(html-attrlist atrs) 
				">"))
     (if (null? sfs) (current-node) (apply sosofo-append sfs))
     (make formatting-instruction
	   data: (string-append "</" tag ">"))
     *newline*)))

-tay

 > 
 >                                         Cheers,
 >                                           norm
 > -- 
 > Norman Walsh <ndw@xxxxxxxxxx>      | Whatever you do may seem
 > http://nwalsh.com/                 | insignificant, but it is most
 >                                    | important that you do it.--Ghandi
 > 
 > 
 >  DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


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


Current Thread
  • Keyword arguments...
    • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id KAA18411Thu, 6 Aug 1998 10:45:24 -0400 (EDT)
      • Alexander Taranov - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA19001Thu, 6 Aug 1998 11:00:23 -0400 (EDT) <=
      • Paul Prescod - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA21125Thu, 6 Aug 1998 11:58:55 -0400 (EDT)
      • Brandon Ibach - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id LAA21156Thu, 6 Aug 1998 11:59:10 -0400 (EDT)
      • James Clark - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA21957Thu, 6 Aug 1998 12:13:10 -0400 (EDT)
        • Norman Walsh - from mail1.ability.netby web4-1.ability.net (8.8.5/8.6.12) with ESMTP id MAA22678Thu, 6 Aug 1998 12:27:48 -0400 (EDT)