Tag Info

New answers tagged

1

I think you're literally asking us to describe how you should think as a developer. Unfortunately that's going to be a rather large topic. However, since I like big philosophical questions, I'll throw a few pointers out there. These don't answer your question, but point you in some directions to explore. Stop talking about code when you're thinking at ...


0

I agree with gnat, the question is very broad. It is hard to get back to good style if you learned with bad style, it may be boring but maybe start with going through a basics class. You can try going through double speed. There are plenty of video classes you can get access to online.(I would suggest one but you didn't specify much about what you program ...


0

Since you are building a language on top of the .NET runtime I think what you want to do is distribute a DLL that will initialize the wanted structures/environment, then call an entry point in that DLL in your compiler-generated MSIL code, before you execute the main() function (or however your programming language finds its entry point) of the user's ...


1

Option 1 While it is tempting to have a set of lightweight APIs that send the normalized data, there are some potential pitfalls with this approach. First, the lightness of these APIs might end up being paid for with tight coupling between your normalized data model and your APIs. If you want to change your data model or APIs, you will have to change the ...


0

In the core runtime library, which you will distribute with your compiler. Your question is a bit abstract, which I think has misled others in how they've tried to answer. I shall assume your language has a domain of interest, and there are some core objects (base classes, perhaps) which are critical for the language. If your language was for writing games ...


0

A couple of notes: Never deserialize untrusted YAML. In most YAML parsers this allows arbitrary code execution. In SnakeYAML, you can prevent this, but you need to be very careful, and the risk seems unnecessary. Since you just need a key-value store I would recommend JSON instead, which brings me to: Use strings as keys, and convert from ...


0

Starting from your link Skip-Deltas in Subversion I read through this note Notes on keeping version histories of files and there it's written: The author does not know of papers or other references describing the technique [skip deltas]. .. This document was written by Greg Hudson on 2002-06-24. It was last updated on 2002-10-03. So my guess is ...


2

Not all data types in Haskell are trees. There are also the builtin types like functions or Int. Among those you find the type Array which gives you O(1) access to its elements. Some compilers, like GHC, also provide unboxed arrays. Those use less memory and per element access is faster, but that does not change the complexity of course. On top of those ...


1

Both nested and combined keys have their places. bowmore gives a pro argument for composite keys, and a con argument for nested maps. Let me provide the loyal opposition: Composite map keys work great when you're looking up a specific known item. Nested maps work well when you need to rapidly find all the variations, kinds, and subtypes of type A. For ...


2

Avoid nested Maps. They're harder to scale and lead to code that is very verbose and hard to read with all the nested generics declarations going on. More importantly, Maps in Java tend to consume a lot of memory. Populating a Map with even more Maps will only aggravate the memory consumption issue. Lastly, a Map that uses composite keys is easier to ...


6

It's perfectly safe to do it this way, especially since, as Doval pointed out, all the instances of Show and Read that you're using are in the standard library, and are thus guaranteed to cooperate with each other without any difficulty. However, it's not the generally recommended way to do it, simply because saving to human-readable (and Haskell-readable) ...


1

I haven't tried it, but all signs point to "yes", as long as you use the derived instances. The Prelude has this to say about Show: Derived instances of Show have the following properties, which are compatible with derived instances of Read: The result of show is a syntactically correct Haskell expression containing only constants, given the ...


0

Both options are not good in my opinion. Say what if the business logic changes again so that you have another subtype? What I suggest you do is the following: Use a surrogate key for a table call Type this table would look like Type(INT auto_inc id, VARCHAR(255) name, VARCHAR(255) desc, INT status, etc) In your Price table use foreign key to the Type ...


0

See also the ABI specification and the calling conventions for your target platform. For x86-64/Linux, read the x86-64 ABI supplement (see also the x86 calling conventions wikipage). Several aspects of <stdarg.h> are built in the GCC compiler (e.g. thru __builtin_va_start, __builtin_va_arg, etc...) and <stdarg.h> is provided by the compiler. ...


2

The answer to your question is here: http://stackoverflow.com/questions/4958384/what-is-the-format-of-the-x86-64-va-list-structure The va_list type is an array containing a single element of one structure containing the necessary information to implement the va_arg macro. The C definition of va_list type is given in figure below typedef struct { ...


0

You should look at Data.Vector.Unboxed and Data.Vector.Mutable in the vector package: https://hackage.haskell.org/package/vector


0

The implementation you reference is part of a package for implementing a concurrent B-Tree. The HashTable itself is implemented as an array of TVars of Data.Map objects. The quoted complexity values are worst-case. Remember that hashtables are usually O(N) worst case for lookup, insertion, and deletion. Using Map for the buckets brings it down to O(log(N)). ...


-1

I'm going to go out on a limb here so bear with me... This is NOT a Haskel specific answer, but it is an alternative way of approaching the problem, and one that I do happen to know works exceptionally well in other languages as I've personally used it. The portable database "SQLite" unknown to many, has an exceptionally useful in memory database mode. ...



Top 50 recent answers are included