fricas -rl completion after :: coercion operator

34 views
Skip to first unread message

Grégory Vanuxem

unread,
Aug 23, 2024, 11:21:43 PM8/23/24
to fricas...@googlegroups.com
Hello,

I extensively use the readline completion facility (-rl option to start fricas).
If I have some completion propositions using TAB after '@' I do not
have one after '::'. I did not dig into this fricas facility but would
it be possible to also allow automatic completion after '::'? Or maybe
is this intrinsic to readline?

Regards,

Greg

Prof. Dr. Johannes Grabmeier

unread,
Aug 24, 2024, 7:13:49 PM8/24/24
to fricas...@googlegroups.com

Mit freundlichen Grüßen
Johannes Grabmeier

> Am 24.08.2024 um 05:21 schrieb Grégory Vanuxem <g.va...@gmail.com>:
>
> Hello,
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAHnU2daXNT6APMzHSAGZh%3Dje5Wod1BSqa_WnNF5ZLfrcieXFew%40mail.gmail.com.

Qian Yun

unread,
Aug 24, 2024, 9:17:56 PM8/24/24
to fricas...@googlegroups.com
The "-b, --break-chars" option of "rlwrap" can help.

Default list (){}[],’+-=&ˆ%$#@";|\

If you modify target/x86_64-linux-gnu/bin/fricas-readline
to include "-b :", then you can get tab completion.

- Qian

Grégory Vanuxem

unread,
Aug 24, 2024, 11:21:47 PM8/24/24
to fricas...@googlegroups.com
Hello Qian,

Le dim. 25 août 2024 à 03:17, Qian Yun <oldk...@gmail.com> a écrit :
>
> The "-b, --break-chars" option of "rlwrap" can help.
>
> Default list (){}[],’+-=&ˆ%$#@";|\
>
> If you modify target/x86_64-linux-gnu/bin/fricas-readline
> to include "-b :", then you can get tab completion.

Many thanks! That works nicely if I add ':' What is surprising is that
you have ’ (not ‘) in the default list whereas in my man page of
rlwrap it is '. In fact to obtain this character I need a visual
keyboard or cut and paste this character from this mail. So if I use:

exec $RLWRAP -b '(){}[],’+-=&ˆ%$#@";|\:' -f $CFILE "$@"

in src/etc/fricas-readline all seems good and ' is not affected
apparently i.e. no completion after it. So, even with:

fl:DoubleFloat:=12.0

DoubleFloat is correctly tab-completed.

Waldek, what do you think about this addition to
src/etc/fricas-readline? I don't know if you use the -rl option but it
is very handy, very informative from my point of view. For example, in
my settings:

(1) -> hyper<TAB><TAB>
hyperFactorial hypergeometric0F1Regularized hypergeometricF
hyperelliptic hypergeometric1F1 hypergeometricU
hypergeometric0F1 hypergeometric1F1Regularized
(1) -> hyper

gives you an informative list of functions. After, users just have to
use ')display operations' or their abbreviated forms to know
parameters and origins. I don't know if this is mentioned somewhere in
the FriCAS documentation but it could be I think.

- Greg

PS: The modified list of characters can also be "improved" of course.

Grégory Vanuxem

unread,
Aug 24, 2024, 11:25:59 PM8/24/24
to fricas...@googlegroups.com
Johannes, apparently, your message was lost somewhere.

Le dim. 25 août 2024 à 01:13, Prof. Dr. Johannes Grabmeier
<joha...@grabmeier.net> a écrit :
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/1833244F-84C4-40F3-8D0F-7BB9EEEF5C1B%40grabmeier.net.

Grégory Vanuxem

unread,
Aug 24, 2024, 11:34:00 PM8/24/24
to fricas...@googlegroups.com
Le dim. 25 août 2024 à 05:21, Grégory Vanuxem <g.va...@gmail.com> a écrit :
[...]

> PS: The modified list of characters can also be "improved" of course.

In fact I would even prefer:

exec $RLWRAP -b "(){}[],’\'+-=&ˆ%$#@;|\:" -f $CFILE "$@"

since ' is affected otherwise, I was wrong

Waldek Hebisch

