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

Pages: 1-

My workday

Name: Anonymous 2012-10-11 5:27

I was assigned to some ERP project. That shit is boring as hell so I accidentally opened FIOC interpreter and wasted some time.

Damn I hate enterprise crap.


Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.1.1
>>> u = (1,1,1)
>>> v = (2,2,2)
>>> zip(u, v)
0: [(1, 2), (1, 2), (1, 2)]
>>> def dot(u, v):
...     sum(a*b for a, b in zip(u, v))
>>> dot(u, v)
>>> def dot(u, v):
...     return sum(a*b for a, b in zip(u, v))
>>> dot(u, v)
1: 6
>>> def intrsct(ld, so, sr):
...     ld = unit_vec(ld)
...     base = dot(ld, so) # direction . center point
...     discr = dot(ld, so) ** 2 - dot(so, so) + sr ** 2
...     if (discr < 0):
...         return []
...     elif discr == 0:
...         return [x * base for x in ld]
...     dists = [base + math.sqrt(discr), base - math.sqrt(discr)]
...     return [[x * dist for x in ld] for dist in dists]
>>> def unit_vec(u):
...     ulen = dot(u, u)
...     return [float(x) / ulen for x in u]
>>> unit_vec(v)
2: [0.16666666666666666, 0.16666666666666666, 0.16666666666666666]
>>> def unit_vec(u):
...     ulen = math.sqrt(dot(u, u))
...     return [float(x) / ulen for x in u]
>>> import math
>>> unit_vec(v)
3: [0.5773502691896258, 0.5773502691896258, 0.5773502691896258]
>>> intrsct([1, 0, 0], [0, 0, 0], 1.0)
4: [[1.0, 0.0, 0.0], [-1.0, -0.0, -0.0]]
>>> def draw_shit(spheres, rows, cols, camdist=2.0):
...     result = [[0 for i in range(cols)] for j in range(rows)]
...     for row in range(rows):
...         for col in range(cols):
...             y = float(row) / rows - 0.5
...             x = float(col) / cols - 0.5
...             raydir = (x, y, camdist)
...             if any(len(intrsct(raydir, sphere[0], sphere[1])) > 0 for sphere in spheres):
...                 result[y][x] = res
...     return result
>>> spheres = [([0.1, 0, 5], 1)]
>>> rs = draw_shit(spheres, 40, 40)
Traceback (most recent call last):
  File "<pyshell#16>", line 1, in <module>
    rs = draw_shit(spheres, 40, 40)
  File "<pyshell#14>", line 9, in draw_shit
    result[y][x] = res
NameError: global name 'res' is not defined
>>> def draw_shit(spheres, rows, cols, camdist=2.0):
...     result = [[0 for i in range(cols)] for j in range(rows)]
...     for row in range(rows):
...         for col in range(cols):
...             y = float(row) / rows - 0.5
...             x = float(col) / cols - 0.5
...             raydir = (x, y, camdist)
...             if any(len(intrsct(raydir, sphere[0], sphere[1])) > 0 for sphere in spheres):
...                 result[y][x] = 1
...     return result
>>> rs = draw_shit(spheres, 40, 40)
Traceback (most recent call last):
  File "<pyshell#18>", line 1, in <module>
    rs = draw_shit(spheres, 40, 40)
  File "<pyshell#17>", line 9, in draw_shit
    result[y][x] = 1
TypeError: list indices must be integers, not float
>>> def draw_shit(spheres, rows, cols, camdist=2.0):
...     result = [[0 for i in range(cols)] for j in range(rows)]
...     for row in range(rows):
...         for col in range(cols):
...             y = float(row) / rows - 0.5
...             x = float(col) / cols - 0.5
...             raydir = (x, y, camdist)
...             if any(len(intrsct(raydir, sphere[0], sphere[1])) > 0 for sphere in spheres):
...                 result[row][col] = 1
...     return result
>>> rs = draw_shit(spheres, 40, 40)
>>> len(rs)
5: 40
>>> len(rs[0])
6: 40
>>> for r in rs:
...     print ''.join(r)
Traceback (most recent call last):
  File "<pyshell#23>", line 2, in <module>
    print ''.join(r)
