Reputation
615
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
4 20
Newest
 Yearling
Impact
~9k people reached

  • 0 posts edited
  • 1 helpful flag
  • 160 votes cast
Dec
30
comment How to generalize the planar case of the closest pair problem to d dimensions?
I see. I know that I have to do c * n operations but when I implement it I have to know how many points should I scan for each p point within the δ distance of the median l line in d dimensions. I know that it is 6 for 2 dimensions but how do I know how much c is for d dimensions?
Dec
29
comment How to generalize the planar case of the closest pair problem to d dimensions?
So what you are trying to say is that basically I only need to change this part: "One simply has to replace 6 * n distance calculations by c * n distance calculations, where c is the maximum number of points which fit into a d-dimensional box of size (dist, 2*dist, 2*dist, ..., 2*dist), when the shortest distance between the points is dist at minimum."?
Nov
25
comment What is the purpose of wrapped values in Haskell?
I've read up on Higher Kinded Types. So basically using them I can get rid of the excessive call to isPresent for example since the use case of Nothing is already handled in the typeclass definition which can be in fact a monad?
Nov
24
comment What is the purpose of wrapped values in Haskell?
I think I get what you are trying to say. So the difference to say a java decorator is that this is a more abstract decorator where I get an Object and I can do whatever I want with that Object which can be even a FunctionalInterface or such.
Nov
24
comment What is the purpose of wrapped values in Haskell?
So what is the difference between a monad and a decorator then?
Nov
24
comment What is the purpose of wrapped values in Haskell?
What you describe has some resemblance to python decorators or the decorator pattern in java but this seems more elegant to me since the Nothing is implicitly checked and no boilerplate is needed. Right?
Aug
11
comment When is it justifiable to use pair programming and when is it not?
This is not a duplicate as @Jules pointed out. Voting to reopen.
Aug
11
comment How can you achieve and maintain flow while pair programming?
-1 this does not answer the question.
Feb
21
comment Recursion without factorial, Fibonacci numbers etc
This is a good idea. I'll use it as well in the future.
Nov
15
comment What's up with the Class::get(id) idiom in PHP
I am faced with these kind of objects in java at the moment and I can tell that they are horrible and nearly impossible to test properly.
Nov
13
comment Which is the most practical way to add functionality to this piece of code?
I am not the user so I can't tell what an user will use. This is just a library.
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
Oh I see. In java you can't be typesafe with a Map<DataType, AnyObject<?>> since even if you make a wrapper (AnyObject) for the value you have to supply a type parameter for it which is lost after compiling so a Map<DataType, Object> with typecasting makes more sense.
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
No, I can understand it now but I still don't see how that will help me. Every Hexagon can contain a different value for all of those facets. BTW that downvote is not by me.
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
If you want to use functionality tied to an id you have to get the code anyway (like the class which implements shortest path search) so using ids will just make code unreadable. In this sense an enum is almost the same but more readable and less error-prone. I don't see why an enum would prevent extension.
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
This approach looks good, +1! The proposed structure needs some polishing though since it is a work of an enum: enum DataType { TRANSPARENT, PASSABLE, PASSAGE_COST, SATELLITE_DATA} and the whole thing can be used in a map: Map<DataType, Object> data;
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
Sorry, but I don't understand how it works from the example. Where does the incrementCost method go? where does the constant TRANSPARENT go? what is a sealed class? Why should get/setData should be private?
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
I don't want the user to have to extend a class since he may have one which is already extending something.
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
You don't get the point.
Nov
12
comment Which is the most practical way to add functionality to this piece of code?
This is the Rule of the Three, right? I in fact already have a demo application but your answer looks like you think this is a Catch 22: I can't write an interface while there are no applications and I can't write applications while there is no interface. So there should be one interface for a start.
Aug
31
comment Does macros support make Scala a Lisp dialect?
I think you still live in the last century.