4 ms·
Things are only sequential when you're programming in imperative style. Haskell, for example, supports plenty of algorithms that don't have a specific order in
by ghusbands 8y ago
Things are only sequential when you're programming in imperative style. Haskell, for example, supports plenty of algorithms that don't have a specific order in which things happen. Prolog, too. And Halide. Also, Oz. There are plenty around, and they are both useful and fascinating.
- ankurdhama 8y agoHaskell is lazy, you can write a bunch of expressions and use the results of those expressions in other expressions and so on. For example: foo :: Int -> Int foo a = let z = a * c b = 10 c = 20 in b + c + z I used c is z but c is defined later. The language allows you to defined the expressions in any order but internally it will have to figure out the dependencies between the expressions and execute them in specific order and also while writing code and coming up with the logic of the algorithm you will have to think about what you want to compute first and what to compute next.
- wwweston 8y agoNot sure Prolog is a good example here; my experience with it involved having to spend essentially as much time reasoning about how the unification/backtracking algorithm was going to visit different clauses and facts (and how I might want to cut/control that) as an imperative programmer might think about the order in which statements are executed. Maybe more, considering the process was less linear and obvious. (Not that I didn't like Prolog -- I did -- I just felt far from freed of mundane concerns of execution order.)