TypeError: sequence item 0: expected string, int found
>>> for r in rs:
...     print ''.join(map(str, r))
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000111111000000000000000
0000000000000000111111111111100000000000
0000000000000011111111111111111000000000
0000000000001111111111111111111100000000
0000000000011111111111111111111110000000
0000000000111111111111111111111111000000
0000000001111111111111111111111111100000
0000000001111111111111111111111111110000
0000000011111111111111111111111111110000
0000000111111111111111111111111111111000
0000000111111111111111111111111111111000
0000000111111111111111111111111111111100
0000001111111111111111111111111111111100
0000001111111111111111111111111111111100
0000001111111111111111111111111111111100
0000001111111111111111111111111111111100
0000001111111111111111111111111111111110
0000001111111111111111111111111111111100
0000001111111111111111111111111111111100
0000001111111111111111111111111111111100
0000001111111111111111111111111111111100
0000000111111111111111111111111111111100
0000000111111111111111111111111111111000
0000000111111111111111111111111111111000
0000000011111111111111111111111111110000
0000000001111111111111111111111111110000
0000000001111111111111111111111111100000
0000000000111111111111111111111111000000
0000000000011111111111111111111110000000
0000000000001111111111111111111100000000
0000000000000011111111111111111000000000
0000000000000000111111111111100000000000
0000000000000000000111111000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
0000000000000000000000000000000000000000
>>> rs = draw_shit(spheres, 40, 60)
>>> for r in rs:
...     print ''.join(map(str, r))
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000011111111110000000000000000000000
000000000000000000000001111111111111111111100000000000000000
000000000000000000001111111111111111111111111100000000000000
000000000000000000111111111111111111111111111111000000000000
000000000000000011111111111111111111111111111111110000000000
000000000000000111111111111111111111111111111111111000000000
000000000000001111111111111111111111111111111111111100000000
000000000000011111111111111111111111111111111111111110000000
000000000000111111111111111111111111111111111111111111000000
000000000001111111111111111111111111111111111111111111100000
000000000011111111111111111111111111111111111111111111110000
000000000011111111111111111111111111111111111111111111110000
000000000111111111111111111111111111111111111111111111111000
000000000111111111111111111111111111111111111111111111111000
000000000111111111111111111111111111111111111111111111111000
000000000111111111111111111111111111111111111111111111111000
000000001111111111111111111111111111111111111111111111111100
000000000111111111111111111111111111111111111111111111111000
000000000111111111111111111111111111111111111111111111111000
000000000111111111111111111111111111111111111111111111111000
000000000111111111111111111111111111111111111111111111111000
000000000011111111111111111111111111111111111111111111110000
000000000011111111111111111111111111111111111111111111110000
000000000001111111111111111111111111111111111111111111100000
000000000000111111111111111111111111111111111111111111000000
000000000000011111111111111111111111111111111111111110000000
000000000000001111111111111111111111111111111111111100000000
000000000000000111111111111111111111111111111111111000000000
000000000000000011111111111111111111111111111111110000000000
000000000000000000111111111111111111111111111111000000000000
000000000000000000001111111111111111111111111100000000000000
000000000000000000000001111111111111111111100000000000000000
000000000000000000000000000011111111110000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000
>>> def print_shit():
...     rs = draw_shit(spheres, 40, 60)
...     for r in rs:
...         print ''.join(map(str, r))
>>> def print_shit():
...     rs = draw_shit(spheres, 40, 75)
...     for r in rs:
...         print ''.join(map(str, r))
>>>

Name: Anonymous 2012-10-11 5:45

Erotic Role Play

Name: 1 2012-10-11 6:38

The rest, i was fucking productive this day.

Yeah, the code is full of duplication and other smells.


