Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Your comment seems confused in exactly the same way as coldtea's. How are you imagining turning input 20 into output 6 without acting on the input?

If you don't act on the input, you have an identity function, not a constant function. Constant functions must alter their input whenever it doesn't match the constant output. Nobody ever complained that the problem with Procrustes was that he didn't do anything to the guests in his bed.

And in the other direction, I don't understand why you want to characterize "multiply the input by zero" as an action that "doesn't do anything"? In what sense would that be true?



>Your comment seems confused in exactly the same way as coldtea's. How are you imagining turning input 20 into output 6 without acting on the input?

Easily:

f(x) = 20

No action on the input -- discarding the input is not an intuitive action for a 6-year old that just got a handful of of ax+k and xk + n style examples.

>Nobody ever complained that the problem with Procrustes was that he didn't do anything to the guests in his bed.*

You seem confused. Procrustes operated on his guests, which is neither the identity (they would come of unscratched) or the constant function (in which the same person or thing would emerge out of the bed).

Their height in the end was the same, but that's not the argument to the Procrustes function -- their overall body was.

>And in the other direction, I don't understand why you want to characterize "multiply the input by zero" as an action that "doesn't do anything"? In what sense would that be true?

Obviously in the intuitive sense for a 6-year old -- which is what we're discussing, and which was based on some operation on the argument that resulted in a different value each time, not degenerate versions of functions like the identity, constant, 0, etc.

(That said, it "doesn't do anything to the input" in the sense that it's not dependent on the particular input. 2x gives you 4 and 10 if you pass 2 and 5. 0x gives you 0 whatever you pass it, so could just as well be a constant fx = 0).


> f(x) = 6

Fixed, for the sake of corresponding more exactly with the challenge. Not that it wasn't clear what you meant :)


Yep, that!


A constant function doesn't act on its input. `f(x) = 6` doesn't perform a different action on each input. But given your comparison to `f(x) = 0*x + 6`, let's move away from numbers and consider a different function. `f'` which I'll define as:

    const :: a -> b -> a
    const a _ = a
    
    f' :: a -> ()
    f' = const ()
Now I can give `f'` anything at all. Can you try to explain the action of `f'` in any way but that it ignores its argument?


Functions don't alter anything. 20 is still 20 even after you evaluate f(20) to be 6.


That's where linear logic differs, if you will. The highest voted comment in this sub-thread already alluded to that.


I'm a big fan of linear typing but I think of it as more like "consuming" the input than "changing" it.




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

Search: