Hacker Newsnew | past | comments | ask | show | jobs | submit | progrn's commentslogin

It is fair to discuss the language of an open source project in a technical leaning forum.


Yeah, but this discussion was not very fruitful. Just language-bashing.


I agree. PHP isn't as sexy as node.js or rails. Though the project is using PHP 5.5.9, composer and the Laravel framework. It seems like author is making an effort to make good PHP code. The only thing he could have done to make the code base cooler for PHP was to use HHVM.


Is it still untrue if you do not drive drunk?


Yes, that was for sober driving. NOVA has a pretty good article on it at http://www.pbs.org/wgbh/nova/space/how-risky-is-flying.html.

Their chart is slightly different from mine, in that they're counting deaths per vehicle mile rather than deaths per passenger mile, which greatly favors cars because of their lower passenger capacity.


What is the problem with that? Number + Number = number list + list = list str + str = str


It's a bit of cognitive load. It's not clear whether or not [1,2] + [3,4] should equal [1,2,3,4] or [4,6].

Keeping track of that, (oh wait, this is a numpy array, not a python list...) and things like that expand the amount of the language that a programmer must keep in her head at any one time, and are the definition of complexity.

There's no known silver bullet for the complexity / power tradeoff, which is why we get so many cool languages!


Is there some language where [4,6] is the output? That strikes me as serving some use case that I've never come across. Whereas having two lists and wanting to end up with one list with all the elements is a very common need.


I believe it would be in Matlab, as [1, 2] + [3, 4] would be considered matrix addition, in which one adds elements in corresponding places. Numpy (as mentioned in the GP) probably does similar.


Ah, ok, thanks. Right, matrix math is is the use case I was looking for.


Yes, python.

   In [1]: import numpy as np

   In [2]: a = np.array([1,2])

   In [3]: b = np.array([3,4])

   In [4]: a+b

   Out[4]: array([4, 6])


we are talking about Lists, not arrays from an unrelated library which has to be installed first. what you've done there is simply dishonest

In [1]: a = [1,2]

In [2]: b = [4,5]

In [3]: print(a+b)

Out [1, 2, 4, 5]


Is there some language where [4,6] is the output?

Yes. Python:

    >>> x = numpy.array([1,2])
    >>> y = numpy.array([3,4])
    >>> x + y
    array([4, 6])
For extra fun:

    >>> x + [3,4]
    array([4, 6])
    >>> [1,2] + y
    array([4, 6])
but, of course:

    >>> [1,2] + [3,4]
    [1, 2, 3, 4]


In R:

> a <- array(c(1,2))

> b <- array(c(3,4))

> a + b

[1] 4 6

> class(a + b)

[1] "array"


But, I cannot get a function pointer to it, right?


It is a function in the mathematics sense, not the C sense.


Exactly.


Correct me if I am wrong, but we created more powerful fuel than he had when he made that statement.


Can someone explain why this is not possible? I understand why sending a decompressor beforehand is not possible for all inputs. I don't understand this formulation of the problem, where it only needs to work for one input that you get before you need to create the decompressor.


Some simple explanation

Compression exploits redundancy in a data stream (basically). You basically get "all symbols" (and how you define this varies according to your compression method: you could do all letters in the case of text, or even text snippets that repeat, etc) and reassemble them in a way that the ones that repeat the most take less space (and you also need to start from a basic dictionary known by all uncompressors or ship it with your compressed file)

One simple analogy is writing with abbreviations, but if you write e.g. the reader has to know what "e.g." means or you have to put in the beginning "e.g. = example" (and this also takes space)

Now, a randomly generated file ideally has all symbols repeating with the same frequency, (we say all symbols have the same entropy - I'm not sure about this exact wording), hence you can't take a symbol that repeats more or less and make it take less space in your compressed file


what if instead of using your own dictionary, you use an index into an existing dictionary? such as an index into a subsequence of pi. Couldn't you then find a sequence of bytes in the file in which the index into pi takes less bytes and then replace them all with the index? If you couldn't find any in pi use e or another such number? What am I missing


In this case your dictionary either doesn't have everything or to adequately point to it you take as much space as not using it.

While Pi has all pairs of 2 digits, your index would take more space than storing the pairs itself (because you might need to go beyond position 99)

For one situation you might "get lucky" and find a coincidence, but this won't scale generically


See also: https://github.com/philipl/pifs and https://github.com/philipl/pifs/issues/23

I admit this fooled me for a bit. Good news is, I won't be fooled again by something similar :)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: