Should functional programming be taught before imperative programming? [closed]

Actually, some schools already do it this way around. Where I study (University of Copenhagen), they teach SML in the first semester, as an intro to programming. Then they teach Java afterwards, as an intro to OOP. I think it works extremely well, and I agree with you it’s better than the other way around. … Read more

What is the difference between a Functor and a Monad?

Let me explain my understanding without going into category theory: Functors and monads both provide some tool to wrapped input, returning a wrapped output. Functor = unit + map (i.e. the tool) where, unit = something which takes raw input and wraps it inside a small context. map = the tool which takes a function … Read more

if-else branching in clojure

This is the subtle difference between imperative and functional approach. With imperative, you can place return in any place of the function, while with functional the best way is to have clear and explicit exeecution paths. Some people (me including) prefer the latter approach in imperative programming as well, recognizing it as more obvious and … Read more

Idiomatic clojure for progress reporting?

The great thing about clojure is you can attach the reporting to the data itself instead of the code that does the computing. This allows you to separate these logically distinct parts. Here is a chunk from my misc.clj that I find I use in just about every project: (defn seq-counter “calls callback after every … Read more

What are the best uses of Logic Programming?

Prototyping. Prolog is dynamic and has been for 50 years. The compiler is liberal, the syntax minimalist, and “doing stuff” is easy, fun and efficient. SWI-Prolog has a built-in tracer (debugger!), and even a graphical tracer. You can change the code on the fly, using make/0, you can dynamically load modules, add a few lines … Read more

techhipbettruvabetnorabahisbahis forumu