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 ?
Mark Carroll於 2016年10月6日星期四 UTC+8下午3時58分54秒寫道:
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
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)