Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/First-class-functions/Dart/first-class-functions.dart
Normal file
11
Task/First-class-functions/Dart/first-class-functions.dart
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import 'dart:math' as Math;
|
||||
cube(x) => x*x*x;
|
||||
cuberoot(x) => Math.pow(x, 1/3);
|
||||
compose(f,g) => ((x)=>f(g(x)));
|
||||
main(){
|
||||
var functions = [Math.sin, Math.exp, cube];
|
||||
var inverses = [Math.asin, Math.log, cuberoot];
|
||||
for (int i = 0; i < 3; i++){
|
||||
print(compose(functions[i], inverses[i])(0.5));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue