Skip to content

Latest commit

 

History

History
53 lines (48 loc) · 1.01 KB

appendix1.md

File metadata and controls

53 lines (48 loc) · 1.01 KB

Appendix 1

This appendix shows some tricks one can use in Intrepydd

Automatically return type inference

def func(A: Array(float32, 2), B: Array(float32, 2)) -> Array(bool, 2):
    C = eq(A, B)
    return C

can be simplified to

def func(A: Array(float32, 2), B: Array(float32, 2)):
    C = eq(A, B)
    return C

Combined type declaration

def func(A: Array(float32, 2), B: Array(float32, 2)):
    C = eq(A, B)
    return C

can be simplified to

def func(A, B: Array(float32, 2)): # A and B both have type Array(float32, 2)
    C = eq(A, B)
    return C

Primitive type abbreviation

all primitive types have an abbreviation, which is adopted from type signature from Java

  • int32
    • int or I
  • int64
    • long or J
  • float32
    • float or F
  • float64
    • double or D

So

def func(A, B: Array(float32, 2)):
    C = eq(A, B)
    return C

can be simplified to

def func(A, B: Array(F, 2)):
    C = eq(A, B)
    return C