You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Still working on implementatin, I see the whole implementation (excepting mine, but I'm wrong to implement this before speaking about with you) uses this kind of method:
or(value)
=> ...|value
I'm afraid that this one is not very usefull. It can be ok for simple test, but what about finding:
startofline, then "foo", then "bar", endofline
OR
startofline, then "bar", then "baz". endofline
Still working on implementatin, I see the whole implementation (excepting
mine, but I'm wrong to implement this before speaking about with you) uses
this kind of method:
or(value)
=> ...|value
I'm afraid that this one is not very usefull. It can be ok for simple
test, but what about finding:
startofline, then "foo", then "bar", endofline
OR
startofline, then "bar", then "baz". endofline
Sorry for the late answer, I was out for 2 days.
You're right, my implementation is not fully effective.
With my implementation, this tests:
A.(B+C)
should be call with distributed form:
(A+B) . (A+C)
"A" is evaluated 2 times if B is false
I like your idea but I dislike the fact to have "var args" (optionnal argument) (certainly because I develop with Go :))
I have got another idea that is (I guess) more effective. I think that Or() method should get a VerbalExpression object as argument. And with should add a method named "And()" that accept VerbalExpression object.
This is an example:
v1 = new VE().Find("B")
v2 = new VE().Find("C").Or(v1); // (B+C)
v = new VE().Find("A").And(v2) // A.(B+C)
This should return:
(?m)(?:A)(?:(?:B)|(?:C))
This way, we can imaginate very complexe expressions that are seperated in several objects... I can prepare a branch to validate if that works
Activity
brudgers commentedon Aug 13, 2013
The right implementation of
oris ambiguous.Should it be capable of implementation like this?
(verbal-Expression-0
(or
(Verbal-Expression-1)
(Verbal-Expression-2)
(Verbal-Expression-3) )
Verbal-Expression-4)
Or must it be implemented like this?
(Verbal-Expression-0)
(or)
(Verbal-Expression-1))
The first requires
orto accept at least two arguments.If
oraccepts no arguments then it has to be the second form. That's theway of the original implementation.
I went around this with the Racket implementation which currently is a
macro that does the second but with further work could implement the first.
Ben
On Tue, Aug 13, 2013 at 7:12 AM, Patrice Ferlet notifications@github.comwrote:
metal3d commentedon Aug 16, 2013
Sorry for the late answer, I was out for 2 days.
You're right, my implementation is not fully effective.
With my implementation, this tests:
should be call with distributed form:
"A" is evaluated 2 times if B is false
I like your idea but I dislike the fact to have "var args" (optionnal argument) (certainly because I develop with Go :))
I have got another idea that is (I guess) more effective. I think that Or() method should get a VerbalExpression object as argument. And with should add a method named "And()" that accept VerbalExpression object.
This is an example:
This should return:
This way, we can imaginate very complexe expressions that are seperated in several objects... I can prepare a branch to validate if that works
metal3d commentedon Aug 16, 2013
This is as I did in my branch:
https://github.com/metal3d/GoVerbalExpressions/blob/and-or-implementation/verbalexpressions.go#L329
See Or() and And() methods that accept VerbalExpression Objects as argument. My test:
https://github.com/metal3d/GoVerbalExpressions/blob/and-or-implementation/verbalexpressions_test.go#L545
works like a charm.
Other Test for basic "Or":
https://github.com/metal3d/GoVerbalExpressions/blob/and-or-implementation/verbalexpressions_test.go#L259
where I create new object as argument (Or(new...))