Skip to content

cljr create fn from example

John Jacobsen edited this page Oct 18, 2015 · 3 revisions

fe Create function from example

When you have a function in mind that you eventually want to create you can just type out its signature as it is used, for example:

(defn my-lovely-fn [some-param]
  (let [foo (util-fn some-param)]
    (other-fn some-param foo)))

Then invoking create function stub from example fe will create the appropriate stub for you:

(defn other-fn [some-param foo]
  )

(defn my-lovely-fn [some-param]
  (let [foo (util-fn some-param)]
    (other-fn some-param foo)))

In case your params for the new function are not symbols the feature will replace them with a generated param name:

(defn other-fn [some-param arg1]
  )

(defn my-simple-fn [some-param]
  (other-fn some-param (util-fn some-param)))