Used in a Sentence

defn

Definition, parts of speech, synonyms, and sentence examples for defn.

Editorial note

For example, in Clojure: (defn foo [list] (defn n-to-nth [n] (Math/pow n n)) (map n-to-nth list)) Would intern the symbol 'n-to-nth in the current namespace.

Examples16
Definitions1
Parts of speech1

Quick take

Abbreviation of definition. [(semantics, lexicography) A statement of the meaning of a word, word group, sign, or symbol; especially, a dictionary definition.]

Meaning at a glance

The clearest senses and uses of defn gathered in one view.

noun

Abbreviation of definition. [(semantics, lexicography) A statement of the meaning of a word, word group, sign, or symbol; especially, a dictionary definition.]

Definitions

Core meanings and parts of speech for defn.

noun

Abbreviation of definition. [(semantics, lexicography) A statement of the meaning of a word, word group, sign, or symbol; especially, a dictionary definition.]

Example sentences

1

For example, in Clojure: (defn foo [list] (defn n-to-nth [n] (Math/pow n n)) (map n-to-nth list)) Would intern the symbol 'n-to-nth in the current namespace.

2

The `if-match` macro you describe could be written as a function, albeit with less pleasing syntax: (defn if-match [pat expr then else] (if-let [match (if (fn?

3

(defn next-happy [n] (reduce + (map #(* % %) (int-to-digits n)))) (defn happy?

4

This makes implementing defn (and by extension a user macro like it) much easier.

5

I'm used to Lisps, where def/defun/define/defn imply internment.

6

- Gratuitous use of [] in some forms; mainly defn and let.

7

But defn, I didn't find them surprising.

8

(defn int-to-digits [n] (map #(Character/getNumericValue %) (str n))) (I had to Google Character/getNumericValue - doubt anyone expects you to memorize that).

9

I would feel uncomfortable to use the quotest to define something, like: fact 'defn arity func' I think it would cause problems to have a good syntax hihlighting in the text editor.

10

(defn f [a:- Dyn]:- Dyn a) Running (inc (f 1)) would wrap 1 in Dyn, then a Dyn exits as a return value, so no further wrapping is needed.

11

While I agree that C# has a non-trivial class boilerplate and non-zero function boilerplate, the Clojure you quoted doesn't even show any function boilerplate (defn foo [args] body) I compared a C# 3 expression to a Clojure expression.

12

(defn [items] [:ul.items (for [item items] [:li.item (:display-name item)]])]) Then whenever you change the state of 'items', the component will automatically re-render and inject the new DOM as necessary using React's diffing algorithm for high performance.

Quote examples

1

It's true that the PD also "shows why two purely 'rational' individuals might not cooperate" but that is not part of the defn of PD.

2

(defn hello [] (println "hello world")) (hello);; in Clojure (defun hello () (format t "hello world")) (hello);; in Common Lisp.

3

The same code in Clojure: (let [hello (fn [] (println "Hello World"))] (hello)) Or assuming hello is a global in your dart example: (defn hello [] (println "Hello World")) (hello) Nothing too complicated about that.

4

Check out clojure core's min function: (defn ^number min "Returns the least of the nums." ([x] x) ([x y] (cljs.core/min x y)) ([x y & more] (reduce min (cljs.core/min x y) more))) So there are occasions for this related to efficiency.

Frequently asked questions

Short answers drawn from the clearest meanings and examples for this word.

How do you use defn in a sentence?

For example, in Clojure: (defn foo [list] (defn n-to-nth [n] (Math/pow n n)) (map n-to-nth list)) Would intern the symbol 'n-to-nth in the current namespace.

What does defn mean?

Abbreviation of definition. [(semantics, lexicography) A statement of the meaning of a word, word group, sign, or symbol; especially, a dictionary definition.]

What part of speech is defn?

defn is commonly used as noun.