Ppx_arrayjit.Ppx_helper
val substitute_identifiers_in_einsum_spec :
loc:Ppxlib__.Location.t ->
Base.String.t ->
Ppxlib__.Import.expression
Convert a string containing patterns like "identifier*" to an OCaml expression that substitutes the identifiers with their runtime values. Identifiers match the pattern a-z_
a-z0-9_
* and must directly precede '*'.
Example usage: substitute_identifiers_in_string ~loc "a *x + b * y"
generates an expression equivalent to: String.concat "" [Int.to_string a; " *x + "; Int.to_string b; " * y"]
So if a = 2
and b = 3
, the result would be "2 *x + 3 * y"
. Whitespace between identifiers and '*' is preserved.