Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Raphaël Cauderlier
Sigmaid
Commits
c116363d
Commit
c116363d
authored
May 05, 2014
by
Raphaël Cauderlier
Browse files
More examples
parent
f6891785
Changes
1
Hide whitespace changes
Inline
Side-by-side
dk_obj_examples.dk
View file @
c116363d
#NAME dk_obj_examples
#NAME dk_obj_examples
.
Label := dk_obj.Label.
type := dk_obj.ObjType.
...
...
@@ -363,3 +363,72 @@ test8 := dk_obj.select
l_get.
test9 := dk_obj.select promCell myCell l_contents.
(; Classes ;)
l_new : Label
:=
dk_string.cons dk_char.n (
dk_string.cons dk_char.e (
dk_string.cons dk_char.w (
dk_string.nil))).
filtermaptype : (Label -> dk_bool.Bool) ->
(type -> type) ->
type ->
type.
[] filtermaptype _ _ dk_type.nil --> dk_type.nil
[ P : Label -> dk_bool.Bool,
f : type -> type,
l : Label,
A : type,
B : type ]
filtermaptype P f (dk_type.cons l A B)
-->
dk_type.if
(P l)
(dk_type.cons l (f A) B)
B.
trait : type -> dk_domain.Domain -> type.
[ A : type,
D : dk_domain.Domain ]
trait A D
-->
filtermaptype
(l : Label => dk_domain.mem l D)
(arrow A)
A.
type_sub : type -> dk_domain.Domain -> type.
[ A : type,
D : dk_domain.Domain ]
type_sub A D
-->
filtermaptype
(l : Label => dk_domain.mem l D)
(B : type => B)
A.
ins_sub_Class : type ->
dk_domain.Domain ->
dk_domain.Domain ->
type.
[ A : type,
Ins : dk_domain.Domain,
Sub : dk_domain.Domain ]
ins_sub_Class A Ins Sub
-->
dk_type.cons
l_new
(type_sub A Ins)
(trait A Sub).
Class : type -> type.
[ A : type ]
Class A
-->
ins_sub_Class A (dk_type.domain A) (dk_type.domain A).
(; ins_sub_class : ;)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment