jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: a[[i1:i2]], substring and min, max


Klaus Schmid <klaus.schmid@xxxxxxx> wrote:
>a= "abc"
>a[[0:-3]]  returns "a"
>a[[0:-4]]  returns ""
>a[[0:-5]]  returns ""
>a[[0:-6]]  returns "a" ???
>
>Is there an explanation for this behaviour?

For performance reasons, indexing by arrays in slang uses modular
arithmetic.  The alternative would be to perform a bounds check on
each index of the array resulting in a performance hit.  I will look
into why a[[0:-5]] returns the empty string.

>I think the following functions would be nice to have, in C for performance:
>
>define min( a, b)
>{
>   if ( a < b) return a; else return b;
>}
>define max( a, b)
>{
>   if ( a > b) return a; else return b;
>}

S-Lang 1.4.7 and above support min and max, but jed does not enable
the appropriate slang module to pick up these.

[...]
>Of course I wished the documentation would go deeper into
>details in some places. I am glad, there is the possibility to look
>into the sources (SLang and C), but even better I think would be
>to have some easy readable SLang-code (or pseudo-code) for
>some functions right in the documentation.
>This would avoid lengthy explanations of details, which are
>sometimes harder to understand than some lines of code.
>I would invest some time in this -- supposed I am not the only one ;)

Lately I have been wondering how useful it would be make wiki versions
of the jed and slang documentation web pages.

Thanks,
--John

--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]