Used in a Sentence

defun

How to use defun in a sentence. Live example sentences for defun pulled from indexed public discussions.

Editorial note

Just find a defun, eval it via C-u C-M-x and you'll get breakpoint at the defun entry.

Examples15
Definitions0
Parts of speech1

Quick take

Just find a defun, eval it via C-u C-M-x and you'll get breakpoint at the defun entry.

Example sentences

1

Just find a defun, eval it via C-u C-M-x and you'll get breakpoint at the defun entry.

2

TXR Lisp: @(do (macro-time (defun abc-proc (n) ^(defun,n () (pprinl ',n)))) (defmacro abc-procs (.

3

I've seen implicit rules about top-level expression being implicitely wrapped in parens you one can write defun fact (n) (cond..

4

Maybe interchangeable is not the right word here (defun edible.in.large.amounts?

5

At least in the variants of lisp I've used, defining a function would be done using defun, not define, so yeah, probably.

6

'(1 2 3) is just like [1,2,3] (defun x (a b c...)...) defines a function x(a,b,c).

7

YC + all of YC's internal applications, there are 738 calls to def (= CL defun) and 187 calls to mac (= CL defmacro).

8

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

9

(defun normalize-probabilities (probabilities) (mapcar (lambda (x) (- 1 x)) probabilities)) Ok.

10

With lcons, I we can make a fibonacci function quite similarly to how you might do it in Haskell: (defun fib2 (a b) (lcons a (fib2 b (+ a b)))) We call this as (fib 1 1) and it gives us a lazy list.

11

Doesn't look like anything more than a sexp reader; very limited (I am guessing a 1-2 day hack.) All it has are: atom, eq, car, cdr, cons, cond, lambda, define (for variables!) and defun.

12

If you want to run on more than one Lisp, it's trivial: (defun spawn (name fn) #+ccl (ccl:process-run-function name fn) #+lispworks (mp:process-run-function name nil fn) #+sbcl (sb-thread:make-thread fn:name name)) I wouldn't use CL as a do-everything language either, but it's typically a superb place to be if you're trying to do anything complex.

Quote examples

1

Should we return a thunk?): (defun unless (condition branch) (if condition nil (branch)));; Works (unless keep (lambda () (delete-file "foo.txt"))) - Implement a macro system.

2

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

3

(defun cc () "Secrets File" (interactive) (find-file "/home/ajross/.cc.gpg")) Launch with "M-x cc" (which is simple enough) or bind to a keystroke.

Frequently asked questions

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

How do you use defun in a sentence?

Just find a defun, eval it via C-u C-M-x and you'll get breakpoint at the defun entry.