Question: I am using this code from Parse:

```
[PFUser logInWithUsernameInBackground:namerL password:passerL
                                block:^(PFUser *user, NSError *error) {
                                    if (user) {
                                        [self performSegueWithIdentifier:@"signinToInbox" sender:self];
                                    } else {
                                        NSLog(@"%@",error);
                                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login Failed." message:@"Invalid Username and/or Password." delegate:self cancelButtonTitle:@"Okay" otherButtonTitles:nil];
                                        [alert show];
                                    }
                                }];

```

Whenever I click on the sign in button without typing in anything, it doesn't log any errors. I need it to count it as an error if there is no such user and or if the password is correct. But even if the account details are not correct, it is still going to the segue.

`-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {` I believe that it's calling the segue because it is still in didSelectRowAtIndexPath. I just don't know how to stop it from calling the segue that's connected it (by default).

Answer: 
You could use `sapply` to loop over the functions and apply then

```
f <- function(x){x}
g <- function(x){x+1}
h <- function(x){x*2}

funs<-list(f,g,h)

x <- 2
rowSums(matrix(sapply(funs, function(f, z) f(z), z=x), nrow=length(x)))
# [1] 9

```

I use the `matrix` and `rowSums` functions just in case you want to be able to call it when `x` is a vector of values as well

```
x <- 1:3
rowSums(matrix(sapply(funs, function(f, z) f(z), z=x), nrow=length(x)))
# [1]  5  9 13

```

You can make it cleaner by making a helper function

```
getfunsum <- function(funs) {
    force(funs)
    function(x) {
        rowSums(matrix(sapply(funs, function(f, z) f(z), z=x), nrow=length(x)))
    }
}
fgh <- getfunsum(funs)
fgh(1:3)
# [1]  5  9 13

```
You may try:

```
 fun1 <- function(i,a) {
                eval(substitute(function(x, a) {x+i*a}, list(i=i)))}

n <- 0:3
lst <- lapply(n, fun1)
rowSums(sapply(lst, function(f) f(12:14, 3)))
#[1] 66 70 74

```