[PARSE] The THRU keyword description?
[1/2] from: peta:mailinator at: 5-Dec-2008 15:43
Hi all,
I wonder how to best define what the THRU keyword is doing? When I saw the description
of the THRU keyword in the official documents, the following recursive idiom came to
my mind:
a: [thru b] ; is defined recursively as:
ar: [b | skip ar]
; Tests:
b: #"x"
parse "ab" a ; == false
parse "ab" ar ; == false
parse "abx" a ; == true
parse "abx" ar ; == true
b: "xy"
parse "ab" a ; == false
parse "ab" ar ; == false
parse "abxy" a ; == true
parse "abxy" ar ; == true
; so far so good, but now:
parse "ab" [thru end] ; == false
; while:
b: [end]
parse "ab" ar ; == true
Comments?
Peta
[2/2] from: peta::mailinator::com at: 5-Dec-2008 17:20
Another surprise:
a: [thru b] ; is defined recursively as:
ar: [b | skip ar]
; Tests:
b: ""
parse "ab" [a to end] ; == false
parse "ab" [ar to end] ; == true
Peta