1

Consider this snippet in carmine

(wcar* (car/set "counter" 1)            ;; expect to be number counter=1
       (let [id (car/get "counter")]    ;; expect to have id=1
         (println id)))                 ;; [nil [[SET counter 1] [GET counter]]]

What I am doing wrong here? Is there a way to use let inside wcar* macro?

mishadoff
  • 10,719
  • 2
  • 33
  • 55

1 Answers1

1

You can nest wcar forms which gives you access to the return values inside wcar:

(wcar*
  (car/set "counter" 1)
  (let [id (wcar*
             (car/get "counter"))]
    (println id)
    id))
liwp
  • 6,746
  • 1
  • 27
  • 39