Idea: new keyword OPERATOR
|
06-11-2015, 12:02 PM
(This post was last modified: 06-11-2015 05:00 PM by compsystems.)
Post: #1
|
|||
|
|||
Idea: new keyword OPERATOR
Hello, sorry for my bad English, my multilingual chip is damaged =(
I want to create a new library of functions, but using operator notation, nonfunctional functions are currently defined as follows functionname (arg1, arg2) Begin ... End; I think, should add a new keyword Operator Operator arg1 functionname arg2; Begin ... End; Operator arg1 ⊗ arg2; Begin ... End; Operator arg1 ⊕ arg2; Begin ... End; Operator arg1 ⊂ arg2; Begin ... End; Good idea? +1 or -1 The hp48 allowed to define functions as operators |
|||
10-12-2015, 07:03 PM
Post: #2
|
|||
|
|||
RE: Idea: new keyword OPERATOR
Having the option to use infix notation when you are used to it can certainly be clearer, but your syntax looks like you would only use the infix notation for the functions you define.
I would suggest instead a syntax more like that used in POP-2: Definition: EXPORT matrixmultiply(a,b) Begin End -> "***"; //map this procedure to infix symbol *** Call either as now: Matrixmuliply(a,b); //useful if you don't know the infix symbol Or in infix if you like: A *** b; //more readable (In fact, in POP-2 you could just use a single "*", and it could work out which multiply you needed based on parameter types: two reals => internal multiply, Two matrices => use defined matrix multiply procedure etc.) Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)