I
I
INTERNALINTERFERENCE2021-11-04 17:42:14
C++ / C#
INTERNALINTERFERENCE, 2021-11-04 17:42:14

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
    }


I just need to call parseBankName, return the bank type option and throw it into userDebts, adding adding users.Last

I tried to do this:
public static Option<List<Debt>> debtsOfLastUserInBank
            (string bankName, List<User> users) => _ = (parseBankName(bankName), userDebts(bankName, users.Last())).Apply((_, req) => req);


but I don’t know the syntax very well, so it doesn’t compile - bankName in userDebts is highlighted
how to do everything right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
INTERNALINTERFERENCE, 2021-11-04
@INTERNALINTERFERENCE

did so

from bank in parseBankName(bankName) from lastUser in users.LastOrNone() select userDebts(bank, lastUser)

but I would like another option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question