f# - Iterating over two lists and adding to a result list returns an empty list. Why? -


The result of running the following code gives an empty list, but I'm not completely sure why my guess is that duplication on the loop Has an effect, I still can not understand, I know that if I change the result list then everything works, please note that there is no connection between the filename And games (i.e. there can be any games or files for which they have a No need to mail)

  create list (filename: string list) = give games = ["DMC"; "Aztez"] result = list.mtt  

for a loop, a warning in the rows inside the two Is: "This expression should be 'unit', but type 'bool'. Use 'ignore' to discard the result of expression, or tie the result with a name."

Create the desired behavior

  to create the code below LISTM (filename: string list) = play = ["DMC"; "Aztez"] Temporary Results = List. (String * string) & gt; For file names in the file name, do this for games in the game = [file name, result] result & lt; - Results @ result  

but better if I do not have to use a temporary list.

To summarize, I would like to know one) Why the first code sample result is empty. Why not attach new values ​​to @ (I have also tried together) b) Is there any better way to do this?

thanks

  result = result @ a  < / Pre> 

evaluates as the class = "post-text" itemprop = "text">

bool indicates that the listings result And results @ a are identical or not. This bool is then discarded. Therefore, for your two ends, repeat only the collection again and calculate several bulls which are never used.

You can use yield to make the list understand rather than using an unchangeable variable:

  letlistListM (fileNames: string list) = game = ["DMC "; "Aztez"] [Filename in filaments for the game in the game to produce (file name, game)]  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -