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
f321a85d
Commit
f321a85d
authored
24 years ago
by
Johan Sundström
Browse files
Options
Downloads
Patches
Plain Diff
added Function.splice_call
Rev: lib/modules/Function.pmod:1.4
parent
14101226
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
lib/modules/Function.pmod
+37
-0
37 additions, 0 deletions
lib/modules/Function.pmod
with
37 additions
and
0 deletions
lib/modules/Function.pmod
+
37
−
0
View file @
f321a85d
#pike __REAL_VERSION__
#pike __REAL_VERSION__
constant defined = __builtin.function_defined;
constant defined = __builtin.function_defined;
//! Calls the given function with the @tt{args@} array plus the optional
//! extra arguments as its arguments and returns the result.
//!
//! Most useful in conjunction with @ref{map@}, and particularly in combination
//! with @ref{sscanf@} with @tt{"...%{...%}..."@} scan strings (which indeed
//! was what it was invented for in the first place).
//!
//! @example
//! class Product(string name, string version)
//! {
//! string _sprintf()
//! {
//! return sprintf("Product(%s/%s)", name, version);
//! }
//! }
//! map(({ ({ "pike", "7.1.11" }),
//! ({ "whitefish", "0.1" }) }),
//! Function.splice_call, Product);
//! ({ /* 2 elements */
//! Product(pike/7.1.11),
//! Product(whitefish/0.1)
//! })
//! @endexample
//!
//! @param args
//! the first arguments the function @tt{f@} expects
//! @param f
//! the function to apply the arguments on
//! @param extra
//! optional extra arguments to send to @tt{f@}
//! @returns
//! whatever the supplied function @tt{f@} returns
mixed splice_call(array args, function f, mixed|void ... extra)
{
return f(@args, @extra);
}
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