On 16/11/21(Tue) 11:07, Claudio Jeker wrote: > This documents count(). This function only works when used like this > @map[key] = count(); > But it is implemented and works. If used differently you get a syntax > error which is not helpful. This is why I chose to document it like this. > Another option would be to document the language (so it is clear where it > is possible to use what).
ok mpi@ > max(), min() and sum() are other functions that behave like this. Their > documentation should also be adjusted IMO. > > -- > :wq Claudio > > Index: bt.5 > =================================================================== > RCS file: /cvs/src/usr.sbin/btrace/bt.5,v > retrieving revision 1.13 > diff -u -p -r1.13 bt.5 > --- bt.5 12 Nov 2021 16:57:24 -0000 1.13 > +++ bt.5 16 Nov 2021 09:50:52 -0000 > @@ -120,6 +120,11 @@ Functions: > .It Fn clear "@map" > Delete all (key, value) pairs from > .Va @map . > +.It "@map[key]" = Fn count > +Increment the value of > +.Va key > +from > +.Va @map . > .It Fn delete "@map[key]" > Delete the pair indexed by > .Va key >