Re: Simple list of key-value pairs?

2021-07-09 Thread Aleix Conchillo Flaqué
Hello, I would also use Zelphir's approach and pass query parameters as an alist, the reason is because then you can dynamically generate that alist more easily if needed and even pass it around, and it looks nicer to me but that's a personal choice. I would also actually make that an optional

Re: Simple list of key-value pairs?

2021-07-09 Thread Tim Van den Langenbergh
On Thursday, 8 July 2021 16:37:09 CEST you wrote: > Hi, > > I'm seeking advice for passing simple key-value pairs to a function and > generate a string out of these values. Neither the names not the number > of keys is known in advance. > > Background: This shall become a generic function for

Re: Simple list of key-value pairs?

2021-07-09 Thread Zelphir Kaltstahl
Hi! I think I would give the pairs together in an association list and use alist procedures to work with that. Then you could also only have one backtick, at the start of the alist: `((attr . ,val) (attr . ,val) (attr . ,val) (attr . ,val)) Looks simpler to me and fewer special

Re: Simple list of key-value pairs?

2021-07-08 Thread Luis Felipe
Hi, On Thursday, July 8th, 2021 at 2:37 PM, Hartmut Goebel wrote: > Anyhow, I'm wondering whether the > > quite and quasiquote can be replaced by something simpler. > (api-uri "https://ci.guix.gnu.org; "/api/jobs") > > (api-uri "https://ci.guix.gnu.org; "/api/jobs" > >      `("nr" ,limit)    

Re: Simple list of key-value pairs?

2021-07-08 Thread Christopher Lam
IMO quotes and quasiquotes are being used perfectly well. You can use '(system #f). However I suspect building a list of intermediate strings is not desirable. And we may want to eliminate map and filter. How about building the query-string piecemeal then building the final string once? (define

Simple list of key-value pairs?

2021-07-08 Thread Hartmut Goebel
Hi, I'm seeking advice for passing simple key-value pairs to a function and generate a string out of these values. Neither the names not the number of keys is known in advance. Background: This shall become a generic function for generating URI query-strings. My current approach please