Skip to content

Commit 6b49aee

Browse files
YarinHeffesstylewarning
authored andcommitted
Updated dev docs with extend-function macro
1 parent 104c9fb commit 6b49aee

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

doc/dev-how-to.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ Let's say we want to add a fused multiply-add function called
3333

3434
This defines `fma` as the main API function, and `fma-lisp` as the
3535
generic function implementing `fma`. If we want to implement `fma` in
36-
a specific backend, we can use the same form, but adding the backend's
37-
name as an option. For example, if we are implementing this function
38-
with BLAS acceleration, we can specify the `:blas` backend:
36+
a specific backend, we can use `extend-function` to extend `fma` into the backend. For example, if we are extending this function
37+
with BLAS acceleration, we can specify the `:blas` backend and write,
3938

4039
```
41-
(define-extensible-function (fma fma-blas :blas) (a x b)
40+
(extend-function (fma fma-blas :blas) (a x b)
4241
(:method (a x b)
4342
(some-funny-blas-function a x b)))
4443
```
@@ -198,17 +197,20 @@ specify two names. The above code makes the `matmul` backend function
198197
as implemented by the `matmul-lisp` generic function.
199198

200199
Later on, when implementing the BLAS accelerated `matmul`, we can use
201-
`define-extensible-function` and specify the backend we're defining it
202-
for.
200+
`extend-function` and specify the backend we're extending it
201+
with.
203202

204203
```
205204
;; in BLAS extension
206-
(define-extensible-function (matmul matmul-blas :blas) (a b)
205+
(extend-function (matmul matmul-blas :blas) (a b)
207206
(:method (a b)
208207
;; ...
209208
))
210209
```
211210

211+
As the names imply, `define-extensible-function` defines a backend function and extends it,
212+
and `extend-function` extends an already-defined backend function.
213+
212214
In general, we suggest always having a pure Lisp version if feasible.
213215

214216

0 commit comments

Comments
 (0)