Answer the question
In order to leave comments, you need to log in
How to call a function and throw the result of this function into another?
i have the following code:
class SomeStuff
{
public static List<Debt> userDebts
(Bank inBank, User user) =>
throw new Exception("Not implemented");
public static Option<Bank> parseBankName
(string bankName) =>
throw new Exception("Not implemented");
public static Option<List<Debt>> debtsOfLastUserInBank
(string bankName, List<User> users) =>
// implement this function without pattern-matching
}
public static Option<List<Debt>> debtsOfLastUserInBank
(string bankName, List<User> users) => _ = (parseBankName(bankName), userDebts(bankName, users.Last())).Apply((_, req) => req);
Answer the question
In order to leave comments, you need to log in
did so
from bank in parseBankName(bankName) from lastUser in users.LastOrNone() select userDebts(bank, lastUser)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question