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: | 286 |
Nodes: | 16 (2 / 14) |
Uptime: | 89:58:04 |
Calls: | 6,496 |
Calls today: | 7 |
Files: | 12,100 |
Messages: | 5,277,556 |