Better HN
topnewbestaskshowjobs
Log inSign up

tailrecursion

346 karma · joined Apr 3, 2009 (17y ago) · 154 submissions

Submissions

comment 12y ago · link · parent

I'm thinking of a system with valueset inference where valuesets are not necessarily disjoint. So the system may infer that a return value is the disjunction {INTEGER | REAL}.

In order to get precision in checking, a lot of computation needs to be done so the compiler relaxes the precision when facing large disjunctions (networks) of constraints.

Dynamic checks are inserted as necessary but a system that relaxes when things get hairy can't guarantee that it will find all errors at compile time.

The idea is similar to Soft Typing of Cartwright and others, but they were thinking of an interactive system, some kind of programmer's aid. If I recall they ran into problems giving reasonable error messages.

comment 12y ago · link · parent

I want to question the importance of soundness in type systems. Suppose you could catch 99% of type-based errors instead of 100%, and in addition, use a compiler switch to see all the case statements where a class of a type is missing. The intended benefit of this system is that it accepts all correct programs. Correct meaning, the program runs and returns the correct answer.

Would such a language be viable? Or is it absolutely necessary to catch all possible type errors. In the past, tools like lint have been considered useful, although lint is not at all the kind of type system that I envision, namely a system that is in practice catching all the errors that ML catches -- it just doesn't (and cannot) guarantee it catches them.

The restrictive nature of static type systems today is legendary, but I wonder sometimes whether people realize how restrictive they are. If you can't make your idea work with functors or typeclasses, chances are good there's no way to get it to compile and you have to write functions in longhand.

comment 12y ago · link · parent

Kazinator's comment struck me as a lucid definition. APIs and ADTs let the thing's behavior define the thing, and subtyping and substitutability emerge from thinking about generic operators defined on more than one kind of datum.

My bet is even Smalltalk programmers don't think of eggs as knowing how to scramble themselves; but eggs do have an API, a behavior, that makes them distinct from other kinds of objects and at the same time shares characteristics with other objects, such as weight and dimensions.

I can assemble a list of eggs, elephants, and cars, and write "take the sum of the weights of all the objects". Although these objects are of different kind, they share a common characteristic that would be exploited naturally by any language user. Exploiting multiple "views of a thing" is a feature of English ("natural language") and to my mind is a feature of any successful "generic programming" computer language.

Processes communicating by asynchronous message passing is a better simulation of the familiar world; but that vision is not realized by Smalltalk, wherein messages are passed synchronously. What we want from language is the ability to write powerful sentences and have them mean something to the machine -- as long as the computer and human agree on the meaning. The better part of this power comes from a sophisticated treatment of type and generic operators.

comment 12y ago · link · parent

As rants go this one is good because it identifies some language features and misfeatures that are important, such as type system complexity. But Will Yager's recent article was much better: partly because it was not a rant, and partly because it succinctly covered all the bases.

We've reached a point in time where there is a wider consensus regarding the importance of stateless programming, option types, code re-use, and the productive people are not complaining anymore and instead are doing something about it. There are many new or recent PL projects ongoing, where people are designing new languages.

In the mean time, for those people who roll their eyes at missing GUIs or support for email addresses -- it seems to me they've identified an opportunity.

