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-15 10:44

>>24
It's imposible to properly define a formal system that works with ultra-finitism, not only that, it makes sense for me to talk about any finite, but unbounded values (classical finitism), but it makes no sense to pick some particular value and say that that's it and no number exists beyond that. I have no problem with someone rejecting uncountable infinities, but rejecting the potential or countable infinity seems untenable.

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