unread,
Aug 26, 2024, 6:00:47 PM8/26/24
to fricas...@googlegroups.com
On Sun, Aug 25, 2024 at 05:21:07AM +0200, Grégory Vanuxem wrote:
> Hello Qian,
>
> Le dim. 25 août 2024 à 03:17, Qian Yun <oldk...@gmail.com> a écrit :
> >
> > The "-b, --break-chars" option of "rlwrap" can help.
> >
> > Default list (){}[],’+-=&ˆ%$#@";|\
> >
> > If you modify target/x86_64-linux-gnu/bin/fricas-readline
> > to include "-b :", then you can get tab completion.
>
> Many thanks! That works nicely if I add ':' What is surprising is that
> you have ’ (not ‘) in the default list whereas in my man page of
> rlwrap it is '. In fact to obtain this character I need a visual
> keyboard or cut and paste this character from this mail. So if I use:
>
> exec $RLWRAP -b '(){}[],’+-=&ˆ%$#@";|\:' -f $CFILE "$@"
>
> in src/etc/fricas-readline all seems good and ' is not affected
> apparently i.e. no completion after it. So, even with:
>
> fl:DoubleFloat:=12.0
>
> DoubleFloat is correctly tab-completed.
>
> Waldek, what do you think about this addition to
> src/etc/fricas-readline?

I do not use rlwrap with fricas. If this works well for people
using rlwrap, then it can go in.

--
Waldek Hebisch

Qian Yun

unread,
Aug 28, 2024, 6:19:17 AM8/28/24
to fricas...@googlegroups.com
I suggest to use

-b '(){}[],+-=&^%$#@";|\:'"'"

This way, both single quote and double quote is passed to rlwrap.

If there's no objection, I will commit it later.

- Qian

Grégory Vanuxem

unread,
Aug 28, 2024, 8:01:49 AM8/28/24
to fricas...@googlegroups.com
Hello Qian,

Le mer. 28 août 2024 à 12:19, Qian Yun <oldk...@gmail.com> a écrit :
>
> I suggest to use
>
> -b '(){}[],+-=&^%$#@";|\:'"'"
>
> This way, both single quote and double quote is passed to rlwrap.

In fact I tried to improve it a little but it was not totally
finished. I may be wrong but apparently some sort of regular
expressions seems to be in use, here is the one I use right now:

"([{>,\'\+-\*=\^\$#@;\:"

but I am pretty sure it can be improved. '>' for example is of use in
expressions like i +-> fun(i) for i in.. I also removed closing
"sets" characters ' ] ) }'. In fact I wanted to list all binary operators in
use in FriCAS to add them, I do not remember for example use of | as in C. And
from memory there are some not very used logical operators like /\ or
\/ and time was missing to list them. It's a shame that there isn't the
opposite of "-b": --no-break-chars, with something like [a-bA-B_!?] etc.

- Greg

Grégory Vanuxem

unread,
Aug 28, 2024, 10:20:34 AM8/28/24
to fricas...@googlegroups.com
Qian,

Le mer. 28 août 2024 à 12:19, Qian Yun <oldk...@gmail.com> a écrit :
>
> I suggest to use
>
> -b '(){}[],+-=&^%$#@";|\:'"'"
>
> This way, both single quote and double quote is passed to rlwrap.
>
> If there's no objection, I will commit it later.

After digging more into FriCAS code I would suggest:

exec $RLWRAP -b "([{><,\'\"\+-\*/\\~=\^\$#@;\:" -f $CFILE "$@"

Any suggestions are as usual welcome.

- Greg

Qian Yun

unread,
Aug 28, 2024, 10:41:56 AM8/28/24
to fricas...@googlegroups.com
Why omit ")]}"?

Also if you use single quote, you can save the backslash escape char.

- Qian

Grégory Vanuxem

unread,
Aug 28, 2024, 10:57:26 AM8/28/24
to fricas...@googlegroups.com
I do not see a function, or category/domain/package after those
characters unless there is an operator between them. I may be wrong
though.

> - Qian
>
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/9ded7fbf-4a81-48e1-bdac-bf4b47d88a1b%40gmail.com.

Grégory Vanuxem

unread,
Aug 28, 2024, 11:01:53 AM8/28/24
to fricas...@googlegroups.com
I didn't know. But please, do it. I would not have suggested this
without your -b insight. If there is a commit I am not the only
author.

Qian Yun

unread,
Aug 29, 2024, 7:35:43 AM8/29/24
to fricas...@googlegroups.com
I suggest this then:

-b '(){}[],+-=&^%$#@";|\:<>*~'"'"

It adds :<>*~ in addition to the defaults. ('/' is in defaults.)

')}]' can still be useful in completion, at least they do no harm.

- Qian

On 8/28/24 10:19 PM, Grégory Vanuxem wrote:

Grégory Vanuxem

unread,
Aug 29, 2024, 8:07:20 AM8/29/24
to fricas...@googlegroups.com
Le jeu. 29 août 2024 à 13:35, Qian Yun <oldk...@gmail.com> a écrit :
>
> I suggest this then:
>
> -b '(){}[],+-=&^%$#@";|\:<>*~'"'"
>
> It adds :<>*~ in addition to the defaults. ('/' is in defaults.)
>
> ')}]' can still be useful in completion, at least they do no harm.

Yes, exactly. That's fine with me. That could help I think.

Greg
Reply all
Reply to author
Forward
0 new messages