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
cloogle.org
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cloogle
cloogle.org
Commits
c9177127
Verified
Commit
c9177127
authored
Jun 08, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation for array comprehensions, code cleanup
parent
1fcfd332
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
backend/Builtin/Syntax.icl
backend/Builtin/Syntax.icl
+7
-6
No files found.
backend/Builtin/Syntax.icl
View file @
c9177127
...
...
@@ -600,20 +600,21 @@ bs_with =
bs_zf
=
{
syntax_title
=
"list comprehension"
,
syntax_patterns
=
[
"ZF-expression"
,
"ZF"
,
"zf"
,
"comprehension"
,
"<-"
,
"<|-"
,
"<-:"
,
"
\\\\
"
,
","
,
"&"
,
"|"
]
,
syntax_patterns
=
[
"ZF-expression"
,
"ZF"
,
"zf"
,
"
*
comprehension"
,
"<-"
,
"<|-"
,
"<-:"
,
"
\\\\
"
,
","
,
"&"
,
"|"
]
,
syntax_code
=
[
"[...
\\\\
... <- ...]"
,
"{...
\\\\
... <- ...}"
]
[
"[...
\\\\
... <- ...]"
,
"{...
\\\\
... <- ...}"
]
,
syntax_description
=
"Constructs a list or array composed of elements drawn from other lists or arrays."
,
syntax_doc_locations
=
[
CLR
6
"4.2.1"
"_Toc311798024"
]
,
syntax_doc_locations
=
[
CLR
6
"4.2.1"
"_Toc311798024"
,
CLR
6
"4.4.1"
"_Toc311798032"
]
,
syntax_examples
=
map
(
EXs
"macro"
)
[
"cartesian = [(x,y)
\\\\
x <- [1,2,3], y <- [10,20]] // Cartesian product: (1,10), (1,20), (2,10), (2,20), (3,10), (3,20)"
,
"zip xs ys = [(x,y)
\\\\
x <- xs & y <- ys] // Pairwise zip through the lists"
,
"filter f xs = [x
\\\\
x <- xs | f x] // Guard to add conditions"
,
"catMaybes ms = [x
\\\\
Just x <- ms] // Pattern matching in the selector"
,
"triangle = [(x,y)
\\\\
x <- [1,2,3], y <- [1..x]] // Reusing x in the next generator: (1,1), (2,1), (2,2), (3,1), (3,2), (3,3)"
,
"arrToList a = [x
\\\\
x <-: a] // <-:
for arrays
"
,
"listToArr l = {x
\\\\
x <- l} //
<-: for arrays
"
,
"arrToList a = [x
\\\\
x <-: a] // <-:
to draw elements from an array
"
,
"listToArr l = {x
\\\\
x <- l} //
{..} to create an array
"
,
"castList xs = [|x
\\\\
x <|- xs] // The two pipe characters make both xs and the result overloaded lists"
]
}
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