Become a fan of Slashdot on Facebook


Forgot your password?
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 Internet speed test! ×

Comment Re:I like functions... (Score 1) 374

So you were treating (**) as the free variable? That works, provided the operator actually appears as a function argument or local variable in an enclosing function context. References to global definitions do not create closures in Python. (The value of a global variable or function definition is looked up at each call, not captured as part of the lambda.) However, in that case you can't really refer to (**2) as "the squaring function" since (**) could do anything, not just exponentiation.

Comment Re:It has its uses (Score 1) 374

... we'll keep rolling our eyes and ignoring you.

It's your loss. BTW, the mathematical definition of a "function" as a fixed mapping from objects in the domain to objects in the range has been around a whole lot longer than the (mis)use of the term to describe procedures or subroutines in (some) programming languages. The idea that "state" implies mutation is commonplace even within the more mainstream areas of the computer programming industry, not just among functional programmers.

Comment Re:I like functions... (Score 1) 374

** is a function of two variables. The 2 is coming from a different context. **2, as a squaring function is a closure.

(**2) is a Haskell-style "operator section" which would be shorthand for "lambda x: x**2" in Python. This lambda has no free variables and thus is not a closure. An example of a closure would be the second lambda in "lambda x: lambda y: x**y", which closes over the free variable "x". You can also do this without lambdas:

def pow(x):
____def curried(y): return x**y
____return curried

# returns closure of lambda y: x**y, capturing x=2
f = pow(2)

# returns 2**4

(Pretend the underscores are spaces.) The important part is that the function you are capturing includes references to free variables inherited from its original context.

Comment Re:It has its uses (Score 2) 374

There's no real difference between a lambda and an object full of state, beyond the syntax. Lambdas capture arbitrary state.

When functional programmers talk about state they're referring to mutable state. What you are describing is simply data. Capturing immutable data provided through function arguments does not violate referential transparency. You still get the same result for the same arguments.

Plus, in real software, the results of some functions is often some measurement of some changing real-world thing.

That isn't a function, not in the mathematical sense. In Haskell it would be referred to as an I/O action. In functional programming objects exist which describe "impure" actions, such as sampling a sensor or printing to the console; these objects can be manipulated by pure functions, e.g. combining two actions to make a larger action, or mapping a function over the result, but are only executed (logically speaking[1]) by an impure external interpreter in the language runtime. The program itself is pure, even the parts which evaluate to IO actions—barring abuse of specific constructs like unsafePerformIO. The runtime, inevitably, is not pure, since has the responsibility of interfacing between the pure program and the real world.

[1] For performance reasons, of course, the compiler actually "inlines" the interpreter, generating impure object code similar to a traditional compiled imperative program. The external interpreter, like the C virtual machine model, is merely an aid for thinking about the code, not a concrete implementation.

Comment Re:Still a dream (Score 1) 142

... even with that benefit today, a small 2 seater piston driven aircraft will make the most obscene SUV look like a Prius efficiency wise.

Most small aircraft presently operate at 15-20 MPG, mostly because the engines are based on simple, old (and thus well-tested), fully analog designs, but it doesn't have to be that way. For example, here's a 2-seater piston-driven aircraft retrofitted with electronic ignition and fuel injection which gets better mileage than most high-efficiency cars: Hypermiling Plane Gets 45 MPG at 207 MPH. The challenge is adapting the tech improvements which have made ground vehicles so much more efficient to small aircraft without compromising safety—a fuel-injection system failure on the ground tends to be a much smaller problem than a similar failure at cruising altitude.

Comment Re:Landlords are not middle class (Score 2) 106

I made less than $50K last year. Your definition of upper class would include me, and that's ridiculous.

Time for a bit of introspection, I think.

