From 73a4bfc3d8e9bb5365e33a11a6ad3b8340d5195b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sun, 12 Jun 2022 21:09:35 +0200 Subject: Remove custom let*. While it was nice, the most important part was the multi-valued let from srfi-71 (which is implemented in srfi-71)). The minor pattern matching structures could often be replaced with car+cdr, or a propper match. --- module/web/query.scm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'module/web/query.scm') diff --git a/module/web/query.scm b/module/web/query.scm index a70903bc..2d62b45d 100644 --- a/module/web/query.scm +++ b/module/web/query.scm @@ -1,6 +1,7 @@ (define-module (web query) :use-module (hnh util) :use-module (srfi srfi-1) + :use-module (srfi srfi-71) :use-module (web uri)) (define*-public (parse-query query-string optional: (encoding "UTF-8")) @@ -8,12 +9,12 @@ (fold (lambda (str list) ;; only split on the first equal. ;; Does HTTP allow multiple equal signs in a data field? - (let* ((key val - (cond ((string-index str #\=) - => (lambda (idx) - (values (uri-decode (substring str 0 idx) encoding: encoding) - (uri-decode (substring str (1+ idx)) encoding: encoding)))) - (else (let ((v (uri-decode str encoding: encoding))) - (values v v)))))) + (let ((key val + (cond ((string-index str #\=) + => (lambda (idx) + (values (uri-decode (substring str 0 idx) encoding: encoding) + (uri-decode (substring str (1+ idx)) encoding: encoding)))) + (else (let ((v (uri-decode str encoding: encoding))) + (values v v)))))) (cons* (-> key string->symbol symbol->keyword) val list))) '() (string-split query-string #\&)))) -- cgit v1.2.3