Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -0,0 +1,21 @@
|
|||
julia> all(iseven, 1:5) # not all integers between 1 and 5 are even.
|
||||
false
|
||||
|
||||
julia> findfirst(iseven, 1:5) # the first even integer is at index 2 in the range.
|
||||
2
|
||||
|
||||
julia> count(iseven, 1:5) # there are two even integers between 1 and 5.
|
||||
2
|
||||
|
||||
julia> filter(iseven, 1:5) # here are the even integers in the given range.
|
||||
2-element Array{Int64,1}:
|
||||
2
|
||||
4
|
||||
|
||||
julia> map(iseven, 1:5) # we apply our function to all integers in range.
|
||||
5-element Array{Bool,1}:
|
||||
false
|
||||
true
|
||||
false
|
||||
true
|
||||
false
|
||||
18
Task/Higher-order-functions/MATLAB/higher-order-functions.m
Normal file
18
Task/Higher-order-functions/MATLAB/higher-order-functions.m
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
F1=@sin; % F1 refers to function sin()
|
||||
F2=@cos; % F2 refers to function cos()
|
||||
|
||||
% varios ways to call the refered 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)
|
||||
F3 = 'sin';
|
||||
F4 = 'cos';
|
||||
feval(F3,pi/4)
|
||||
feval(F4,pi/4)
|
||||
Loading…
Add table
Add a link
Reference in a new issue