Earlier quoted context omitted.
What algorithms are there for inferring the calculation? I'm playing around with a tool for building touch gestures visually, and I have some problems that look a bit like that (want to infer a function from some examples) but I don't yet know how.
This calculation is underdetermined, and there isn't any algorithm that would specify "it", since there are many functions that would satisfy the requirements. In general this is a hard problem of induction. In a more limited context you might think about adding regularizations that will make the function better determined. Choosing these and implementing them may not be trivial. If you are talking paths generated fr…
Imperative vs. Declarative (2013)
31–40 of 43 posts
Re: Imperative vs. Declarative (2013)
#32I'd been enough in to these battles so my 2 cents. I'm not saying that declarative mode is bad, in fact I love it, but the problem is that people tend to over do it in undesirable way. I've seen "architects" designing declarative language on top XML and asking programmers to code in it. There are also examples in likes of WPF which is perhaps the ugliest fattiest hairiest thing out there that lot of people have to fi…
Declarative language on top of XML... Are you talking about this one? http://thedailywtf.com/articles/We-Use-BobX
Re: Imperative vs. Declarative (2013)
#33I'd been enough in to these battles so my 2 cents. I'm not saying that declarative mode is bad, in fact I love it, but the problem is that people tend to over do it in undesirable way. I've seen "architects" designing declarative language on top XML and asking programmers to code in it. There are also examples in likes of WPF which is perhaps the ugliest fattiest hairiest thing out there that lot of people have to fi…
We abstract the "how" into declarative statements of "what" and "how many".
Re: Imperative vs. Declarative (2013)
#34Earlier quoted context omitted.
> Yes, way too imperative. "map" and "reduce" are imperative; they order something done. Well how would you write these snippets the right way then?with the language of your choice, so it fits the declaritive way a 100% ?
I'm not saying those things should be written in a declarative form, just that what the author is calling "declarative" isn't. If you wanted to do something like that in a declarative way, though, consider a spreadsheet with an intelligent evaluator. The spreadsheet is a declaration of a dependency relationship. When a number is changed, the numbers depending upon it change. It's not always just a recalculation, eith…
Seems like you're talking about functional reactive programming (or reactive programming in general).
Re: Imperative vs. Declarative (2013)
#35Yes, way too imperative. "map" and "reduce" are imperative; they order something done. With true declarative forms, you can treat them as data and do something other than execute them. It's hard to do much with an imperative form other than execute it. A scene graph or a game level file is a declarative form; you can view it from different angles and positions. The programs that plan actions for NPCs look at a game l…
> "map" and "reduce" are imperative; they order something done. So maybe it's my age showing, but I was taught that imperative was using explicit variables to control the "looping" (e.g. for with an index a la C style programming) whereas using "higher order functions" was not imperative. And I tend to agree with that. So I disagree that map and reduce are imperative because they don't explicitly control how the loop…
That said, that's mostly a specificity of Javascript than a property of the map operation. There's no reason you can't have a map on an FRP that truly declares a relationship between entities.
Re: Imperative vs. Declarative (2013)
#36Good Explanation
Re: Imperative vs. Declarative (2013)
#37Earlier quoted context omitted.
What is the speed of this on N of 16 to 20? At 8, any implementation should suffice nowdays. Edit: Also, apologies for the possibly ninja edit. This is ultimately somewhat silly. I am not going to lie and say that the these are easily readable. I fully cede that this could just be a training thing. I picked this particular example because I had fun with it using the DLX algorithm. Which is admittedly far above my und…
This example is bizarre, because a fast implementation is probably going to rely on a SAT solver, at which point the "queens code" (in any language) becomes a declarative specification of the solution! Also, I don't think that Haskell, OCaml, (or Prolog) are that much declarative: They have a very clear evaluation model, which you need to know in order to write any code. They also have debuggers as a result.
Regardless, I do apologize for the noise.
Re: Imperative vs. Declarative (2013)
#38I'd been enough in to these battles so my 2 cents. I'm not saying that declarative mode is bad, in fact I love it, but the problem is that people tend to over do it in undesirable way. I've seen "architects" designing declarative language on top XML and asking programmers to code in it. There are also examples in likes of WPF which is perhaps the ugliest fattiest hairiest thing out there that lot of people have to fi…
1. I would not say that SQL is harder to debug than imperative code. I have also noticed that I get less bugs and they take less time to solve when I push as much as possible to SQL. Usually something either works properly or it doesn't. I personally find SQL is one of the few languages where reading the code is easier than writing it.
2: Database optimizations must be some of the most well known ways to improve performance in the tech field.
3: SQL syntax isn't great (I wouldn't say it is terrible either).
Re: Imperative vs. Declarative (2013)
#39Still waaay too imperative, how about this: func [1,2,3,4,5] => [2,4,6,8,10] //Calculation inferred by compiler. console.log (func [6,7,8,9,10]) //=> [12,14,16,18,20]
What algorithms are there for inferring the calculation? I'm playing around with a tool for building touch gestures visually, and I have some problems that look a bit like that (want to infer a function from some examples) but I don't yet know how.
Re: Imperative vs. Declarative (2013)
#40Earlier quoted context omitted.
What is the speed of this on N of 16 to 20? At 8, any implementation should suffice nowdays. Edit: Also, apologies for the possibly ninja edit. This is ultimately somewhat silly. I am not going to lie and say that the these are easily readable. I fully cede that this could just be a training thing. I picked this particular example because I had fun with it using the DLX algorithm. Which is admittedly far above my und…
This example is bizarre, because a fast implementation is probably going to rely on a SAT solver, at which point the "queens code" (in any language) becomes a declarative specification of the solution! Also, I don't think that Haskell, OCaml, (or Prolog) are that much declarative: They have a very clear evaluation model, which you need to know in order to write any code. They also have debuggers as a result.
What programming languages don't require you knowing their evaluation model?