Better HN
topnewbestaskshowjobs
Log inSign up

pathsjs

472 karma · joined Sep 17, 2014 (12y ago) · 223 submissions

Submissions

comment 10y ago · link · parent

Except when you want to add a dependency. Then things will not look nearly that simple...

comment 10y ago · link · parent

Where do you find Esperanto inconsistent?

comment 10y ago · link · parent

Not quite. It also has a very regular grammar, handles regular composition of words (skribmaŝino, bovido, ...), regular formation of words like [nowhere, someone, whatever], simplifies the formation of verb tenses (also handling things like the future of the past which do not exist in other languages), has a choice of roots that makes it familiar for people knowing any indoeuropean language, and more

comment 10y ago · link · parent

I find docker increasingly complex and frustrating, at least for the pretty common use case of isolating dependencies for development. See vagga for an example of simplicity. There you have no daemon, no file permission conflicts, a simple way to run commands in containers and more

comment 10y ago · link · parent

I completely agree with the sentiment. And this is why such a statement made by antirez leaves me puzzled.

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

I tried it. I found no easy way to have dependencies isolated per project. Any suggestions?

comment 10y ago · link · parent

You are right, this situation is not trivial. But it is also quite rare in practice

comment 10y ago · link · parent

The situation that you describe could happen, but it is quite rare in practice. Usually, I call c functions that do their work and be done, such as BLAS.

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

Nim compiles to c, hence you can just call c functions. All you need is a signature, which can even be generated automatically from a c header.

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

You may be interested in Nim. If you can tolerate working without a REPL, Nim hits essentially all the bullet points you mentioned, from macros to coroutines, multiple dispatch, ability to call c trivially and python easily and so on.

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

Thank you!

comment 10y ago · link · parent

Is there a way to hear it in the background? Every time I switch tabs, it stops playing. Also, it sometimes mixes up songs from different periods (1958+1997)

comment 10y ago · link · parent

Python, Scala, OCaml, Nim, Haskell and more all have asynchronous operations for I/O - it's not something that is a JS only thing

comment 10y ago · link · parent

As far as I understand, this would only work if standard sequence types were defined inside a functor, which is not the case.

comment 10y ago · link · parent

I really miss the possibility of configuring dependencies per project in a easy way. OPAM will allow this using OPAM switches, but it is complex and error-prone, while most any other package manager (sbt, leiningen, maven, nimble, cargo, npm...) will do this by default.

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

It is actually annoying from a very practical point of view. You cannot, for example, write an algorithm that will work an any sequence type, and then apply it to a list. This is why, for instance, you have List.map and so on

comment 10y ago · link · parent

Ok, it may not be optimized. But this http://www.stufftoblowyourmind.com/wp-content/uploads/2009/0... is just more fun! :-)

comment 10y ago · link · parent

I just had a brief look at the tutorial, but it looks great! Kudos to the author!

comment 10y ago · link · parent

Sorry I was harsh. I tried the translation service and it work better.

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

Ok, here is a question. I went to the site and tried the document conversion service. I gave it three very clean PDF files containing CS articles. In all cases, what I got in response was "The input document failed to be converted because An invalid XML character (Unicode: 0x0) was found in the element content of the document."

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

The fact is that auto-pilot cars, as you describe them, won't be nearly as revolutionary as self-diriving cars. The latter would allow people to put to good use the time to commute to work; they would improve car-sharing to the point that people would not need a personal car and parking could become a problem of the past; they would allow you to get back home safely after some drinks; eventually people would not need to learn to drive at all. The mere augmentation of human drivers, as useful as it would be, would not change much in our habits

comment 10y ago · link · parent

I respectfully disagree. I know map, of course, yet clojure (or LISPs in general) is the only language where it is variadic. I definitely did not instantly grok what the Clojure version does - in fact, I know all the languages in the example and each of them was more clear than clojure to me

comment 10y ago · link · parent

What is `nim pretty`? I tried it, but it does not exist in current devel

comment 10y ago · link · parent

Thank you. s-exps are a pain, because you have to manually specify the function sexp_of_t for any type t that you want to support

comment 10y ago · link · parent

Can you expand on this point? When I tried OCaml a little time ago, it was a pain even to have a polymorphic print function. I would be surprised if there was a serialization mechanism that produces a binary form that cannot be adapted to produce a textual form

comment 10y ago · link · parent

Ok, I see how it can work. Thank you very much for your explanation!

comment 10y ago · link · parent

I will try to be more clear. Say the size is actually unknown until runtime, for instance a vector is read from a file.

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

Yes, but my question is: even if you use erasure, what are you going to do at the call site? Won't you need to state a concrete size there? For usual generic types, erasure and code generation are equivalent in what they can do, because at some point you will specialize to concrete types.

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

Thank you, I understand that, but I need a little more detail. Let me explain.

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.

comment 10y ago · link · parent

Humans have to parse the syntax as well...
1
45678