how to convert string "001" into a dynamic variables a,b,c ,make a == 0 && b == 0 && c == 1 ?
On 06 Oct 2016, Ho Yeung Lee wrote:
how to convert string "001" into a dynamic variables a,b,c ,make a == 0 && b
== 0 && c == 1 ?
I'm not sure I understand your preface to this but,
Prelude> let [a,b,c] = [ read [x] | x <- "001" ] :: [Int]
Prelude> (a,b,c)
(0,0,1)
but if you get into any serious parsing then take a good luck at
libraries like Parsec and Frisby.
-- Mark
i can parse already and got exactly which digit it return in espresso,
i only do not know how to dynamic create variables
if 3 variables, for example it will be a == 1 && b == 0 && c == 0
if 4 variables, for example it will be a == 0 && b == 1 && c == 0 && d == 1
but without
let a =
let b =
let c =
assignment before it write into expression of if statement.
how to create this dynamic statement for if statement use ?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 113 |
Nodes: | 8 (1 / 7) |
Uptime: | 51:01:05 |
Calls: | 2,470 |
Calls today: | 1 |
Files: | 8,638 |
Messages: | 1,897,183 |