There is a rich set of choices out there and the hard thing (for people who aren't designing their own language) is shopping. Those people who can make effective decisions and exercise good judgement are going to have an advantage, whereas other people who expect others to deliver popular platforms into their hands for free, will remain below average.

comment 12y ago · link · parent

I think if you're going to make a strong criticism of a complete design and implementation that includes decisions that were almost certainly made deliberately, then you owe an explanation or some kind of argument.

My position is that it's the language's job to allow expression of ideas and not its job to police or disallow bad sentences. I think such a thing [EDIT: disallowing bad sentences] is impossible and leads to COBOL-like languages. (Compilers can have options for coding standards, like "house rules" but I don't think it's the language's role.)

comment 12y ago · link · parent

In the 60s, operating systems were designed in a world where the person running the program was the same as the person who wrote the program. Today many of the security or privacy schemes start by making a distinction between the programmer and the user.

Besides sharing or "abstracting" the pieces of hardware that the app wants to control -- as VMWare or a hypervisor might do -- the operating system has one additional important role, which is to function as an agent for the user.

The apps, written by various persons, are running on a computer that belongs to the user. The operating system keeps control of the computer -- the user's computer -- in the user's hands, and keeps it from being "taken over" by the apps.

This role or function of the operating system can certainly be subsumed by a programming language / environment like Smalltalk or Java, but the idea of an operating system has a purpose that directly reflects the different interests, goals, or priorities of distinct entities interacting inside the machine.

Usually the master control program is seen as being against the users, but I'm casting it as a good guy. I think that the promise of the operating system is that it can be a good guy (for the user), even if real examples tend to fail at that job.

comment 12y ago · link · parent

My understanding is there are a number of things that have to be right. In addition to rigidity and precision of the machine itself (bushing quality, rod runout), the speed, layer height, temperature, and filament regularity are all important to quality. There are other software settings that impact quality as well. Bed leveling in a machine that doesn't have software auto-level is another big one.

If you know the stepper motor specs you can calculate the resolution. Most motors are 1.8 degrees per step and most controllers use 16 micro steps. If the GT2 pulley is 10 mm diameter, that gives 0.01 mm per micro-step.

If the machine is not rigid and precise then you won't get full capability but 0.01 mm is very good and may be more than needed given the capabilities of the plastic, and the layering process.

comment 12y ago · link · parent

I recently read up quite a bit on FDM robots, and in my opinion it would be a shame to pass up the opportunity to build a robot yourself, and even design one yourself. The cartesian machines are more or less variations on a theme, and most use the same set of standard parts: nema 17 motors, acme screw shaft, linear rods, linear bearings, 608 bearings, and GT2 pulleys and belts.

Check out Misumi's catalog, and you can always roll the dice on shady-Chinese-company knock-offs (Robotdigg). Look up aluminum t extrusions for framing, or use sheet or square tube. Or buy a frame from tens of vendors who sell kits and parts for the Prusa Mendel. I don't like the swing-set Prusa, and I don't like threaded rods. But there's also the fine Makergear M2 for inspiration.

Electronics and software are also commoditized.

Good kits if you don't want to design your own:

Printrbot Simple Metal Rigidbot (I don't know if they are using the best parts) many other quality kits

Interesting robots:

Reprap Wally, designed by Dennis Brown & Nick Seward.

3d printers are one area where it is the Wild West, you can go as deep as you want in one week, and learn almost everything except software details. All the hardware is nearly standardized, and right out there to look at and study.

comment 12y ago · link · parent

If the scandals described in this article and Taibi's articles are the result of a few bad actors, and if the result of these scandals is a broad perception on the part of the public that the entire financial sector is corrupt, then Goldman Sachs should be interested in policing its own.

I wonder if G.S. feels unable to police itself, or maybe they feel the aluminum story is not a problem, or that what they did was harmless. I don't know what they think about what they do. I can't really blame below average people for cheating -- they're not good enough to win playing by the same rules as everyone else.

But if I'm to draw a circle around the corrupt people should I draw it around a piece of G.S., or around the whole company. It seems like the scandals keep happening, and that market manipulation such as laddering and hoarding are considered by the financial industry as another way to make money.

If the financial industry isn't greased entirely on deception, then I'd like to know what percentage is deceptive and what percentage is figuring out a hedge plan for e.g. BMW's exchange rate risk. I can see how billions can be made one way, but I don't see how billions can be made the other way.

comment 13y ago · link · parent

I think a large part of making better coffee is a matter of iteration, or trial and error. If you do something and it tastes better, you keep doing it. But you're never sure if there's some patch of the search space that you missed, that's even better.

If anyone wants to make splendid coffee, and doesn't fear learning a significant new art I'd suggest roasting your own beans. You can do it with a heat gun or an air corn popper, modified. It's not simple and it's a bit of a fire hazard, but you can get satisfying results blasting some hot air at beans in a pot. Roasting can be more fun and aromatic than making coffee. It is amazing.

For a brewer you could get a sock pot aka woodneck (or just the sock without the pot -- or just muslin cloth if you want to make your own); or, a ceramic cilio-freiling cone, or an inexpensive melitta plastic cone. Both sock & cone are considered pour over methods but they taste different.

For a grinder there are too many choices to pick just one, and the good ones are expensive. For the grinder it may be safer to avoid mass-market products, just because it's too easy to make a mistake and buy an inadequate product.

[Edit: there is another effective trick to get better at brewing. Coffee brewing competitions. It is surprising how effective these are at improving the art. Watching videos of what the contestants are doing is one important tool for improvement.]

comment 13y ago · link · parent

I agree. Apple has used the geometry of the device to assist more with cooling, and shares the heat sink among components, and uses one large slow fan. This kind of thing really pushes my buttons.

It's 10" high, which is unexpectedly compact. It seems like the designers have chosen a shape to maximize use of space. I'm sure it isn't the only way to go but it's a wonderful next step.

Again Apple has shown us what we want when we thought we just wanted "more".

comment 13y ago · link · parent

twbrownaw is exactly right. If the private key is already in a secure location then there is no need to move it to a secure location. So, any report that the public keys were stored with the private keys means nothing by itself.

comment 13y ago · link · parent

Without being surprised I'm a little curious about the statement that the game required access to the server, in order to run. I'm curious how statements like that get made, because it seems like it's just a matter of time before the truth -- which is that the game didn't require a server -- is discovered.

The letter that Engtech linked to puts the responsibility where it ultimately needs to rest. The PR folks are letting the other parts of the company down, and if that's because of hiring mistakes or because the culture doesn't do an effective job reminding PR critters not to lie too much, either way it's the executives who made a mistake.

Electronic Arts has become a hated entity, just hated, and part of that I think comes from the controversy-making of the news machine. But part of it comes from nearly unexplainable statements, by people who I guess just learned the wrong life lessons, people who are clearly hiring mistakes.

comment 14y ago · link · parent

Part of the reason it comes up frequently is that a large number of educated, experienced programmers have decided that a toolbox without OOP is a better toolbox, than a toolbox with OOP.

But, it is difficult to throw out a bad tool when there appears to be no alternative that delivers its benefits. When that happens, when a tool is devised that delivers what OOP delivers without the problems -- such as the diamond problem, or the problem of having to decide "where" to put functions, or the problem of generic functions of more than one argument -- then at that time those very problems will become much easier for everyone to acknowledge.

The same thing will happen to classes and synchronous message passing, that happened to inheritance. In that case it took a while but an alternative came in the form of interface subtyping or predicate based subtyping, and then it was easy to see that inheritance was more trouble than it was worth.

comment 14y ago · link · parent

It is straightforward to convert stack instructions to 3-address instructions, by keeping a counter -- a stack pointer -- that points into the register file. As instructions are decoded the stack pointer is read and the current reading is delivered on down the pipeline with the instruction itself.

From there on, the cpu is executing an instruction that calls out explicit register numbers. The stack counter is kept with the decoder at the very start of the pipeline. This "register number decoder" needs to run sequentially, and it needs to run a faster cycle time than the rest of the cpu.

comment 14y ago · link · parent

It's great to see people using Chuck's work, and in particular it's wonderful to see your reaction. I think it would be easy to recoil at the strange tools, not to mention the difficulty of programming the thing. I agree it's a fascinating device.

comment 14y ago · link · parent

Are you able to boot all the cores and get them functional? I like the design of these chips too, especially how each core "blocks" on its message queue by instantly going to sleep, taking zero power -- and then instantly wakes up the moment a message appears.

comment 14y ago · link · parent

It would have been better if I had specified absolute values in the formula. I hope the point came through. (It appears I'm unable to edit this particular comment.)

comment 14y ago · link · parent

If we're on embedded hardware, or can't use floats for some reason, we use 22/7. It's called fixed point arithmetic. Most CPUs have an integer instruction that multiplies into a double-precision integer result, and an instruction that takes a double-precision integer dividend.

So to scale by pi, we multiply by 355, then divide by 113.

comment 14y ago · link · parent

Yes, Jon's metric for measuring the value of an approximation is wrong and so is his conclusion.

comment 14y ago · link · parent

Yes that was my mistake. Sorry about that. It must happen because of the byline above the box where one types in the top-level comment. Thanks for mentioning that it's a frequent error, that makes me feel better.

comment 14y ago · link · parent

22/7 is a better approximation of pi than 3.14 because 22/7 is closer to pi than 3.14. The hypothesis of the article is wrong.

I believe Colin [EDIT: I meant Jon McLoone, the author of the article. Sorry Colin!] is counting only full digit matches. It is this metric that is useless.

comment 14y ago · link · parent

(pi - 22/7) < (pi - 3.14). 22/7 is closer to pi than 3.14.

comment 14y ago · link · parent

This article introduces concatenative langauges, but it doesn't explain why they matter.

In my work, I found that the lack of syntactic marking for arguments of function calls is a devastating drawback. Coming back to my own function definitions a week after writing them, I spent minutes unpuzzling the code. I could use every trick and write the function in the most elegant way, using combinators in the style of Factor, and that made it worse. But writing it out with local bindings also didn't help. As soon as you write a nested expression, you start to lose the sense of which values are being passed where.

gcd n1 n2 n2 0 = if n1 else n2 n1 n2 mod gcd

gcd zero if else "mod" plus swap gcd

factorial 1 interval product

I was designing a Forth-like functional language with generic functions, and for a long time I felt that the lack of markings didn't matter. I thought that one could understand the code "well enough" without knowing exactly where the arguments were going. There is something to this argument, and there's a lot we can do to make code say what it does. But sometimes the author just had to implement something, and technicalities arose, and when you go to read it, the code doesn't "read" and you have to bring your own intelligence to figure out what it does -- it won't tell you. In these cases, explicit argument marking is indispensable.

In Forth-like languages, simple things are wonderful and elegant. There is no other shorter way to write than point-free. And, writing with combinators is satisfying, and it can make the "essence of the function" more evident. But unless you severely constrain your style to ultra short definitions, avoid nested expressions, and use local variables profusely, you're constructing puzzles for yourself.

It's almost like the concatenative style is too optimal. You have to back up a step in beauty in order to get a practical tool.

comment 15y ago · link · parent

Thanks, I'll take a look. "Crowdfunding" was the word I was looking for.

146.

Ask HN: Exploiting the "group buy" to finance new products

1 points · by tailrecursion · 15y ago · 2 comments

comment 15y ago · link · parent

What's happened here is that Sony has discovered a previously undetected attack that occurred in April. So this second attack is not as new as one might think.

comment 16y ago · link · parent

The article claims a 70% fuel efficiency increase, and another quoted part claims a 70% reduction in fuel use. Which is it?

comment 16y ago · link · parent

Game consoles have been successful so far with closed systems, and they've learned over the years how to improve their security, a key one being forced firmware updates.

comment 16y ago · link · parent

I don't know how WoW phrases it, but the promise "buy a subscription and get one month free" is not the same in the mind of the customer as the promise "free one-month trial". The first gives a more accurate description of what will happen to your credit card.
123456