No, the idea that someone who makes $50k per year should be considered "upper class" is indeed ridiculous, no introspection required. A person is not "upper class" just because they make their money from real estate. To be sure. deriving wealth from investment rather than from working for an employer is part of the definition, but there are other aspects to consider. For one thing, the income has to be significantly above average, which is not the case here. Historically speaking, one's family background played an even larger part than wealth in determining one's social status—a merchant might be wealthier than the average aristocrat, but would still not be considered "upper class" for the simple reason of not being born into the aristocracy.

Comment Re:How to make your Rights illegal. (Score 1) 249

So you can make a case that that falls under the promoting the general welfare clause and has federal merit.

You mean the "general welfare clause" that serves only to constrain Congress's "Power To lay and collect Taxes, Duties, Imposts and Excises"? The one that doesn't empower the government to do anything other than raising funds? That general welfare clause?

The Department of Education has nothing to do with taxes, duties, imposts, or excises, so the general welfare clause is completely irrelevant. If you want to justify its existence as a federal program you'll need to find a different enumerated power. Your best bet would probably be "To regulate Commerce ... among the several States", but only to the extent of standardizing what it means to claim a certain level of education.

Comment Re:I didn't need a smartphone for a tech accident (Score 1) 343

... but it does show that officer judgement should be a factor.

No, what it shows is that it should not be possible to be convicted of a DUI unless you were actually driving, regardless of the judgement (or lack thereof) of any officers in the vicinity. The fact that the vehicle's transmission was in Park should be an absolute defense against any accusation that you were driving under the influence. If an officer sees someone impaired in a parked vehicle and worries that they might start driving under the influence they are welcome to stick around until the person actually does start driving and only then charge them with a DUI. No one is being endangered so long as the vehicle remains stationary.

Comment Re:Mapping vs real-time (Score 1) 68

[A few months], surely, isn't enough time for rigorous testing.

The frequency of updates says little about how much testing each update received. Perhaps that latest update has been in testing for a year alongside several other versions staged for release over the next few quarters. Also, quite a bit of regression testing can be done with previously recorded sensor data before the software comes anywhere near an actual car.

Comment Re: We still have to solve the following insanely (Score 1) 198

Frankly by 2075 I think we may only be able to tackle #5 to some extent. Fusion energy, while technologically viable, is not going to happen due to the fact that politicians keep trying to pull funding. I doubt we'll be able to improve batteries or solar cells much by 2075. There is hardly any materials scientists that care about artificial muscle .. so that one's not gonna happen either.

Comment Re:America! (Score 1) 341

The whole point is to make the competition somewhat unfair. You should [show?] what someone who doesn't have a profit motive, but instead a public service motive would do.

Changing the motivation does not make the competition unfair. Granting one service provider special treatment and legal privileges not available to other providers of similar services makes the competition unfair.

A co-op is managed for by the benefit of its members/customers, not outside investors, and would thus serve just as well while maintaining a level playing field with commercial service providers. The options are not limited to investor-driven corporations and governments.

Comment Re:America! (Score 1) 341

The way you structure things like this is that the municipality ... builds out the physical infrastructure, and then you allow multiple content providers ... access to that infrastructure.... The network is very reliable, the service is extremely affordable, and there is real competition.

I can believe that there is real competition between Internet gateways, but in this scenario the city itself holds a privileged position as the provider of the infrastructure—by far the largest part of a local ISP's capital investment. The separation is beneficial, to be sure, but there is no need for the city to supply the network. Unless there is special treatment (i.e. corruption) involved, a co-op could handle that part just as well as the city can, and competition among local network providers is just as important as competition over peering and transit.

Comment Re:America! (Score 2) 341

Not at all. You create a municipal internet, and you still allow everyone else to compete with it.

Fair competition is only possible so long as the municipal ISP doesn't receive any special treatment, such as favorable regulation, access to municipal easements, tax subsidies, municipal bonds, etc. At that point, why make it part of the municipal government at all? An internet co-op could do exactly the same thing without all the conflict of interest.

Slashdot Top Deals

Intel CPUs are not defective, they just act that way. -- Henry Spencer