• Skip to primary navigation
  • Skip to content
  • Skip to footer
Clojure Diary Clojure Diary
  • Book
  • Code
  • Videos
  • Donate

    Porting single argument function to accept multiple arguments

    less than 1 minute read

    Notes

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    ;; porting_single_argument_function_to_accept_multiple_arguments.clj
    
    (defn say-hi
      ([name] (str "Hi " name))
      ([name & many-names] (map say-hi (conj many-names name))))
    
    (say-hi "Karthik")
    
    (map say-hi ["Karthik" "Mathew" "Orangutaan"])
    
    (say-hi "Karthik" "Mathew" "Orangutaan")
    

    Updated: June 6, 2023

    Twitter Facebook LinkedIn
    Previous Next

    You May Also Enjoy

    Understanding Clojure reduce better

    less than 1 minute read

    Parsing GraphQL with Clojure

    less than 1 minute read

    Three personal software products I created with Clojure

    less than 1 minute read

    factorial in Clojure. Using memonize. Numeric Data Types.

    less than 1 minute read

    • Feed
    © 2025 Clojure Diary. Powered by Jekyll & Minimal Mistakes.