Hi,
Am 27.02.19 um 20:13 schrieb Allin Cottrell:
On Wed, 27 Feb 2019, Riccardo (Jack) Lucchetti wrote:
> On Tue, 26 Feb 2019, Artur T. wrote:
>
>>> - printing out an array of strings requires a loop if it has more
>>> than 9 elements. In some cases, this is VERY inconvenient. I see two
>>> way to go around this: either we introduce a "set" variable, which
>>> replaces the hard-wired limit at 10 we have now (something like "set
>>> arrayprint 20") or introduce an option to the print command
>>> ("--full" or similar). What do you guys prefer?
>>
>> What about introducing another function named head() as in Python's
>> pandas package? The user would call <head(x,n)> where
>> - x is either a series, list, string array or matrix
>> - n is an integer specifying to show the first 'n' entries (default:
>> 5 or)
>>
>> The output is printed in column-format.
>>
>> Similarly, there exists the tail() function in pandas show the last n
>> entries.
>>
>> This would also be helpful when working with huge datasets where
>> printing output by <print x -o> already takes quite a while...
>
> That's a good idea, although I'm a bit wary of introducing new
> cmmands. How about options to "print"? That is, for example,
>
> print X --head=10
>
> would be equivalent to
>
> smpl 1 10
> print X --byobs
> smpl full
>
> except it'd be more efficient in that we don't really perform the
> subsampling.
>
> However, this would be ok when you print series/lists. The problem for
> arrays would remain. Unless we generalise the above to something like
>
> print A --start=3 --stop=12
>
> Do you like it?
I like it but...
I have a further suggestion to throw in the pot: how about
print <object> --range=start:stop
for series, lists, matrices and arrays. We could accept a negative value
for start or stop as meaning count back from the end, and perhaps a
blank start or stop field as meaning all the way in that direction.
... Allin's idea is even nicer, there is less to write and it's more
general ;-)
We already have apparatus to parse such a specification for ranges of
matrix rows/columns, which could probably be reused without too much
difficulty.
That's even better!
Artur