472 karma · joined Sep 17, 2014 (12y ago) · 223 submissions
comment 10y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
I admire Redis for its performance and simplicity of setup, but if there is one thing that Redis does not have is a coherent API.
Whenever I use Redis, I absolutely need the command cheatsheet, as it seems that every command works differently. There is no commonality in data structures. The whole thing seems more dictated by the underlying implementation than the desire of providing a simple API.
For instance, why LPUSH accepts multiple parameters but LPUSHX does not? Why there is even hyperloglog in a database? Where did the need for RPUSHLPOP come from? Why the options for SCRIPT DEBUG are YES, SYNC and NO?
I don't want to be too negative. I appreciate the great work that has been done on Redis, but I feel it really needs to rethink the whole API layer.
comment 10y ago · link · parent
For such cases, you can either manually allocate the pointers you pass to c, or temporarily disable the gc. Each thread has its own heap, so gc for one thread does not break anything in other threads
comment 10y ago · link · parent
You can manually allocate memory if you want, and you can also pass pointers, either to manually allocated or gc memory. The gc will not run when c is working, since it is triggered by allocation
comment 10y ago · link · parent
It has static types and is fast. The libraries for scientific computing are not there yet, but it lends very nicely to mathematical abstraction.
comment 10y ago · link · parent
For some reason, OPAM defaults to installing dependencies globally and does not provide an easy way to support different workflows
comment 10y ago · link · parent
comment 10y ago · link · parent
Anyway, I don't remember exactly all the articles I tried, but two of them were
https://www.cs.princeton.edu/~chazelle/pubs/mst.pdf https://www.cs.ubc.ca/~condon/papers/chungcondon96.pdf
while one news that failed to parse was
http://www.repubblica.it/economia/2016/02/09/news/borse_9_fe...
I tried other articles and news, but I do not recall each of them exactly
comment 10y ago · link · parent
Tika is able to parse them without a glitch, and has been doing so for a few years at least.
So I tried with some sample HTML taken from the main italian news sites. In this cases, it parsed it, but returned some garbage HTML tags and no content. BoilerPipe or similar libraries are able to extract a clean body of the news in all cases.
How is that state of the art technology?
comment 10y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
You cannot apply directly any of the size-aware functions, because it will not typecheck. I only see two avenues:
Either you assert statically that the vector has some concrete size, in which case the size is known statically and the code generation will work as well;
Or you use some other size-unaware function, in which case it is false that Idris can use runtime values as type parameters.
If I understand correctly, you are saying that there is a third possibility, but I am missing it
comment 10y ago · link · parent
I would be curious to see an Idris program that reads two vectors out of some file (without knowing the size a priori) and concatenates them
comment 10y ago · link · parent
Languages that have generics can either erase the generic argument at runtime (like Java or Scala do) or generate a different concrete type for each instantiation (like C++ or Nim do). In either case, you usually know at compile time which concrete instances of the generic parameter are going to be used where.
That is, even in Java you may have a single class Stack<A>, but at the final use site this will eventually turn into some concrete type, such as Stack<String> (it may remain generic in intermediate steps). In other words, you are not going to use Stack with a generic parameter that you did not anticipate. You cannot read the runtime type of some instance, call it X, and then start writing functions that work on Stack<X>.
Now, let me turn to dependent types. A lot of the techniques that Idris promotes can be simulated in other languages, such as Scala, C++ or Nim. But in each case that I know of, you are required to know at compile time which concrete values you are going to use as generic parameters. That is, in C++ you can write functions that operate on types like Vector<A, N>, where N is the length, but you have to eventually specialize N to a concrete number before compiling.
The comment above states that Idris does not have this restriction, but it is not clear to me how that might work. I concede that by using an erasing technique (as opposed to specialization) one is not required to materialize such functions for all N - this is what one does for instance in Scala.
But the problem is: what do you do at the usage site? Say you are reading two lists off two JSON files, and you want to concatenate them using the above function. Wouldn't you need to provide at compile time a concrete value for N and M? (and consequently cast the unsized vectors to sized ones?).
If this is the case, then there is not much difference from letting the compiler materialize a function for concrete values of M and N that are used (because in either case, you have to encode knowledge about concrete values of M and N at compile time).
Maybe everything would be more concrete if I saw an Idris program that reads two vectors from external files at runtime, and then concatenates them, whatever their size is.