From 9e05d58880cf2e65df1fead137969cde70b95947 Mon Sep 17 00:00:00 2001 From: Hannu Hartikainen Date: Fri, 5 Oct 2018 13:27:56 +0300 Subject: [PATCH] Fix reader conditional example The previous example only worked by accident (because there was an even number of map keys with conditional values). {:get #?(:clj 1), :post #?(:clj 2)} gets read as {:get :post} in a non-clj context. The splicing reader conditional or a :cljs (or :default) value is needed to have the code work as intended. Here we change the docs to use the splicing version, as that is (imho) more beautiful than adding another branch. --- doc/advanced/shared_routes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/advanced/shared_routes.md b/doc/advanced/shared_routes.md index 3c8e2172..b45144c0 100644 --- a/doc/advanced/shared_routes.md +++ b/doc/advanced/shared_routes.md @@ -17,8 +17,8 @@ There are multiple options to use shared routing table. (def routes ["/kikka" {:name ::kikka - :get #?(:clj {:handler get-kikka}) - :post #?(:clj {:handler post-kikka})}]) + #?@(:clj [:get {:handler get-kikka}]) + #?@(:clj [:post {:handler post-kikka}])}]) ``` ## Using custom expander