Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alphaLib
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
POTTIER Francois
alphaLib
Commits
e53dc269
Commit
e53dc269
authored
Feb 16, 2017
by
POTTIER Francois
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define [fa] using [iter] instead of [reduce].
parent
c30ff5f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
src/AlphaLibMacros.cppo.ml
src/AlphaLibMacros.cppo.ml
+22
-0
No files found.
src/AlphaLibMacros.cppo.ml
View file @
e53dc269
...
...
@@ -7,6 +7,8 @@
(* -------------------------------------------------------------------------- *)
(* [fa] could be defined in terms of [reduce], as follows. *)
#
define
FA_CLASS
__fa
#
define
FA_FUN
(
term
)
CONCAT
(
fa_
,
term
)
...
...
@@ -20,6 +22,26 @@
let
FA_FUN
(
term
)
t
=
\
new
FA_CLASS
#
VISIT
(
term
)
()
t
\
#
undef
__FA
#
undef
FA
(* -------------------------------------------------------------------------- *)
(* We prefer to define [fa] in terms of [iter] because we wish to eliminate
our dependency on [reduce] visitors. *)
#
define
__FA
\
class
FA_CLASS
=
object
\
inherit
[
_
]
iter
\
inherit
[
_
]
KitFa
.
iter
\
end
\
#
define
FA
(
term
)
\
let
FA_FUN
(
term
)
t
=
\
let
o
=
new
FA_CLASS
in
\
o
#
VISIT
(
term
)
KitFa
.
empty
t
;
\
o
#
accu
(* -------------------------------------------------------------------------- *)
#
define
FILTER_CLASS
__filter
...
...
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