From: Jens Teich
Subject: format syntax for alist
Date: 
Message-ID: <ups1lm79q.fsf@jensteich.de>
(format nil "~{~a=~a~^&~}" '(("a" . "12") ("b" . "13")))
=> "(a . 12)=(b . 13)"

???
=> "a=12?b=13"

Jens

From: Jens Teich
Subject: Re: format syntax for alist
Date: 
Message-ID: <uir7dm410.fsf@jensteich.de>
Jens Teich <····@jensteich.de> writes:

> (format nil "~{~a=~a~^&~}" '(("a" . "12") ("b" . "13")))
> => "(a . 12)=(b . 13)"
>
> ???
> => "a=12?b=13"

(let ((result ""))
   (dolist (pair '(("a" . "12") ("b" . "13")))
     (setq result
           (concatenate 'string result
                        (format nil "~a=~a&" (car pair) (cdr pair)))))
   result)
=> "a=12&b=13&"

is it that complicated?

Jens
From: David Golden
Subject: Re: format syntax for alist
Date: 
Message-ID: <2MBxi.21608$j7.397067@news.indigo.ie>
Are stuck with using conses instead of sublists ?
It's just format has a particularly easy built-in for 
iterating over sublists of lists:

(format nil "~:{~A=~A&~}" '(("a" "12") ("b" "13")))
From: Jens Teich
Subject: Re: format syntax for alist
Date: 
Message-ID: <ubqd4n80o.fsf@jensteich.de>
David Golden <············@oceanfree.net> writes:

> Are stuck with using conses instead of sublists ?

The list of dotted pairs is generated by Edi's hunchentoot.

> (format nil "~:{~A=~A&~}" '(("a" "12") ("b" "13")))

Ah thanks.

Jens
From: David Golden
Subject: Re: format syntax for alist
Date: 
Message-ID: <jyFxi.21612$j7.397087@news.indigo.ie>
Jens Teich wrote:

> David Golden <············@oceanfree.net> writes:
> 
>> Are stuck with using conses instead of sublists ?
> 
> The list of dotted pairs is generated by Edi's hunchentoot.
> 
... Yes, it's an alist...

But given what it looks like you're doing, have you
seen e.g. http://weitz.de/url-rewrite/

- see "add-get-param-to-url"

(you'll already have this if you're using hunchentoot...)
From: Jens Teich
Subject: Re: format syntax for alist
Date: 
Message-ID: <u7insn2sa.fsf@jensteich.de>
David Golden <············@oceanfree.net> writes:

> Jens Teich wrote:
>
>> David Golden <············@oceanfree.net> writes:
>> 
>>> Are stuck with using conses instead of sublists ?
>> 
>> The list of dotted pairs is generated by Edi's hunchentoot.
>> 
> ... Yes, it's an alist...
>
> But given what it looks like you're doing, have you
> seen e.g. http://weitz.de/url-rewrite/
>
> - see "add-get-param-to-url"
>
> (you'll already have this if you're using hunchentoot...)

Oops, reinventing the wheel ...

Thanks for the hint

Jens