On Thu, Oct 24, 2019 at 07:16:31AM -0700, C K Kashyap wrote:
> If I understand correctly - the filter clause is redundant because it does
> not subset the records generated by the generator?
Yes. In this simple case, where we have only a single generator, this is
correct.
You don't need 'select' then, and could do
: (? @Nr (1 . 2) (db nr +CuSu @Nr @C))
@Nr=(1 . 2) @C={C1}
@Nr=(1 . 2) @C={C2}
-> NIL
> When I look at the filter used in app/gui.l I wonder if the filter
> (range @Nr @@ nr) does anything - I mean, the generator would only generate
> records where nr is in the range - is that not right?
>
>
> (quote
> @Nr (and *CuSuNr (cons @ T))
> @Nm *CuSuNm
> @Tel *CuSuTel
> @Plz *CuSuPlz
> @Ort *CuSuOrt
> @Mob *CuSuMob
> (select (@@)
> ((nr +CuSu @Nr) (nm +CuSu @Nm) (tel +CuSu @Tel)
> (plz +CuSu @Plz) (ort +CuSu @Ort) (mob +CuSu @Mob) )
> (range @Nr @@ nr)
> (tolr @Nm @@ nm)
> (fold @Tel @@ tel)
> (head @Plz @@ plz)
> (part @Ort @@ ort)
> (fold @Mob @@ mob) ) ) )
No, because the other generators will well find objects with number outside the
range. This assumes the general case, with search criteria also in *CuSuNm,
*CuSuTel, etc.
If only *CuSuNr were given, and the other criteria were all NIL, then indeed
only the 'nr' tree would be searched, and the range check would be unnecessary.
We can say that the generators produce a logical OR of the criteria ("find all
objects that have a number in the *CuSuNr range, OR have a name matching
*CuSuNm, OR match *CuSuTel" and so on), and then the filter clauses do a logical
AND on the found items ("return only those whose number is in the range AND
whose name matches *CuSuNm AND whose telephone fits *CuSuTel" etc.)
☺/ A!ex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe