Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsexplain
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Verified Software
jsexplain
Commits
118aad88
Commit
118aad88
authored
9 years ago
by
Paul IANNETTA
Committed by
Thomas Wood
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Slight additions to mytools.ml
parent
9d6e7022
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
generator/mytools.ml
+20
-10
20 additions, 10 deletions
generator/mytools.ml
with
20 additions
and
10 deletions
generator/mytools.ml
+
20
−
10
View file @
118aad88
...
@@ -47,26 +47,29 @@ let list_mapi f l =
...
@@ -47,26 +47,29 @@ let list_mapi f l =
in
in
aux
0
l
aux
0
l
let
range
i
j
=
let
rec
aux
j
acc
=
if
i
<=
j
then
aux
(
j
-
1
)
(
j
::
acc
)
else
acc
in
aux
j
[]
let
list_nat
n
=
(* for n >= 0 *)
let
list_nat
n
=
(* for n >= 0 *)
let
rec
aux
i
=
range
0
n
if
i
=
0
then
[]
else
(
i
-
1
)
::
(
aux
(
i
-
1
))
in
List
.
rev
(
aux
n
)
let
rec
list_separ
sep
=
function
let
rec
list_separ
sep
=
function
|
[]
->
[]
|
[]
->
[]
|
a
::
[]
->
a
::
[]
|
a
::
[]
->
a
::
[]
|
a
::
l
->
a
::
sep
::
(
list_separ
sep
l
)
|
a
::
l
->
a
::
sep
::
list_separ
sep
l
let
rec
filter_somes
=
function
let
rec
filter_somes
=
function
|
[]
->
[]
|
[]
->
[]
|
None
::
l
->
filter_somes
l
|
None
::
l
->
filter_somes
l
|
(
Some
x
)
::
l
->
x
::
filter_somes
l
|
(
Some
x
)
::
l
->
x
::
filter_somes
l
let
list_unique
l
=
let
list_unique
l
=
let
rec
aux
acc
=
function
let
rec
aux
acc
=
function
|
[]
->
acc
|
[]
->
acc
|
a
::
q
->
|
a
::
q
->
if
List
.
mem
a
acc
then
aux
acc
q
else
aux
(
a
::
acc
)
q
if
List
.
mem
a
acc
then
aux
acc
q
else
aux
(
a
::
acc
)
q
in
in
aux
[]
l
aux
[]
l
...
@@ -113,7 +116,7 @@ let list_index k l =
...
@@ -113,7 +116,7 @@ let list_index k l =
(**************************************************************)
(**************************************************************)
(** String manipulation functions *)
(** String manipulation functions *)
let
str_cmp
(
s1
:
string
)
(
s2
:
string
)
=
let
str_cmp
(
s1
:
string
)
(
s2
:
string
)
=
if
s1
<
s2
then
-
1
else
if
s1
=
s2
then
0
else
1
if
s1
<
s2
then
-
1
else
if
s1
=
s2
then
0
else
1
let
str_starts_with
p
s
=
let
str_starts_with
p
s
=
...
@@ -220,5 +223,12 @@ let warning s =
...
@@ -220,5 +223,12 @@ let warning s =
Printf
.
printf
"### WARNING: %s
\n
"
s
Printf
.
printf
"### WARNING: %s
\n
"
s
let
unsupported
s
=
let
unsupported
s
=
failwith
(
"Unsupported language construction : "
^
s
)
failwith
(
"Unsupported language construction: "
^
s
^
"."
)
let
out_of_scope
s
=
failwith
(
s
^
" are and will not be supported."
)
let
error
s
=
failwith
(
"error: "
^
s
^
"."
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment