mardi 30 décembre 2014

Beginner: Converting Types in Haskell


Vote count:

0




First post here, please go easy on me. Found several threads with similar issues, none of those applied directly or if one did, the execution was far enough over my head.


If i have code p=['1','2','3','4'] that stores digits as characters in p, how do i create a list q that can equal [1,2,3,4]? I've been trying all sorts of things, mostly arriving at my q being out of scope or any function i try to convert Char -> Int lacking accompanying binding. I seem to find indication everywhere that there is such a thing as digitToInt, where digitToInt '1' should yield an output of 1 but i apparently lack bindings, even with the exact input from this page: http://zvon.org/other/haskell/Outputchar/digitToInt_f.html


At this point reading more things i am just becoming more confused. Please help with either a viable solution that might show me where i'm messing up or with an explanation why this digitToInt :: Char -> Int seems to not work for me in the slightest.


Thank you.



asked 24 secs ago







Beginner: Converting Types in Haskell

Aucun commentaire:

Enregistrer un commentaire