Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
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
pikelang
pike
Commits
4938b090
Commit
4938b090
authored
27 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
should now handle multisets and mappings too...
Rev: lib/modules/Array.pmod:1.18
parent
66c01cb5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Array.pmod
+10
-1
10 additions, 1 deletion
lib/modules/Array.pmod
with
10 additions
and
1 deletion
lib/modules/Array.pmod
+
10
−
1
View file @
4938b090
...
@@ -15,6 +15,9 @@ mixed map(mixed arr, mixed fun, mixed ... args)
...
@@ -15,6 +15,9 @@ mixed map(mixed arr, mixed fun, mixed ... args)
if(mappingp(arr))
if(mappingp(arr))
return mkmapping(indices(arr),map(values(arr),fun,@args));
return mkmapping(indices(arr),map(values(arr),fun,@args));
if(multisetp(arr))
return mkmultiset(map(indices(arr,fun,@args)));
switch(sprintf("%t",fun))
switch(sprintf("%t",fun))
{
{
case "int":
case "int":
...
@@ -50,7 +53,13 @@ mixed filter(mixed arr, mixed fun, mixed ... args)
...
@@ -50,7 +53,13 @@ mixed filter(mixed arr, mixed fun, mixed ... args)
for(e=0;e<sizeof(ret);e++) if(ret[e]) r[i[e]]=v[e];
for(e=0;e<sizeof(ret);e++) if(ret[e]) r[i[e]]=v[e];
return r;
return r;
}else{
}
if(multisetp(arr))
{
return mkmultiset(filter(indices(arr,fun,@args)));
}
else
{
int d;
int d;
ret=map(arr,fun,@args);
ret=map(arr,fun,@args);
for(e=0;e<sizeof(arr);e++) if(ret[e]) ret[d++]=arr[e];
for(e=0;e<sizeof(arr);e++) if(ret[e]) ret[d++]=arr[e];
...
...
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