Haskell 2D character array -


I have a question from Haskell language. I need to store a bunch of letters in the 2D array. How can I store it ?? The text file contains characters in 10x10 format and I want to store it in 2D character array in hackel language. Please help me as soon as possible .. Thanks ..

Here is the code that I tried and in this code I am attempting to store the value of x in the listofchar name list:

  module tracerfile where importing system. IO main = WHD HDL & lt; - openFile "map.txt" ReadMode readbychar hdl readbychar hdl = do not t & lt - hIsEOF hdl if t then return () and let listofchar = [] x  

Try it out:

< Pre> import system.IO Main =

This program facilitates the move:

First, readFile Reads the file and binds the content on textContents .

Next, whenever we encounter a Newline delimiter and format the content by dividing the list then finally remove the remaining empty string.

Done! Now what we want from our "map", we can do.


A small note on the edge:

It would look strange that our map would appear like this:

["Aaaaaa", "BBBBBBBBBB", ..] - does not look like 2D map

which is just syntactic sugar:

  [['a', 'a ',' A ', ..], [' b ',' b ',' b ', ..], ..] - looks and now like a map  

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 -