John Cremona on Sun, 05 Aug 2012 14:32:42 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Patch: default(sopath), default(outputsp[aces])


I like the option of printing without spaces -- I have at least one
script where I have to remove spaces afterwards using sed.  And since
people can add their own newlines easily I vote not to have a default
newline with printsep.

How hard would it be to have a more general printf?

John

On 5 August 2012 12:51, Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr> wrote:
> * Bill Allombert [2012-08-05 12:20]:
>> On Sun, Aug 05, 2012 at 02:15:10AM +0200, Karim Belabas wrote:
>>> I finally found time to go back to this patch proposed by Gonzalo Tornaria
>>> more than 8 years ago:
>>>
>>>   <http://pari.math.u-bordeaux1.fr/archives/pari-dev-0401/msg00028.html>
>>>
>>> ( Sorry it took so looong: so much to do, so little time :-( )
>>>
>>> This one is not implemented as a defaut, but via the new function printsep(),
>>> suggested by Don Zagier:
>>>
>>> (01:14) gp > ??printsep
>>> printsep(sep,{str}*):
>>>
>>>    Outputs  its   (string)   arguments  in  raw format,  ending with a newline.
>>
>> Currently it does not end by a newline.
>>
>> ? printsep(":", 1,2,3,4);print("e")
>> 1:2:3:4e
>
> Ah, right. We had this discussion in private and the matter was left
> unresolved (and I forgot both to push the discussion to pari-dev, and
> to update the documentation, my bad):
>
> Currently printsep does not end with \n, you may add 'print()' just after
> printsep() to insert the newline [ there would be no way to *remove* a newline
> if printsep did include it, when you don't want it ].
>
> There were a number of options:
>
> 0) let things as they currently stand: printsep() does not end by a newline,
>
> 1) have two functions printsep() [ with \n ] and printsep1() [ without ],
>
> 2) hack printsep to οmit the separating pattern between the penultimate
> and the last element *if* the latter is (or evaluates to) "\n":
>
>   ? printsep(" : ", 1,2, "\n"); printsep(" : ", 3,4, "\n");
>   1 : 2          \\ instead of 1 : 2 :
>   3 : 4
>
> 3) allow user functions with a variable number of arguments and let the user
> define his own variant.
>
> Allowing "varargs" user functions is obviously very desirable independently of
> the printsep() feature, but it's currently not available, so not an immediate
> option.
>
> What do people think ?
>
>> > > 2) default(sopath):
> [...]
>> > > I've only done it for dlopen(), but a similar wrapper should work for
>> > > win32 LoadLibrary().
>> >
>> > I have implemented such a wrapper, but have no way to test it. (My last
>> > Windows system died 2 or 3 years ago.) Hopefully it works...
>>
>> It does not seems to build with mingw:
> [...]
>> highlvl.o:highlvl.c:(.text+0x51): undefined reference to `_try_LoadLibrary'
>
> This should have been fixed by this morning's commit:
>
> commit 6fae115dcb3e89d7bc55f8644ee99571290d0b59
> Author: Karim Belabas <Karim.Belabas@math.u-bordeaux1.fr>
> Date:   Sun Aug 5 10:46:06 2012 +0200
>
>     missing LoadLibrary wrapper: fix compilation
>
>
> Cheers,
>
>     K.B.
> --
> Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
> Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
> 351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
> F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
> `
>