Rick Hanson <cryptor...@gmail.com> writes: Hi Rick,
> Here is a problem (again!) with using a pil backquote expression, > where the user, like you or me, is stuck on "CL-unquote thinking". > > Let's call g again, but now we switch the places of the dates and > times. In this case, we might expect the answer now to be "No"; > however, the answer will remain "Yes". > > : (g Is $S1$ before $S2$? > The answer is > `(if (and > (<= $D2$ $D1$) > (<= $T2$ $T1$) ) > "Yes" > "No" ) ) > -> "Is \"1999-09-09 20:12:05\" before \"2000-03-04 18:03:03\"? The > answer is \"Yes\"" > > Why? > > Because when the backquote expression gets resolved by the reader, the > symbols $D1$, $D2$, $T1$, and $T2$ are not bound to any values > (i.e. will evaluate to NIL). And since > > (<= NIL NIL) > > evals to T, g will always see "Yes" as its last argument. > > Sorry. That means you have to come up with another way to eval "code" > in your DSL (i.e the stuff under g). > > I hope this make sense. This is what Alex has been trying to tell us > all along. (I only now just realized this; so you can see how far > I've come along: not much.) thanks for your improvements of my rather crude function and for the final hint that using (date) in the examples was a rather bad idea since (date) works with NIL args too, it just gives different results. This backquote/comma mechanism in Emacs Lisp seemed so natural to me I never really thought about the way it works. So I should rather think about function calls then read syntax. But maybe not in public, I don't want to drive more people off the mailing list ;-) However, I will use your factorized code as starting point for new investigations, thanks again! -- cheers, Thorsten -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe