FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/integration_tests/generics_array_03.py at main · sak-codes/lpython · GitHub
sak-codes
/
lpython
Public
forked from
lcompilers/lpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lpython
/
integration_tests
/
generics_array_03.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (35 loc) · 877 Bytes
Breadcrumbs
lpython
/
integration_tests
/
generics_array_03.py
Copy path
File metadata and controls
42 lines (35 loc) · 877 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from
ltypes
import
TypeVar
,
restriction
,
i32
,
f32
from
numpy
import
empty
n
:
i32
n
=
TypeVar
(
"n"
)
m
:
i32
m
=
TypeVar
(
"m"
)
T
=
TypeVar
(
'T'
)
@
restriction
def
add
(
x
:
T
,
y
:
T
)
->
T
:
pass
def
add_integer
(
x
:
i32
,
y
:
i32
)
->
i32
:
return
x
+
y
def
add_float
(
x
:
f32
,
y
:
f32
)
->
f32
:
return
x
+
y
def
g
(
n
:
i32
,
m
:
i32
,
a
:
T
[
n
,
m
],
b
:
T
[
n
,
m
],
**
kwargs
)
->
T
[
n
,
m
]:
r
:
T
[
n
,
m
]
r
=
empty
([
n
,
m
])
i
:
i32
j
:
i32
for
i
in
range
(
n
):
for
j
in
range
(
m
):
r
[
i
,
j
]
=
add
(
a
[
i
,
j
],
b
[
i
,
j
])
print
(
r
[
0
,
0
])
def
main
():
a_int
:
i32
[
1
,
1
]
=
empty
([
1
,
1
])
a_int
[
0
,
0
]
=
400
b_int
:
i32
[
1
,
1
]
=
empty
([
1
,
1
])
b_int
[
0
,
0
]
=
20
g
(
1
,
1
,
a_int
,
b_int
,
add
=
add_integer
)
a_float
:
f32
[
1
,
1
]
=
empty
([
1
,
1
])
a_float
[
0
,
0
]
=
f32
(
400
)
b_float
:
f32
[
1
,
1
]
=
empty
([
1
,
1
])
b_float
[
0
,
0
]
=
f32
(
20
)
g
(
1
,
1
,
a_float
,
b_float
,
add
=
add_float
)
main
()
Back
|
FazBrowse Home
|
New Git URL