You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,21 +34,21 @@ Use `@aml` macro to define a Julia type, and then the package automatically crea
34
34
### Document Defnition
35
35
* Use `xd""` or `hd""` to define a XML or HTML document:
36
36
```julia
37
-
@amlstruct Doc xd""
37
+
@amlmutable struct Doc xd""
38
38
# add fields (elements) here
39
39
end
40
40
```
41
41
42
42
### Nodes (Elements) Defnition
43
43
* Specify the html/xml struct name as a string after the struct name after a space
44
44
```julia
45
-
@amlstruct Person "person"
45
+
@amlmutable struct Person "person"
46
46
# add fields (elements) here
47
47
end
48
48
```
49
49
* If the html/xml name is the same as struct name, you can use `"~"` instead
50
50
```julia
51
-
@amlstruct person "~"
51
+
@amlmutable struct person "~"
52
52
# add fields (elements) here
53
53
end
54
54
```
@@ -98,7 +98,7 @@ GPA::Float64, "~", GPAcheck
98
98
99
99
* To define any restrictions for multiple values of a struct, define a function that gets all the variables and checks a criteria and returns Bool, and put its name after a `,` after the struct name:
100
100
```julia
101
-
@amlstruct Person "person", courseCheck
101
+
@amlmutable struct Person "person", courseCheck
102
102
# ...
103
103
end
104
104
```
@@ -129,22 +129,23 @@ using AcuteML
129
129
# Types definition
130
130
131
131
# Person Type
132
-
@amlstruct Person "person", courseCheck
133
-
age::UInt, "~"
132
+
@amlmutable struct Person "person", courseCheck
133
+
age::UInt64, "~"
134
134
field, "study-field"
135
135
GPA::Float64=4.5, "~", GPAcheck
136
136
courses::Vector{String}, "taken-courses"
137
137
id::Int64, a"~"
138
138
end
139
139
140
-
@amlstruct University "university"
140
+
@amlmutable struct University "university"
141
141
name, a"university-name"
142
142
people::Vector{Person}, "person"
143
143
end
144
144
145
-
@amlstruct Doc xd""
145
+
@amlmutable struct Doc xd""
146
146
university::University, "~"
147
147
end
148
+
148
149
```
149
150
150
151
```julia
@@ -173,6 +174,8 @@ end
173
174
P1 =Person(age=24, field="Mechanical Engineering", courses=["Artificial Intelligence", "Robotics"], id =1)
174
175
P2 =Person(age=18, field="Computer Engineering", GPA=4, courses=["Julia"], id =2)
175
176
177
+
P2.GPA=4.2# mutability support
178
+
176
179
U =University(name="Julia University", people=[P1, P2])
Copy file name to clipboardExpand all lines: docs/src/index.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,21 +31,21 @@ Use `@aml` macro to define a Julia type, and then the package automatically crea
31
31
### Document Defnition
32
32
* Use `xd""` or `hd""` to define a XML or HTML document:
33
33
```julia
34
-
@amlstruct Doc xd""
34
+
@amlmutable struct Doc xd""
35
35
# add fields (elements) here
36
36
end
37
37
```
38
38
39
39
### Nodes (Elements) Defnition
40
40
* Specify the html/xml struct name as a string after the struct name after a space
41
41
```julia
42
-
@amlstruct Person "person"
42
+
@amlmutable struct Person "person"
43
43
# add fields (elements) here
44
44
end
45
45
```
46
46
* If the html/xml name is the same as struct name, you can use `"~"` instead
47
47
```julia
48
-
@amlstruct person "~"
48
+
@amlmutable struct person "~"
49
49
# add fields (elements) here
50
50
end
51
51
```
@@ -95,7 +95,7 @@ GPA::Float64, "~", GPAcheck
95
95
96
96
* To define any restrictions for multiple values of a struct, define a function that gets all the variables and checks a criteria and returns Bool, and put its name after a `,` after the struct name:
0 commit comments