Function call in luminus not returning vector

I have a function called collatz that returns a vector with numbers. when calling collatz in luminus it returns the function not the vector. as a comparison I am calling also a vector and that works. why?


(defn collatz [x]
  [ ""
     {:middleware [middleware/wrap-csrf
   ["/collatz" {:get
    (fn [request] 
      (layout/render request "collatz.html" {:c1 (collatz x) :c2 [1 2 3 4] :docs (-> "docs/" io/resource slurp)}))}]])


        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>request vars</title>
      {% for n in c1 %}
      {% endfor %}
      <h4>c2: {{c2}}</h4>


(ns ksite.handler
    [ksite.middleware :as middleware]
    [ksite.layout :refer [error-page]]
    [ksite.routes.home :refer [home-routes ar dval t1 t2 variab collatz]]
    [reitit.ring :as ring]
    [ring.middleware.content-type :refer [wrap-content-type]]
    [ring.middleware.webjars :refer [wrap-webjars]]
    [ksite.env :refer [defaults]]
    [mount.core :as mount]))

(mount/defstate init-app
  :start ((or (:init defaults) (fn [])))
  :stop  ((or (:stop defaults) (fn []))))

(mount/defstate app-routes
      [(home-routes) (ar) (dval) (t1) (t2) (variab) (collatz 13)])
        {:path "/"})
        (wrap-webjars (constantly nil)))
         (constantly (error-page {:status 404, :title "404 - Page not found"}))
         (constantly (error-page {:status 405, :title "405 - Not allowed"}))
         (constantly (error-page {:status 406, :title "406 - Not acceptable"}))}))))

(defn app []
  (middleware/wrap-base #'app-routes))

so I found the solution, remove the argument in the handler file:

      [(home-routes) (ar) (dval) (t1) (t2) (variab) (collatz 13)])
      [(home-routes) (ar) (dval) (t1) (t2) (variab) (collatz)])

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.