PHP have different namespaces for methods and value attributes.
<?php
class C {
function d() {
return "d-value";
}
}
Prelude> let sieve (p:ps) | p > 1 = p:(sieve $ filter ((> 0) . (`mod` p)) ps) | |
Prelude> let primes = sieve [2..] | |
Prelude> take 100 primes |
#! /usr/bin/env python | |
from string import maketrans, lowercase, split | |
G_FOO = 'pgjck' # Googlon special letters | |
G_PREP_C = 'j' # Preposition character | |
G_PREP = 3 # Preposition size | |
G_VERB = 8 # Verb size | |
G_ORDER = 'kgpvbmzfhtxqcrlnjsdw' # Letter ordering | |
G_NUM_MOD = 5 # Pretty number divisor |
# coding: utf-8 | |
from __future__ import division | |
from random import uniform | |
from math import sqrt | |
def euclidian(x, y): | |
"calculates the euclidian distance between two points" | |
assert( len(x) == len(y) ) | |
return sqrt(sum((i-j)**2 for i,j in zip(x,y))) |
# coding: utf-8 | |
from __future__ import division | |
from random import uniform, choice | |
from math import sqrt | |
def euclidean(x, y): | |
"calculates the euclidean distance between two points" | |
assert( len(x) == len(y) ) | |
return sqrt(sum((i-j)**2 for i,j in zip(x,y))) |
# | |
# The probability that two integers randomly chosen are primes between then | |
# is surprisingly related to pi, this probability value is equal to 6/pi**2. | |
# This was discovered by Cesaro, in 1883. | |
# This code uses Monte Carlo method to test 10**7 pairs of random integers between | |
# 1 and 10**10 to approximate numerically the value of pi. | |
# | |
from math import sqrt # square root (to calculate pi from pi**2) |
#! /usr/bin/env python | |
# coding: utf-8 | |
"""This script reads all .java files from a directory tree and determines if | |
it's necessary to write a Copyright Notice in the beginning of each Java file. | |
It checks that by searching for the word "copyright" in the first few lines. | |
Warning: use it at your own risk. Better have a source control to rollback if | |
necessary. | |
""" |
#! /usr/bin/env python | |
# coding: utf-8 | |
"""This script reads all .java files from a directory tree and removes unused | |
import statements. It may have errors in detecting import lines (e.g. import | |
lines within block comments, or import lines with another statement in the same | |
line), and it may have false-negatives when deciding to remove an import (i.e. | |
it only removes if the last import symbol word doesn't appear at all - | |
including comments - in the code). |
from random import randint | |
print "".join(unichr(randint(0, 0x10000)) for i in xrange(100)) |
PHP have different namespaces for methods and value attributes.
<?php
class C {
function d() {
return "d-value";
}
}