M2 icon indicating copy to clipboard operation
M2 copied to clipboard

Extend notation for Function_Thing

Open mahrud opened this issue 1 year ago • 0 comments

Currently if f = (x,y) -> x+y then f_i is essentially y -> i+y:

Function _ Thing := Function => (f,x) -> y -> f splice (x,y)

I suggest we define some sort of simple notation to define:

f(i, _) == y -> i+y
f(_, j) == x -> x+j

It doesn't have to be this exact notation or necessarily involve _, but ideally something simple and clear that we're leaving an input blank and producing a function.

This is helpful for instance in defining a functor F = Hom(M, _).

Roughly speaking, I think the implementation would involve:

  1. when parsing a comma-separated sequence, if _ is seen, produce a special type of code, say InputSequence,
  2. define Function InputSequence to return a new function.

Another, probably much easier route is to define Function _ Sequence and allow f_(i, null) but that might cause confusion (e.g. what if the first input of f is supposed to be a sequence? or that one of the inputs is really supposed to be null?)

mahrud avatar Oct 14 '24 15:10 mahrud