@@ -33,12 +33,11 @@ Let's say we want to add a fused multiply-add function called
33
33
34
34
This defines ` fma ` as the main API function, and ` fma-lisp ` as the
35
35
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,
39
38
40
39
```
41
- (define-extensible -function (fma fma-blas :blas) (a x b)
40
+ (extend -function (fma fma-blas :blas) (a x b)
42
41
(:method (a x b)
43
42
(some-funny-blas-function a x b)))
44
43
```
@@ -198,17 +197,20 @@ specify two names. The above code makes the `matmul` backend function
198
197
as implemented by the ` matmul-lisp ` generic function.
199
198
200
199
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 .
203
202
204
203
```
205
204
;; in BLAS extension
206
- (define-extensible -function (matmul matmul-blas :blas) (a b)
205
+ (extend -function (matmul matmul-blas :blas) (a b)
207
206
(:method (a b)
208
207
;; ...
209
208
))
210
209
```
211
210
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
+
212
214
In general, we suggest always having a pure Lisp version if feasible.
213
215
214
216
0 commit comments