HN user

TweedHeads

841 karma

spamback-at-rocketmail-dot-com

Posts5
Comments703
View on HN
Y Combinators in C# 17 years ago

Full anonimity, thanks to tilly (separated for better understanding):

  builder   = function(x){ return function(n){ return x(x)(n); }}
  factorial = function(f){ return function(n){ return n==0?1:n*f(f)(n-1);} }
  alert(builder(factorial)(8))
One liner, just seed factorial to builder:
  r = (function(x){ return function(n){ return x(x)(n); } } (function(f){ return function(n){ return n==0?1:n*f(f)(n-1);} }))(8);
Y Combinators in C# 17 years ago

Javascript can do it all:

  function fac(x){ return x==0?1:x*fac(x-1); }
  a = fac(8);

  or a one-liner:

  a = (function fac(x){ return x==0?1:x*fac(x-1); })(8);
Both ways spit 4320

"Its first netbook, the Nokia Booklet 3G, will use Microsoft’s Windows software and Intel’s Atom processor"

There, doomed.

If you don't extend your arms to the open source community, don't expect us to open our arms when you need us.

Fuck you Nokia.

Taking a closer look at my macbook keyboard, of all the lisp forks, I'd go with squared brackets [lisp] for convenience.

Ergonomics win.

Dear Paul, when I say its syntax is its best friend, that's exactly what I'm talking about.

Now, say I fork lisp and change one little thing:

(defun foo (n) (lambda (i) (incf n i)))

to this:

[defun foo [n] [lambda [i] [incf n i]]]

or even this:

{defun foo {n} {lambda {i} {incf n i}}}

or how about this?

<defun foo <n> <lambda <i> <incf n i>>>

Hmm, trees are powerful, no matter how they are expressed huh?

What if we can represent the same trees using colons and commas as delimiters?

:defun foo:n, :lambda:i, :incf n i.

Maybe spice it up a bit using periods as recursive closing delimiter.

See? still powerful trees!

Between common lisp and colon lisp, I still use the latter.

Love is blindness.

(defun foo (n) (lambda (i) (incf n i)))

def foo(n): lambda i: n += i

Give me two powerful languages with the same features and I'll pick the latter for its syntax.

So no, lisp may be the best right now, but it won't be the best forever, its syntax is its best friend and worst enemy.

Something lispers will never understand. Love is blindness.

"how many fingers do I have? 5 - 1 = 4. Oops."

Upper-Lower+1, easy. Whenever the lower is 1, just the upper is enough.

In your case you go from 0 to 4, how's that different from how many fingers you have? 4-0=4 Oops.

Don't try your cheap tricks on me.

We go from 1 to 5, so the math would be 5-1 +1

You go from 0 to 4, the math would be the same, 4-0 +1

Using 5 as your upper bound, then starting from 0 to 4 is the same as me using 6 as my upper bound then going from 1 to 5.

"I am starting to think Dijkstra is about the worst thing ever happening to software development."

"0 based for spatial coordinates, 1 based for lists and character positions."

Sums up my thoughts pretty well.

The real reason we do zero-based counting in computers is because of bits, speed and laziness.

No, your language limitations don't have to force the rest of the world to accept them.

As I alreay said, some languages use the simpler construct:

For i=1 to N

And C could easily use:

for(i=1;i==n;i++)

just by changing the way the loop condition works.

So as you say, it is all about the language.

"We could still achieve the same effect if we started indexing at 1, but it would require more code, and it would be less clear."

Really?

How about dealing with strings?

"123456789" how many chars we have? 9

char[1] = 1

char[2] = 2

:

char[9] = 9

Now, let's try the C approach:

"123456789"

char[0] = 1

char[1] = 2

:

char[8] = 9

where is char "1"? at zero index!

how many elements we have?

last index plus one!

see? there is already confusion in place, or as you say, more code and less clear...

"keeping the lower bound within the natural numbers; having the upper bound be the number of elements in the preceding sequence, etc."

Read your post and understand the same can be said of using one-based indexing.

Look at your hand and start counting your fingers while naming them:

[1] thumb

[2] index

[3] middle

[4] ring

[5] pinkie

so we have a simple range [1..5]

which can be represented in so many ways in computer programs:

for i=1 to 5 print finger[i]

for(i in [1..5]) print finger[i]

my first finger[1] is my thumb

my last finger[5] is my pinkie