>>> def perse(d, n):
...     mul = -2.0 * dot(d, n)
...     return [d[i] + n[i] * mul for i in range(len(d))]
>>> perse((1, 0, 0), (-1, 0.5, 0))
7: [-1.0, 1.0, 0.0]
>>> def lval(scale, intr, indr, n, light):
...     p = perse(unit_vec(indr), unit_vec(n))
...     mag = dot(p, [a - b for a, b in zip(light, intr)])
...     return 0 if mag < 0 else int(mag * scale)
>>> lval(7, (1, 0, 0), (1, 0, 0), (-1, 0.5, 0), (-2, -3, 0))
8: 0
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0.5, 0), (-2, -3, 0))
9: 0
>>> def lval(scale, intr, indr, n, light):
...     p = perse(unit_vec(indr), unit_vec(n))
...     mag = unit_vec(dot(p, [a - b for a, b in zip(light, intr)]))
...     return 0 if mag < 0 else int(mag * scale)
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0.5, 0), (-2, -3, 0))
Traceback (most recent call last):
  File "<pyshell#35>", line 1, in <module>
    lval(700, (1, 0, 0), (1, 0, 0), (-1, 0.5, 0), (-2, -3, 0))
  File "<pyshell#34>", line 3, in lval
    mag = unit_vec(dot(p, [a - b for a, b in zip(light, intr)]))
  File "<pyshell#10>", line 2, in unit_vec
    ulen = math.sqrt(dot(u, u))
  File "<pyshell#5>", line 2, in dot
    return sum(a*b for a, b in zip(u, v))
TypeError: zip argument #1 must support iteration
>>> def lval(scale, intr, indr, n, light):
...     p = perse(unit_vec(indr), unit_vec(n))
...     mag = dot(p, unit_vec([a - b for a, b in zip(light, intr)]))
...     return 0 if mag < 0 else int(mag * scale)
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0.5, 0), (-2, -3, 0))
10: 0
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0.5, 0), (2, 3, 0))
11: 398
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (-1, 0, 0))
12: 700
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (-1, 0.1, 0))
13: 699
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (-1, 1, 0))
14: 626
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (0, 1, 0))
15: 494
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (1, 1, 0))
16: 0
>>> lval(700, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (0.01, 1, 0))
17: 492
>>> lval(7, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (0.01, 1, 0))
18: 4
>>> lval(7, (1, 0, 0), (1, 0, 0), (-1, 0, 0), (-1, 1, 0))
19: 6
>>> def vecsub(u, v):
...     return [a-b for a,b in zip(u, v)]
...
... def draw_shit(spheres, rows, cols, camdist=2.0, light=(5, 0.5, 0)):
...     result = [[0 for i in range(cols)] for j in range(rows)]
...     sphere = spheres[0]
...     for row in range(rows):
...         for col in range(cols):
...             y = float(row) / rows - 0.5
...             x = float(col) / cols - 0.5
...             raydir = (x, y, camdist)
...             intrs = [i for i in intrsct(raydir, sphere[0], sphere[1])
...                      if dot(vecsub(i, sphere[0]), raydir) < 0]
...             if len(intrs) > 0:
...                 intr = intrs[0]
...                 result[row][col] = lval(8, intr, raydir,
...                         [a-b for a, b in ziip(intr, sphere[0])], light)
...     return result
>>> vecsub
20: <function vecsub at 0x025A4E70>
>>> draw_shit
21: <function draw_shit at 0x025A4DF0>
>>> print_shit()
Traceback (most recent call last):
  File "<pyshell#50>", line 1, in <module>
    print_shit()
  File "<pyshell#28>", line 2, in print_shit
    rs = draw_shit(spheres, 40, 75)
  File "<pyshell#47>", line 17, in draw_shit
    [a-b for a, b in ziip(intr, sphere[0])], light)
NameError: global name 'ziip' is not defined
>>> def vecsub(u, v):
...     return [a-b for a,b in zip(u, v)]
...
... def draw_shit(spheres, rows, cols, camdist=2.0, light=(5, 0.5, 0)):
...     result = [[0 for i in range(cols)] for j in range(rows)]
...     sphere = spheres[0]
...     for row in range(rows):
...         for col in range(cols):
...             y = float(row) / rows - 0.5
...             x = float(col) / cols - 0.5
...             raydir = (x, y, camdist)
...             intrs = [i for i in intrsct(raydir, sphere[0], sphere[1])
...                      if dot(vecsub(i, sphere[0]), raydir) < 0]
...             if len(intrs) > 0:
...                 intr = intrs[0]
...                 result[row][col] = lval(8, intr, raydir,
...                         [a-b for a, b in zip(intr, sphere[0])], light)
...     return result

Name: Anonymous 2012-10-11 6:38

>>3 continuees

