#15820: Implement sequences of bounded integers
--------------------------------------------+------------------------
       Reporter:  SimonKing                 |        Owner:
           Type:  enhancement               |       Status:  new
       Priority:  major                     |    Milestone:  sage-6.3
      Component:  algebra                   |   Resolution:
       Keywords:  sequence bounded integer  |    Merged in:
        Authors:                            |    Reviewers:
Report Upstream:  N/A                       |  Work issues:
         Branch:                            |       Commit:
   Dependencies:                            |     Stopgaps:
--------------------------------------------+------------------------

Comment (by SimonKing):

 Hi Nathann,

 wouldn't the following be close to templates?

 In Cython:
 {{{
 cimport cython

 ctypedef fused str_or_int:
     str
     int

 cpdef str_or_int times_two(str_or_int var):
     return var+var

 def show_me():
     cdef str a = 'a'
     cdef int b = 3
     print 'str', times_two(a)
     print 'int', times_two(b)
 }}}
 and this results in
 {{{
 sage: show_me()
 str aa
 int 6
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/15820#comment:38>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to