Haruo Wakakusa
Haruo Wakakusa

Reputation: 137

Infix Notation Macros In Common Lisp

I want to introduce some normal mathematical expressions to Common Lisp. For example, if I call the above macro "exp":

(exp 2 + 3) => 5
(let ((a 2) (b 5) (c 3))
  (exp 2 + 3 * a + b - c)) => 10

The following is maybe difficult, therefore I do not need it:

(exp 2 + (mod 5 3) + (log 10))

Please tell me it.

Upvotes: 1

Views: 334

Answers (1)

Ehvince
Ehvince

Reputation: 18415

Here's a hint with cmu-afix: https://lispcookbook.github.io/cl-cookbook/arrays.html#infix-syntax

to write stuff like:

#i(result[i j] += A[i k] * B[k j])

Upvotes: 1

Related Questions