Question: Write a function that takes an integer and a boolean function and returns a list containing all [i,j] such that F(i,j).

March 08 2014 love maths 85
Maple 17
0

 

 

so we have to Write a maple function with -> that takes an integer N and a boolean function

F: {(i,j) l 0<= i,j<= N} -> {true,false} 


and returns a list containing all [i,j] such that F(i,j). A procedure that does this
would be


proc(N,F) local i, j, RV;
RV:=NULL;
for i from 1 to N do for j from 1 to N do
if F(i,j) then RV:=RV,[i,j] ; end if ;
end do ; end do ;
return RV ;
end proc ;


The problem is to do this inline, i.e. you have to write
(i,j)-> ...

 

please help...

Please Wait...