#8233: concatenation of words should preserve the data type represention when
possible
-----------------------------+----------------------------------------------
   Reporter:  slabbe         |       Owner:  sage-combinat
       Type:  enhancement    |      Status:  needs_review 
   Priority:  major          |   Milestone:  sage-4.3.3   
  Component:  combinatorics  |    Keywords:               
     Author:                 |    Upstream:  N/A          
   Reviewer:                 |      Merged:               
Work_issues:                 |  
-----------------------------+----------------------------------------------
Changes (by slabbe):

  * status:  new => needs_review


Old description:

> This concerns word represented by str, tuple and list :
>
> {{{
> sage: u = Word(range(10))
> sage: type(u)
> <class 'sage.combinat.words.word.FiniteWord_list'>
> sage: type(u*u)
> <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
> }}}
> {{{
> sage: v = Word('asdgadsf')
> sage: type(v)
> <class 'sage.combinat.words.word.FiniteWord_str'>
> sage: type(v*v)
> <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
> }}}
> {{{
> sage: v = Word((2,3,5,21,34,6))
> sage: type(v)
> <class 'sage.combinat.words.word.FiniteWord_tuple'>
> sage: type(v*v)
> <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
> }}}

New description:

 This concerns word represented by str, tuple and list.

 1. We want the representation of a concatenation of two words u and v to
 be preserved when u and v are of the same data type.

 ACTUAL BEHAVIOR:

 {{{
 sage: u = Word(range(10))
 sage: type(u)
 <class 'sage.combinat.words.word.FiniteWord_list'>
 sage: type(u*u)
 <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
 }}}
 {{{
 sage: v = Word('asdgadsf')
 sage: type(v)
 <class 'sage.combinat.words.word.FiniteWord_str'>
 sage: type(v*v)
 <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
 }}}
 {{{
 sage: v = Word((2,3,5,21,34,6))
 sage: type(v)
 <class 'sage.combinat.words.word.FiniteWord_tuple'>
 sage: type(v*v)
 <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
 }}}

 2. Moreover, the empty word could be ignored for concatenation :

 ACTUAL BEHAVIOR:

 {{{
 sage: type(Word([]) * Word('asdga'))
 <class 'sage.combinat.words.word.FiniteWord_callable_with_caching'>
 }}}

 INTENDED BEHAVIOR:

 {{{
 sage: type(Word([]) * Word('asdga'))
 <class 'sage.combinat.words.word.FiniteWord_str'>
 }}}

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8233#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to