task_url stringlengths 30 116 | task_name stringlengths 2 86 | task_description stringlengths 0 14.4k | language_url stringlengths 2 53 | language_name stringlengths 1 52 | code stringlengths 0 61.9k |
|---|---|---|---|---|---|
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Julia | Julia |
function foo(x)
str = x("world")
println("hello $(str)!")
end
foo(y -> "blue $y") # prints "hello blue world"
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #BBC_BASIC | BBC BASIC | PRINT "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Klingphix | Klingphix | :+2 + 2 + ;
:*2 * 2 * ;
:apply exec ;
23 45 @+2 apply print nl
8 4 @*2 apply print nl
" " input |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #bc | bc | "Hello world!
" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Kotlin | Kotlin | fun main(args: Array<String>) {
val list = listOf(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0)
val a = list.map({ x -> x + 2 }).average()
val h = list.map({ x -> x * x }).average()
val g = list.map({ x -> x * x * x }).average()
println("A = %f G = %f H = %f".format(a, g, h))
} |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #BCPL | BCPL | GET "libhdr"
LET start() = VALOF
{ writef("Hello world!")
RESULTIS 0
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Lambdatalk | Lambdatalk |
{def add
{lambda {:f :g :x}
{+ {:f :x} {:g :x}}}}
{add sin cos 10}
-> -1.383092639965822 // {+ {sin 10} {cos 10}}
{S.map sqrt {S.serie 1 5}}
-> 1 1.4142135623730951 1.7320508075688772 2 2.23606797749979
{S.reduce + {S.serie 1 10}}
-> 55
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #beeswax | beeswax | *`Hello, World! |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Lily | Lily | define square(x: Integer): Integer
{
return x * x
}
var l = [1, 2, 3] # Inferred type: List[Integer].
# Transform using a user-defined function.
print(l.map(square)) # [1, 4, 9]
# Using a built-in method this time.
print(l.map(Integer.to_s)) # ["1", "2", "3"]
# Using a lambda (with the type of 'x' properly ... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Befunge | Befunge | 52*"!dlroW ,olleH">:#,_@ |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Lingo | Lingo | -- in some movie script
----------------------------------------
-- Runs provided function (of some object) on all elements of the provided list, returns results as new list
-- @param {list} aList
-- @param {symbol} cbFunc
-- @param {object} [cbObj=_movie]
-- @return {list}
----------------------------------------
on m... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Binary_Lambda_Calculus | Binary Lambda Calculus | Hello world! |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Logo | Logo | to printstuff
print "stuff
end
to runstuff :proc
run :proc
end
runstuff "printstuff ; stuff
runstuff [print [also stuff]] ; also stuff |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Bird | Bird | use Console
define Main
Console.Println "Hello world"
end |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Lua | Lua | a = function() return 1 end
b = function(r) print( r() ) end
b(a) |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Blade | Blade | echo 'Hello world!' |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Luck | Luck | function lambda_true(x: 'a)(y: 'a): 'a = x;;
function lambda_false(x: 'a)(y: 'a): 'a = y;;
function lambda_if(c:'a -> 'a -> 'a )(t: 'a)(f: 'a): 'a = c(t)(f);;
print( lambda_if(lambda_true)("condition was true")("condition was false") );; |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Blast | Blast | # This will display a goodbye message on the terminal screen
.begin
display "Hello world!"
return
# This is the end of the script. |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #M2000_Interpreter | M2000 Interpreter |
Function Foo (x) {
=x**2
}
Function Bar(&f(), k) {
=f(k)
}
Print Bar(&foo(), 20)=400
Group K {
Z=10
Function MulZ(x) {
=.Z*x
.Z++
}
}
Print Bar(&K.MulZ(), 20)=200
Print K.Z=11
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #BlitzMax | BlitzMax |
print "Hello world!"
|
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Mathematica_.2F_Wolfram_Language | Mathematica / Wolfram Language | PassFunc[f_, g_, h_, x_] := f[g[x]*h[x]]
PassFunc[Tan, Cos, Sin, x]
% /. x -> 0.12
PassFunc[Tan, Cos, Sin, 0.12] |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Blue | Blue | global _start
: syscall ( num:eax -- result:eax ) syscall ;
: exit ( status:edi -- noret ) 60 syscall ;
: bye ( -- noret ) 0 exit ;
1 const stdout
: write ( buf:esi len:edx fd:edi -- ) 1 syscall drop ;
: print ( buf len -- ) stdout write ;
: greet ( -- ) s" Hello world!\n" print ;
: _start ( -- noret ) gree... |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #MATLAB_.2F_Octave | MATLAB / Octave | F1=@sin; % F1 refers to function sin()
F2=@cos; % F2 refers to function cos()
% varios ways to call the referred function
F1(pi/4)
F2(pi/4)
feval(@sin,pi/4)
feval(@cos,pi/4)
feval(F1,pi/4)
feval(F2,pi/4)
% named functions, stored as strings
feval('sin',pi/4)
feval('cos',pi/4)
... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #blz | blz | print("Hello world!") |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Maxima | Maxima | callee(n) := (print(sconcat("called with ", n)), n + 1)$
caller(f, n) := sum(f(i), i, 1, n)$
caller(callee, 3);
"called with 1"
"called with 2"
"called with 3" |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #BML | BML | display "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #MAXScript | MAXScript | fn second =
(
print "Second"
)
fn first func =
(
func()
)
first second |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Boo | Boo | print "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Metafont | Metafont | def calcit(expr v, s) = scantokens(s & decimal v) enddef;
t := calcit(100.4, "sind");
show t;
end |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #bootBASIC | bootBASIC | 10 print "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #.D0.9C.D0.9A-61.2F52 | МК-61/52 | 6 ПП 04
П7 КПП7 В/О
1 В/О |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #BQN | BQN | •Out "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Modula-3 | Modula-3 | MODULE Proc EXPORTS Main;
IMPORT IO;
TYPE Proc = PROCEDURE();
PROCEDURE Second() =
BEGIN
IO.Put("Second procedure.\n");
END Second;
PROCEDURE First(proc: Proc) =
BEGIN
proc();
END First;
BEGIN
First(Second);
END Proc. |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Brace | Brace | #!/usr/bin/env bx
use b
Main:
say("Hello world!") |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Morfa | Morfa |
func g(a: int, b: int, f: func(int,int): int): int
{
return f(a, b);
}
import morfa.base;
func main(): void
{
println("Add: ", g(2, 3, func(a: int, b: int) { return a + b; }));
println("Multiply: ", g(2, 3, func(a: int, b: int) { return a * b; }));
}
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Bracmat | Bracmat | put$"Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Nanoquery | Nanoquery | def first(function)
return function()
end
def second()
return "second"
end
result = first(second)
println result |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Brainf.2A.2A.2A | Brainf*** | 10 close to newline and carriage return
30 close to ! and SPACE
40 close to COMMA
70 close to G
80 close to W
90 close to b
100 is d and close to e and l
110 close to o
120 close to y
|
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Nemerle | Nemerle | Twice[T] (f : T -> T, x : T) : T { f(f(x)) } |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Brat | Brat | p "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #NewLISP | NewLISP | > (define (my-multiply a b) (* a b))
(lambda (a b) (* a b))
> (define (call-it f x y) (f x y))
(lambda (f x y) (f x y))
> (call-it my-multiply 2 3)
6
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Brlcad | Brlcad |
echo Hello world!
|
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Nim | Nim | proc first(fn: proc): auto =
return fn()
proc second(): string =
return "second"
echo first(second) |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Burlesque | Burlesque |
"Hello world!"sh
|
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Oberon-2 | Oberon-2 |
MODULE HOFuns;
IMPORT
NPCT:Tools,
Out;
TYPE
Formatter = PROCEDURE (s: STRING; len: LONGINT): STRING;
VAR
words: ARRAY 8 OF STRING;
PROCEDURE PrintWords(w: ARRAY OF STRING; format: Formatter);
VAR
i: INTEGER;
BEGIN
i := 0;
WHILE (i < LEN(words)) DO
Out.Object(format(words[i],16));
... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C | C | #include <stdlib.h>
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
return EXIT_SUCCESS;
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Objeck | Objeck |
bundle Default {
class HighOrder {
function : Main(args : String[]) ~ Nil {
f := GetSize(String) ~ Int;
Print(f);
}
function : GetSize(s : String) ~ Int {
return s->Size();
}
function : Print(func : (String)~Int) ~ Nil {
func("Hello World!")->PrintLine();
}
}
}
... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C.23 | C# | namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello world!");
}
}
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #OCaml | OCaml | # let func1 f = f "a string";;
val func1 : (string -> 'a) -> 'a = <fun>
# let func2 s = "func2 called with " ^ s;;
val func2 : string -> string = <fun>
# print_endline (func1 func2);;
func2 called with a string
- : unit = () |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C.2B.2B | C++ | #include <iostream>
int main () {
std::cout << "Hello world!" << std::endl;
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Octave | Octave | function r = computeit(f, g, v)
r = f(g(v));
endfunction
computeit(@exp, @sin, pi/3)
computeit(@log, @cos, pi/6) |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C.2B.2B.2FCLI | C++/CLI | using namespace System;
int main()
{
Console::WriteLine("Hello world!");
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Oforth | Oforth | [1, 2, 3, 4, 5 ] map(#1+) |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C1R | C1R | Hello_world/Text |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Ol | Ol |
; typical use:
(for-each display '(1 2 "ss" '(3 4) 8))
; ==> 12ss(quote (3 4))8'()
; manual implementation in details:
(define (do f x)
(f x))
(do print 12345)
; ==> 12345
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C2 | C2 | module hello_world;
import stdio as io;
func i32 main(i32 argc, char** argv) {
io.printf("Hello World!\n");
return 0;
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #ooRexx | ooRexx | say callit(.routines~fib, 10)
say callit(.routines~fact, 6)
say callit(.routines~square, 13)
say callit(.routines~cube, 3)
say callit(.routines~reverse, 721)
say callit(.routines~sumit, 1, 2)
say callit(.routines~sumit, 2, 4, 6, 8)
-- call the provided routine object with the provided variable number of arguments
::r... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #C3 | C3 | import std::io;
fn int main()
{
io::println("Hello, World!");
return 0;
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Order | Order |
#include <order/interpreter.h>
#define ORDER_PP_DEF_8func1 ORDER_PP_FN ( \
8fn(8F, \
8ap(8F, 8("a string")) ))
#define ORDER_PP_DEF_8func2 ORDER_PP_FN ( \
8fn(8S, \
8adjoin(8("func2 called with "), 8S ) ))
ORDER_PP(
8func1(8func2)
)
// -> "func2 called with ""a string"
#define ORDER_PP_DEF_8func3 OR... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Casio_BASIC | Casio BASIC | Locate 1,1,"Hello World!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #OxygenBasic | OxygenBasic |
'FUNCTION TO BE PASSED
'=====================
function f(double d,e) as double
return (d+e)*2
end function
'FUNCTION TAKING A FUNCTION AS AN ARGUMENT
'=========================================
function g(sys p) as string
declare function x(double d,e) as double at p
return x(10,11)
end function
... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Cat | Cat | "Hello world!" writeln |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Oz | Oz | declare
fun {Twice Function X}
{Function {Function X}}
end
in
{Show {Twice Sqrt 81.0}} %% prints 3.0 |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Cduce | Cduce | print "Hello world!";; |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PARI.2FGP | PARI/GP | secant_root(ff,a,b)={
e = eps() * 2;
aval=ff(a);
bval=ff(b);
while (abs(bval) > e,
oldb = b;
b = b - (b - a)/(bval - aval) * bval;
aval = bval;
bval = ff(b);
a = oldb
);
b
};
addhelp(secant_root, "secant_root(ff,a,b): Finds a root of ff between a and b using the secant method.");
eps()={
precision(2.... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #CFEngine | CFEngine | #!/usr/bin/env cf-agent
# without --no-lock option to cf-agent
# this output will only occur once per minute
# this is by design.
bundle agent main
{
reports:
"Hello world!";
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Pascal | Pascal | program example(output);
function first(function f(x: real): real): real;
begin
first := f(1.0) + 2.0;
end;
function second(x: real): real;
begin
second := x/2.0;
end;
begin
writeln(first(second));
end. |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Chapel | Chapel | writeln("Hello world!"); |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Perl | Perl | sub another {
# take a function and a value
my $func = shift;
my $val = shift;
# call the function with the value as argument
return $func->($val);
};
sub reverser {
return scalar reverse shift;
};
# pass named coderef
print another \&reverser, 'data';
# pass anonymous coderef
print anoth... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Chef | Chef | Goodbye World Souffle.
Ingredients.
71 g green beans
111 cups oil
98 g butter
121 ml yogurt
101 eggs
44 g wheat flour
32 zucchinis
119 ml water
114 g red salmon
108 g lard
100 g dijon mustard
33 potatoes
Method.
Put potatoes into the mixing bowl.
Put dijon mustard into the mixing bowl.
Put lard into the mixing bowl... |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Phix | Phix | procedure use(integer fi, a, b)
?fi(a,b)
end procedure
function add(integer a, b)
return a + b
end function
use(add,23,45)
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #ChucK | ChucK | <<< "Hello world!">>>; |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Phixmonti | Phixmonti | def suma + enddef
def apply exec enddef
23 45 getid suma apply print
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Cind | Cind |
execute() {
host.println("Hello world!");
}
|
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PHP | PHP | function first($func) {
return $func();
}
function second() {
return 'second';
}
$result = first('second'); |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Clay | Clay | main() {
println("Hello world!");
} |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Picat | Picat | go =>
% ...
L = 1..10,
L2 = 1..3,
% ...
f1(X) = X**2.
f2(X,A) = X**A + A**X.
%
% qsort(List, SortFunction)
% returns a sorted list according to the sort function SortFunction
%
qsort([],_F) = [].
qsort([H|T],F) = qsort([E : E in T, call(F,E,H)], F)
++ [H] ++
qsort([E : ... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Clean | Clean | Start = "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PicoLisp | PicoLisp | : (de first (Fun)
(Fun) )
-> first
: (de second ()
"second" )
-> second
: (first second)
-> "second"
: (de add (A B)
(+ A B) )
-> add
: (add 1 2)
-> 3
: (de call-it (Fun X Y)
(Fun X Y) )
-> call-it
: (call-it add 1 2)
-> 3
: (mapcar inc (1 2 3 4 5))
-> (2 3 4 5 6)
: (mapcar + (1 2 3) (4 5 6)... |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Clio | Clio | 'hello world!' -> print |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PL.2FI | PL/I |
f: procedure (g) returns (float);
declare g entry (float);
get (x);
put (g(x));
end f;
x = f(p); /* where "p" is the name of a function. */
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Clipper | Clipper | ? "Hello world!" |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Pop11 | Pop11 | ;;; Define a function
define x_times_three_minus_1(x);
return(3*x-1);
enddefine;
;;; Pass it as argument to built-in function map and print the result
mapdata({0 1 2 3 4}, x_times_three_minus_1) => |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #CLIPS | CLIPS | (printout t "Hello world!" crlf) |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PostScript | PostScript |
% operator example
% 'ifelse' is passed a boolean and two procedures
/a 5 def
a 0 gt { (Hello!) } { (World?) } ifelse ==
% procedure example
% 'bar' is loaded onto the stack and passed to 'foo'
/foo { exec } def
/bar { (Hello, world!) } def
/bar load foo ==
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #CLU | CLU | start_up = proc ()
po: stream := stream$primary_output()
stream$putl(po, "Hello world!")
end start_up |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PowerShell | PowerShell |
function f ($y) {
$y*$y
}
function g (${function:f}, $y) {
(f $y)
}
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Clojure | Clojure | (println "Hello world!") |
http://rosettacode.org/wiki/Hello_world/Line_printer | Hello world/Line printer | Task
Cause a line printer attached to the computer to print a line containing the message: Hello World!
Note
A line printer is not the same as standard output.
A line printer was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be... | #11l | 11l | V lp = File(‘/dev/lp0’, ‘w’)
lp.write("Hello World!\n")
lp.close() |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Prolog | Prolog |
first(Predicate) :- call(Predicate).
second(Argument) :- write(Argument).
:-first(second('Hello World!')).
|
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #CMake | CMake | message(STATUS "Hello world!") |
http://rosettacode.org/wiki/Hello_world/Line_printer | Hello world/Line printer | Task
Cause a line printer attached to the computer to print a line containing the message: Hello World!
Note
A line printer is not the same as standard output.
A line printer was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be... | #360_Assembly | 360 Assembly | HELLO CSECT
PRINT NOGEN
BALR 12,0
USING *,12
OPEN LNPRNTR
LA 6,HW
PUT LNPRNTR
CLOSE LNPRNTR
EOJ
LNPRNTR DTFPR DEVADDR=SYSLST,IOAREA1=L1
L1 DS 0CL133
HW DC C'Hello World!'
END HELLO |
http://rosettacode.org/wiki/Hello_world/Line_printer | Hello world/Line printer | Task
Cause a line printer attached to the computer to print a line containing the message: Hello World!
Note
A line printer is not the same as standard output.
A line printer was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be... | #Action.21 | Action! | Proc Main()
Open(1,"P:",8,0)
PrintDE(1,"HELLO WORLD!")
Close(1)
Return
|
http://rosettacode.org/wiki/Hello_world/Line_printer | Hello world/Line printer | Task
Cause a line printer attached to the computer to print a line containing the message: Hello World!
Note
A line printer is not the same as standard output.
A line printer was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be... | #Ada | Ada |
with Ada.Text_IO; use Ada.Text_IO;
procedure Print_Line is
Printer : File_Type;
begin
begin
Open (Printer, Mode => Out_File, Name => "/dev/lp0");
exception
when others =>
Put_Line ("Unable to open printer.");
return;
end;
Set_Output (Printer);
Put_Line ("Hello World... |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #PureBasic | PureBasic | Prototype.d func(*text$)
Procedure NumberTwo(arg$)
Debug arg$
EndProcedure
Procedure NumberOne(*p, text$)
Define MyFunc.func=*p
MyFunc(@text$)
EndProcedure
NumberOne(@NumberTwo(),"Hello Worldy!") |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #COBOL | COBOL | program-id. hello.
procedure division.
display "Hello world!".
stop run. |
http://rosettacode.org/wiki/Hello_world/Line_printer | Hello world/Line printer | Task
Cause a line printer attached to the computer to print a line containing the message: Hello World!
Note
A line printer is not the same as standard output.
A line printer was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be... | #ALGOL_68 | ALGOL 68 |
BEGIN
STRING printer name = "/dev/lp0";
FILE line printer;
IF open (line printer, printer name, stand out channel) = 0 THEN
put (line printer, ("Hello world", newline));
close (line printer)
ELSE
put (stand error, ("Can't contact line printer on ", printer name, newline));
put (sta... |
http://rosettacode.org/wiki/Higher-order_functions | Higher-order functions | Task
Pass a function as an argument to another function.
Related task
First-class functions
| #Python | Python | def first(function):
return function()
def second():
return "second"
result = first(second) |
http://rosettacode.org/wiki/Hello_world/Text | Hello world/Text | Hello world/Text is part of Short Circuit's Console Program Basics selection.
Task
Display the string Hello world! on a text console.
Related tasks
Hello world/Graphical
Hello world/Line Printer
Hello world/Newbie
Hello world/Newline omission
Hello world/Standard error
Hello world/Web server
| #Cobra | Cobra | class Hello
def main
print 'Hello world!' |
http://rosettacode.org/wiki/Hello_world/Line_printer | Hello world/Line printer | Task
Cause a line printer attached to the computer to print a line containing the message: Hello World!
Note
A line printer is not the same as standard output.
A line printer was an older-style printer which prints one line at a time to a continuous ream of paper.
With some systems, a line printer can be... | #Applesoft_BASIC | Applesoft BASIC |
PR#1
PRINT "HELLO WORLD!"
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.