Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lounge

Name: Voiden Froze !!Bj5xlFz8N6pmNy3 2011-12-14 9:54

Okay /prog/ let's have a code-off!

The most fun way of carrying text over long lines, typical to that of your favorite    , in the language of your choice.

Let's kick off with some simple FIOCthp:


# -*- coding: cp1252 -*-
MAX_LINE_LENGTH =  60
a="""The list methods make it very easy to use a list as a stack, where the last element added is the first element retrieved (“last-in, first-out”). To add an item to the top of the stack, use append(). To retrieve an item from the top of the stack, use pop() without an explicit index. For example:"""

def cut_lines(words,result,line=''):
    if len(words):
        if len(words[0])>MAX_LINE_LENGTH:
            result.append(words.pop(0))
        else:
            test = line+words[0]+' '
            if len(test)<=MAX_LINE_LENGTH:
                words.pop(0)
                cut_lines(words,result,test)
            else:
                result.append(line)
                cut_lines(words,result)
    else:
        result.append(line)
       
def carry_lines(a):
    words=a.split()
    result=[]
    cut_lines(words,result)
    return result

for element in carry_lines(a):
    print element

Name: Anonymous 2011-12-16 8:49

>>27
Except Aleph-Null isn't a number, it's a cardinal.
It may be the cardinal of the natural numbers, but Peano Arithmetic works fine even if you don't consider it within the context of some set theory.
>>30
If you keep the finite numbers unbounded, you still get countable infinity. Even if you limit numbers up to some bound, you'd still get countable infinity when you talk about theorems within the system.


This all depends on what axiomatic system you pick. You're free to pick something that doesn't talk about infinity directly (such as Peano Arithmetic or lesser), but you still get infinity in some forms when you analyze the metamathematical properties of such systems.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List