• vi21
    link
    fedilink
    arrow-up
    2
    ·
    3 years ago

    I didn’t know that I can do this in 1.10.

    (defn f [& {:keys [a b]}] (println "A" a " B" b))
    
    • ☆ Yσɠƚԋσʂ ☆OPM
      link
      fedilink
      arrow-up
      2
      ·
      3 years ago

      oh yeah this kind destructuring was a available for a while, although it’s generally better to just pass a map I find.

      • vi21
        link
        fedilink
        arrow-up
        2
        ·
        3 years ago

        I always defined a function like below and passed a map.

        (defn f [{:keys [a b]}] 
           (println a b))
        

        So now I have choices.