Skip to content

Commit

Permalink
fix DEFINE-COMPAT...
Browse files Browse the repository at this point in the history
  • Loading branch information
stylewarning committed Mar 26, 2021
1 parent e5ce37d commit c97520b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/dev-how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ alternative implementations of `matmul`. We can do this by "defining
MAGICL-compatible behavior" on the generic function, like so:

```
(define-compatible-no-applicable-method-behavior matmul-lisp)
(defgeneric matmul-lisp (a b)
(:method ((a matrix) (b matrix))
; ...
))
(define-compatible-no-applicable-method-behavior matmul-lisp)
```

Without the `define-compat...` line, a failure to find the method will
Expand All @@ -131,11 +131,11 @@ If we wanted to accelerate `matmul` with BLAS, we could implement
`matmul` in the BLAS extension. There, we might write:

```
(magicl:define-compatible-no-applicable-method-behavior matmul-blas)
(defgeneric matmul-blas (a b)
(:method ((a matrix/double-float) (b matrix/double-float))
;; ...
))
(magicl:define-compatible-no-applicable-method-behavior matmul-blas)
(magicl:define-backend-implementation magicl:matmul :blas 'matmul-blas)
```

Expand Down
2 changes: 1 addition & 1 deletion src/backend-function.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Without using this, a backend function may error if no method is found."
,@(loop
:for name :in generic-function-names
:collect
`(defmethod cl:no-applicable-method ((gf (eql ',name)) &rest args)
`(defmethod cl:no-applicable-method ((gf (eql #',name)) &rest args)
(declare (ignore args))
(no-applicable-implementation ',name)))))

Expand Down
2 changes: 1 addition & 1 deletion src/high-level/util.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@
,@(unless (magicl.backends:backend-function-p fun-name)
(list
`(define-backend-function ,fun-name ,lambda-list ,@(if doc-string (list doc-string)))))
(define-compatible-no-applicable-method-behavior ,fun-name-backend)
(defgeneric ,fun-name-backend ,lambda-list ,@options)
(define-compatible-no-applicable-method-behavior ,fun-name-backend)
(define-backend-implementation ,fun-name ,backend ',fun-name-backend))))

0 comments on commit c97520b

Please sign in to comment.