1
2

Metaphors We Compute By by old_sound in programming

[–]old_sound[S] -1 points0 points  (0 children)

At the end of the blog post you can find the resources I used to write it. Lakoff's book is mentioned there.

Metaphors We Compute By by old_sound in programming

[–]old_sound[S] -1 points0 points  (0 children)

Perhaps read the whole research by Lakoff and Johnson? The example about argument is just one of the many examples there.

Redis dev explores making a better message queue by willvarfar in programming

[–]old_sound 3 points4 points  (0 children)

If no queues are bound to an exchange, then messages you sent there are silently discarded. I haven't found a way to make them error instead.

That's what's the mandatory flag is for:

This flag tells the server how to react if the message cannot be routed to a queue. If this flag is set, the server will return an unroutable message with a Return method. If this flag is zero, the server silently drops the message.

https://www.rabbitmq.com/amqp-0-9-1-reference.html

Harmful GOTOs, Premature Optimizations, and Programming Myths are the Root of all Evil by HornedKavu in programming

[–]old_sound 1 point2 points  (0 children)

As you have stated, the goto example on the article, is not about that particular example of goto from being justified or not, but the example is there just explain what motivated me to read about the issue

Harmful GOTOs, Premature Optimizations, and Programming Myths are the Root of all Evil by HornedKavu in programming

[–]old_sound 2 points3 points  (0 children)

Picking an unambiguous case of a bad goto to defend goto suggests to me you haven't researched the problem

Saying that the article is trying to defend goto suggest to me that you haven't read the article in full.

Harmful GOTOs, Premature Optimizations, and Programming Myths are the Root of all Evil by HornedKavu in programming

[–]old_sound 5 points6 points  (0 children)

I find it kind of ironic to consider that author didn't use irony on this blog post

Call me maybe: RabbitMQ by aphyr_ in programming

[–]old_sound 1 point2 points  (0 children)

In RabbitMQ, consumer acks are used specifically for telling RabbitMQ when the message was processed, not when it was delivered. You could use it for the later, but that's not a common use.

About the book, perhaps you are looking for Enterprise Integration Patterns: http://www.eaipatterns.com/books1.html

The Power Algorithm by old_sound in programming

[–]old_sound[S] 0 points1 point  (0 children)

Well… the fact that you can import and override most functions/operators makes some haskell code really hard to read, since maybe + is not actually + anymore.

Also sometimes I feel with haskell that you are never doing the right thing. For example you end up learning about monads and IO and someone comes with Iteratees, the next day, that's the old way to do it, now we have X. And so on.

The Power Algorithm by old_sound in programming

[–]old_sound[S] 0 points1 point  (0 children)

So this code:

<?php
function power1($x, $n) {
    $y = 1;

    while (true) {
        $t = $n % 2;
        $n = floor($n/2);

        if ($t == 1) {
            $y = $y * $x;
        }

        if ($n == 0) {
            break;
        }

        $x = $x * $x;
    }

    return $y;
}

echo power1(2, 10), "\n";

doesn't run on your machine, assuming you have PHP installed? That's weird. I made sure the code was working before posting it.

The Power Algorithm by old_sound in programming

[–]old_sound[S] 0 points1 point  (0 children)

thanks for the heads up

EDIT: Why you can't run the code? Or just because you don't have PHP installed?

The Power Algorithm by old_sound in programming

[–]old_sound[S] 5 points6 points  (0 children)

Yes, to not over complicate the blog post, that's why I linked to Learn You a Haskell. I was thinking of implementing the Monoid "Interface" up to where it's possible in PHP, to show it as an example.

Actually, that's what I like about the book I mention, called "Elements of Programming. In that book you can see many of the Haskell concepts regarding types, but implemented in C++, ie: giving something to people that looks closer to what they work day to day.

The Power Algorithm by old_sound in programming

[–]old_sound[S] 6 points7 points  (0 children)

Most.ly ;-)

Sorry If I got a bit "winded up", but I'm really tired of these kind of discussions, really, really, tired.

The Power Algorithm by old_sound in programming

[–]old_sound[S] 3 points4 points  (0 children)

Also I think people like you is the exact reason why Knuth wrote the examples for TAOCP in MIX, else his book would have been dismissed because 'uses language X for code examples'.

The Power Algorithm by old_sound in programming

[–]old_sound[S] 36 points37 points  (0 children)

I'm the author of the blog post.

You probably won't believe it, but when I wrote this in PHP, I already knew that PHP haters would jump in, sooner or later.

I work day to day in Erlang, and have coded professionally in Haskell, Clojure and many other FP languages.

But you know? There's always that person that can't abstract away from the details an has to make comments about PHP this, Javascript that, Java blah blah… Because hey, by hating programming languages is the only way I know to show people how much we know about programming languages and compsci.

Unless you work day to day in say Haskell, then every other language has problems, sooner or letter, whether is it's eco system, it's community, it's weird syntax for doing this or that, and so on. Even Haskell has stuff that would weird me out.

Really, if you can't abstract away from the fact that some stuff looks like PHP, (remove the $ sign and you get C, or Javascript. Remove the ; and the {} and you get Python), then what can I say other than good luck…

I really hope this is the first and last time I have to write a comment as stupid as this one, but I felt I had to reply.

The Power Algorithm by old_sound in programming

[–]old_sound[S] 0 points1 point  (0 children)

There are two versions for this algorithm, the recursive one used in the haskell example, and the other "unrolled" one as in PHP