>>> print_shit()
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000011111111110000000000000000000
000000000000000000000000000000000000000000111112222222222111000000000000000
000000000000000000000000000000000000000011122222333333333222110000000000000
000000000000000000000000000000000000001112223333344444444333322100000000000
000000000000000000000000000000000000011222333344444555554444333210000000000
000000000000000000000000000000000000112223334445555555555555443322100000000
000000000000000000000000000000000001122333444555556666666655554432210000000
000000000000000000000000000000000011223334445556666666666666655443210000000
000000000000000000000000000000000111223344455566666777777766665544321000000
000000000000000000000000000000000112233444555666677777777777666554321000000
000000000000000000000000000000000112233444556666777777777777766554432000000
000000000000000000000000000000001122233445556667777777777777766654432100000
000000000000000000000000000000001122333445556667777777777777766654432000000
000000000000000000000000000000001122233445556666777777777777766554332000000
000000000000000000000000000000000112233444556666777777777777666554321000000
000000000000000000000000000000000112233444555666677777777776665543320000000
000000000000000000000000000000000111223344455566666677776666655443210000000
000000000000000000000000000000000011222334445555666666666665554432100000000
000000000000000000000000000000000001122233444455555566555555443321000000000
000000000000000000000000000000000000112223334444455555555444332210000000000
000000000000000000000000000000000000011122233334444444444333221000000000000
000000000000000000000000000000000000000111222233333333333221100000000000000
000000000000000000000000000000000000000001111222222222221110000000000000000
000000000000000000000000000000000000000000000111111111000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
>>> def print_shit():
...     rs = draw_shit(spheres, 40, 75)
...     for r in rs:
...         print ''.join(map(chrval, r))
>>> def chrval(i):
...     hurr = '.,-~=*%&0#'
...     if 0 < i < len(hurr):
...         return hurr[i]
...     else:
...         return '.'
>>> print_shit()
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
..............................................,,,,,,,,,,...................
..........................................,,,,,----------,,,...............
........................................,,,-----~~~~~~~~~---,,.............
......................................,,,---~~~~~========~~~~--,...........
.....................................,,---~~~~=====*****====~~~-,..........
....................................,,---~~~===*************==~~--,........
...................................,,--~~~===*****%%%%%%%%****==~--,.......
..................................,,--~~~===***%%%%%%%%%%%%%%**==~-,.......
.................................,,,--~~===***%%%%%&&&&&&&%%%%**==~-,......
.................................,,--~~===***%%%%&&&&&&&&&&&%%%**=~-,......
.................................,,--~~===**%%%%&&&&&&&&&&&&&%%**==~-......
................................,,---~~==***%%%&&&&&&&&&&&&&&%%%*==~-,.....
................................,,--~~~==***%%%&&&&&&&&&&&&&&%%%*==~-......
................................,,---~~==***%%%%&&&&&&&&&&&&&%%**=~~-......
.................................,,--~~===**%%%%&&&&&&&&&&&&%%%**=~-,......
.................................,,--~~===***%%%%&&&&&&&&&&%%%**=~~-.......
.................................,,,--~~===***%%%%%%&&&&%%%%%**==~-,.......
..................................,,---~~===****%%%%%%%%%%%***==~-,........
...................................,,---~~====******%%******==~~-,.........
....................................,,---~~~=====********===~~--,..........
.....................................,,,---~~~~==========~~~--,............
.......................................,,,----~~~~~~~~~~~--,,..............
.........................................,,,,-----------,,,................
.............................................,,,,,,,,,.....................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
...........................................................................
>>> raytracer = print_shit

Name: Anonymous 2012-10-11 11:30

Not bad. Now find a minimal yet sufficient subset of Lisp that yields full expressive power, implement it in FIOC, write a tiny standard library, then implement what you just did in it.

Name: Anonymous 2012-10-11 12:58

metacircular brainfuck interpreter

Name: Anonymous 2012-10-11 17:45

>>1
''.join(map(str, r))
looks like shit.

Name: Anonymous 2012-10-11 17:48

I am far from an expert at Python, but I have done a couple of semi-serious projects in the language and will try to recall specifically what I didn't like.

- Everything you write will be open source. No FASLs, DLLs or EXEs. Developer may want to have control over the level of access to prevent exposure of internal implementation, as it may contain proprietary code or because strict interface/implementation decomposition is required. Python third-party library licensing is overly complex. Licenses like MIT allow you to create derived works as long as you maintain attrubution; GNU GPL, or other 'viral' licenses don't allow derived works without inheriting the same license. To inherit the benefits of an open source culture you also inherit the complexities of the licensing hell.
- Installation mentality, Python has inherited the idea that libraries should be installed, so it infact is designed to work inside unix package management, which basically contains a fair amount of baggage (library version issues) and reduced portability. Of course it must be possible to package libraries with your application, but its not conventional and can be hard to deploy as a desktop app due to cross platform issues, language version, etc. Open Source projects generally don't care about Windows, most open source developers use Linux because "Windows sucks".
- Probably the biggest practical problem with Python is that there's no well-defined API that doesn't change. This make life easier for Guido and tough on everybody else. That's the real cause of Python's "version hell".
- Global Interpreter Lock (GIL) is a significant barrier to concurrency. Due to signaling with a CPU-bound thread, it can cause a slowdown even on single processor. Reason for employing GIL in Python is to easy the integration of C/C++ libraries. Additionally, CPython interpreter code is not thread-safe, so the only way other threads can do useful work is if they are in some C/C++ routine, which must be thread-safe.
- Python (like most other scripting languages) does not require variables to be declared, as (let (x 123) ...) in Lisp or int x = 123 in C/C++. This means that Python can't even detect a trivial typo - it will produce a program, which will continue working for hours until it reaches the typo - THEN go boom and you lost all unsaved data. Local and global scopes are unintuitive. Having variables leak after a for-loop can definitely be confusing. Worse, binding of loop indices can be very confusing; e.g. "for a in list: result.append(lambda: fcn(a))" probably won't do what you think it would. Why nonlocal/global/auto-local scope nonsense?
- Python has a faulty package system. Type time.sleep=4 instead of time.sleep(4) and you just destroyed the system-wide sleep function with a trivial typo. Now consider accidentally assigning some method to time.sleep, and you won't even get a runtime error - just very hard to trace behavior. And sleep is only one example, it's just as easy to override ANYTHING.
- Crippled support for functional programming. Python's lambda is limited to a single expression and doesn't allow conditionals. Python makes a distinction between expressions and statements, and does not automatically return the last expressions, thus crippling lambdas even more. Assignments are not expressions. Most useful high-order functions were deprecated in Python 3.0 and have to be imported from functools. No continuations or even tail call optimization: "I don't like reading code that was written by someone trying to use tail recursion." --Guido
- Python's syntax, based on SETL language and mathematical Set Theory, is non-uniform, hard to understand and parse, compared to simpler languages, like Lisp, Smalltalk, Nial and Factor. Instead of usual "fold" and "map" functions, Python uses "set comprehension" syntax, which has overhelmingly large collection of underlying linguistic and notational conventions, each with it's own variable binding semantics. This, in effect, makes Python look like an overengineered toy for math geeks. Good luck discerning [f(z) for y in x for z in gen(y) if pred(z)] from [f(z) if pred(z) for z in gen(y) for y in x]. In addition, you will enjoy cryptic expressions like z(*z(*m.i())[::-1]).
- Forced Indentation of Code (aka "off-side" rule) impedes using CLI, automatically generating Python code and moving around large code blocks. Editing Python code requires special editors (forget about Word/Notepad), that expand tabs into spaces, while sharing code through a web post or email will most likely break indentation. Absence of block-terminator is so utterly confusing, that you'll find yourself ending blocks with #endif anyway. It's painful to deal with other things that need indenting, such as large SQL queries, or HTML when you're using things like mod_python.
- Python hides logical connectives in a pile of other symbols: try seeing "and" in  "if y > 0 or new_width > width and new_height > height or x < 0".
- Python indulges messy horizontal code (> 80 chars per line), where in Lisp one would use "let" to break computaion into manageable pieces. Get used to stuff like self.convertId([(name, uidutil.getId(obj)) for name, obj in container.items() if IContainer.isInstance(obj)])
- Quite quirky: triple-quoted strings seem like a syntax-decision from a David Lynch movie, and double-underscores, like __init__, seem appropriate in C, but not in a language that provides list comprehensions. There are better ways to mark certain features as internal or special than just calling it __feature__. self everywhere can make you feel like OO was bolted on, even though it wasn't. Arithmetics on strings may surprise you: "2" * 3 is "222", "2"+"3" is "23", while "2" * "3" and "2"+3 are type errors. Creating an object just to call a function, like ''.join(map(str, r)), is just annoying.
- Python has too many confusing non-orthogonal features: references can't be used as hash keys; expressions in default arguments are calculated when the function is defined, not when it’s called. Why have both dictionaries and objects? Why have both types and duck-typing? Why is there ":" in the syntax if it almost always has a newline after it? The Python language reference devotes a whole sub-chapter to "Emulating container types", "Emulating callable Objects", "Emulating numeric types", "Emulating sequences" etc. -- only because arrays, sequences etc. are "special" in Python. Subtle data types (list and tuple, bytes and bytearray) will make you wonder "Do I need the mutable type here?", while Clojure and Haskell manage to do with only immutable data.
- Python's GC uses naive reference counting, which is slow and doesn't handle circular references, meaning you have to expect subtle memory leaks and can't easily use arbitrary graphs as your data. In effect Python complicates even simple tasks, like keeping directory tree with symlinks.
- Patterns and anti-patterns are signs of deficiencies inherent in the language.  In Python, concatenating strings in a loop is considered an anti-pattern merely because the popular implementation is incapable of producing good code in such a case. The intractability or impossibility of static analysis in Python makes such optimizations difficult or impossible.
- Problems with arithmetic: no Numerical Tower (nor even rational/complex numbers), meaning 1/2 would produce 0, instead of 0.5, leading to subtle and dangerous errors.
- Poor UTF support and unicode string handling is somewhat awkward.
- No outstanding feature, that makes the language, like the brevity of APL or macros of Lisp. Python doesn’t really give us anything that wasn’t there long ago in Lisp and Smalltalk. "This is a hobby project and I neede my time for other things…" --Guido van Rossum (http://1997.webhistory.org/www.lists/www-talk.1993q1/0060.html)

Name: Anonymous 2012-10-11 18:56

wow really? people are impressed with this?

what the fuck? you're not even using javascript... just some shitty knockoff.

Name: Anonymous 2012-10-11 21:20

That feel when you can rewrite this in one APL statement with no loops.

Name: Anonymous 2012-10-11 21:23

>>10
APL is unreadable.

Name: Anonymous 2012-10-12 0:24

>>11
APL is unreadable for mental midgets.

FTFY

Name: Anonymous 2012-10-12 0:46

>>12
You cannot insult me anymore than a barking dog can.

Name: Anonymous 2012-10-12 0:53

>>> def dot(u, v):
...     sum(a*b for a, b in zip(u, v))
>>> dot(u, v)
>>> def dot(u, v):
...     return sum(a*b for a, b in zip(u, v))

Ha, I do that too. Too much Lisp programming?

Name: Anonymous 2012-10-12 0:59

>>14
In APL the dot product would be +.×. It's short enough that you don't need a function.

Name: Anonymous 2012-10-12 2:24

>>1 here

>>7
so what?

>>9
javascript
The point of this thread was not about language. It was a thread about me being bored and posting my whole interpreter session. You can basically see how I think and how my work flow goes by reading it.

>>10
Post the code or gtfo.

>>14
No, but I have been learning Ruby in past days for work stuff.


BTW, variable names I used there are very bad, but that's just because it's not ment to be read by anyone, not even by me. Coded just for fun.

Name: Anonymous 2012-10-12 2:53

Shame. Could have been done in under five lines of Javascript with 10x the speed!

Name: Anonymous 2012-10-12 3:51

>>16
>>9 is a troll.

Name: Anonymous 2012-10-12 5:39

>>17
Do it then.

Name: Anonymous 2012-10-12 9:28

>>14
I guess you cannot handle regular expressions, simple math, and a little bit of though.

Name: Anonymous 2012-10-12 9:31

>>20
Get out

Name: Anonymous 2012-10-12 11:26

Slaashdot is the chaos god of tech porn

Name: Anonymous 2012-10-12 13:27

>>20
What? I'm talking about forgetting the "return" keyword because I'm expecting the last expression to be returned automatically.

Name: Anonymous 2012-10-12 14:48

Well I'm impressed, good job

Name: Anonymous 2012-10-12 16:15

>>23
Python was supposedly influenced by Perl and Algol 68. Both of those languages return the last value of a subroutine/procedure without needing a special keyword.
PROC a = INT: (4; 5); print(a)
sub a { 4; 5 }; print a
Both of these would print "5" and not some empty or undefined value.

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