#13131: Make a top-level table/Table function
----------------------------------+-----------------------------------------
       Reporter:  kcrisman        |         Owner:  was                         
    
           Type:  enhancement     |        Status:  needs_work                  
    
       Priority:  major           |     Milestone:  sage-5.7                    
    
      Component:  user interface  |    Resolution:                              
    
       Keywords:                  |   Work issues:                              
    
Report Upstream:  N/A             |     Reviewers:  Jason Grout, Karl-Dieter 
Crisman
        Authors:  John Palmieri   |     Merged in:                              
    
   Dependencies:                  |      Stopgaps:                              
    
----------------------------------+-----------------------------------------

Comment (by jason):

 Whew.  I would probably do that either of these two ways (the second way
 is more efficient, but really you could even do better by caching the
 table from run to run)
 {{{
 from itertools import izip_longest
 from collections import defaultdict

 @interact
 def _(n=7):
     L = list(izip_longest([p for p in prime_range(n+1) if p%4==1],[p for p
 in prime_range(n+1) if p%4==3],fillvalue=''))
     html.table(L,header=['$p\equiv 1\\text{ mod}(4)$','$p\equiv 3\\text{
 mod}(4)$'])


 @interact
 def _(n=7):
     m = defaultdict(list)
     for p in prime_range(n+1):
         m[p%4].append(p)
     L = list(izip_longest(m[1], m[3],fillvalue=''))
     html.table(L,header=['$p\equiv 1\\text{ mod}(4)$','$p\equiv 3\\text{
 mod}(4)$'])
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13131#comment:18>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to