how many fingers we have? as many as the last index in the list: 5

-

now, C programmers like to count this way:

for(i=0;i<5;i++) print finger[i]

where finger[0] is thumb

and finger[4] is pinkie

how many fingers we have?

as many as the last index in the list plus one: 4+1

how human-like!

And that's why you get so messy when trying to get the string position of a substring:

if(pos>-1) exists, since pos=0 means the substring is in the starting position

again, how human-like!

But how dare I argue with C programmers without being burned at the stake?

I don't care if computers think in 0s and 1s or if arrays should start at 0 because it is the way computers think.

Computers were made to serve us and as such they should translate all their inner thoughts to more human consumable data.

Five is 5, not 101.

So no, numbering should start at ONE, even if most programmers have already been hardwired to start counting from zero.

When I was younger I used to wake up at 4pm and code till early 6am, pure zen.

Now that I am older I try to go to bed the same day I wake up.

The older I get the earlier I want to wake up, the less I want to sleep.

Having a chat frame in your web page is really easy if you use WebSockets and can run a simple chat engine on your server (some hosting services don't allow sockets at all)

Since WebSocket is not available everywhere yet, use a Flash interface (pure actionscript, no visuals) with the same methods: onopen, onsend, onreceive, onclose, to communicate with the server. So when WebSockets is available all you have to do is replace the flash object with the real stuff.

  mychat = new WebSocket(chatserverurl);
  mychat.send("Hello");
  mychat.send("Can you hear me?");
  mychat.send("Am I getting through to you");
Don't get confused, the chat client is pure html, not flash, and can be easily spiced up with some jquery effects.

Personally I think we should stop SETI on its tracks.

If we find intelligent life in the universe (we let them find us) chances are they will come, if they are more advanced than us, and exterminate us for their consumption.

As we would do if we found inferior species in the universe.

If we find monkeys on mars, rest assured we will use them for experiments and take everything they have for our use.

So, if I were a monkey on mars I wouldn't be flashing that light to us in this very moment.

We are attacking the messenger when we should be attacking the problem.

Forget the messenger for a moment, if he is good or not for funding, if he has writing problems, or if he is dumb or retard.

Lets focus on the problem please, can we provide solutions?

Even solutions on how to fix proposed solutions that don't work?

"Start with e=mc2. This has been accurately measured as true."

By whom? If tachyons were the new measure for fastest thing in the universe I guarantee you that the minimum difference between the old equation and the new one would make no noticeable difference.

"People always talk about how things get heavier when they go faster"

Who says so and who has proved that? You may get heavier by adding gravitron collisions to your particles, and that doesn't mean it is a law.

"As you go faster, you have more energy. Since you have more energy you are heavier."

I didn´t know energy had weight, but again, it may be explainable.

"You find that as you get closer to c your mass goes to infinity."

Unproven. Photons travel at the speed of light and they don't have mass.

"This is probably not enough to convince you"

Nop.

"The light always moved at the same speed."

Who say so? What if light has different speeds based on huge gravitational forces? Nothing to do with the curvature of spacetime (which I call bullshit) but with the perception of the observer.

"Start with that assumption, and create rational formulas to explain how that could work."

If your assumptions are wrong your formulas will also be wrong.

"A clear explanation that anyone can understand."

It is not that I don't understand it, it is just that I don't accept it as truth.

"The final question is, ok you can't send matter faster than light"

I am not talking about matter, it may well be a limit for matter, but how about other forms of known and unknown energy or radiation?

Relativism is ok regarding the observer and using light as a measurement unit. But just throwing a huge number c2 in a formula doesn't make it right, just the same as throwing another t2 (speed of tachyons squared) would make it right either.

Here is my formula: E=mt2

My question stands: why the speed of light squared?

I usually don't partition my linux drives, but on windows it's a different story.

I recommend you to at least have it partitioned in three.

One for windows C:, one for your data D:, one for linux E:

As soon as you install windows, reassign "MyDocuments" to D:

Whenever you have a windows crash, you just reinstall and keep your data safe. You could also boot from linux and try some repairs or backups.

I've done that for every family member and friend, and couldn't be happier everytime I get "that" call.

No matter how many times I wear that "I won't fix your computer" t-shirt, I always get the call.

"young theorists should just try and work on speculative ideas"

We need them, thousands of them, 999 can be wrong but just one right would be enough.