On Sat, Dec 23, 2023 at 12:42:12PM -0800, 'Nasser M. Abbasi' via FriCAS - 
computer algebra system wrote:
> Maple has very useful command op(expression) 
> <https://www.maplesoft.com/support/help/maple/view.aspx?path=op>  which 
> basically extracts operands of the expression to an expression sequence. 
> For example, gives two lists and if I want to join the two lists into one 
> list, I could do
> 
> L1:=["A","B","C"];
> L2:=["E","F","G"];
> L3:=[ op(L1) , op(L2) ];
> 
>               L3 := ["A", "B", "C", "E", "F", "G"]
> How would one do the same thing in Fricas? concat() does not work.

I another mail you say that you want list of different types
of entries.  That is not possible in FriCAS: if you want
things in as single list you need common type, like:

(12) -> L1:=[1,2,3]

   (12)  [1, 2, 3]
                                                  Type: List(PositiveInteger)
(13) -> L2:=["D","E","F"]

   (13)  ["D", "E", "F"]
                                                           Type: List(String)
(14) -> concat(L1::List(Any), L2)

   (14)  [1, 2, 3, "D", "E", "F"]
                                                              Type: List(Any)

Note: you can embed any FriCAS type into Any, but once you did this
you loose many nice properties.  In particular FriCAS chooses
operations based on types, but there are only few operations
applicable to Any.  Normally you would like much more specific
type.

> Also 
> concat only works on string while the above Maple code works on any type of 
> list.

In FriCAS 'concat' is overloaded.  Above it was 'concat' for
UnaryRecursiveAggregate, which means lists and a bit more.
There is also 'concat' for 'LinearAggregate', in particular vectors
and strings.

> Does Fricas have something similar to Maple's op?

You did not say what you want to do.  If goal is transforming
expressions, then FriCAS has tools to do this, but they are
different.  Note that FriCAS expressions are different than
Maple expressions.

If you want "untyped" computations, then you are really fighting
against FriCAS: one of core principles in FriCAS is that operations
should be "well typed", that is operate on specific types and
produce result of specific type.  FriCAS types are pretty general
so this usually is not a trouble.  There are possibilites do
do "untyped" things, say using Any or SExpession, but you
should first try to fit things into normal FriCAS types.

-- 
                              Waldek Hebisch

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZYdTakp0loWKMgD5%40fricas.org.

Reply via email to