I use both functional and imperative languages daily, and it's rather amusing to see the surge of adoption of functional languages from both sides of the fence. It strikes me, however, that it looks rather like a fad.
Do you think that it's a fad? I know the reasons for using functional languages at times and imperative languages in oth...
My Manager asked me to code in ASP.net. What is meant my imperative and interrogative code.
How it related to programmers?
...
What languages are available that promote both object-oriented and functional programming? I know that any language that supports first-class functions can be considered functional, but I'm looking for a syntax that's specifically targeted for both coding styles.
Using such a language, I'm imagining isolating all state changes to a sing...
These days I'm getting seriously into functional programming.
While I'm really excited about Haskell and the possibilities it seems to offer, I can also see now that it is going to take me a while to learn. In an SO question on How to learn Haskell an answer states that it'll take months if not years to actually "master" it.
Now, I kn...
I am starting to learn ocaml, and am really appreciating the power of recursion in the language. However, one thing that I am worried about is stack overflows.
If ocaml uses the stack for function calls, won't it eventually overflow the stack? For example, if I have the following function:
let rec sum x =
if x > 1 then f(x - 1) + x...
I'm new to functional world and appreciate help on this one.
I want to SUPERCEDE ugly imperative code from this simple function, but don't know how to do it.
What I want is to randomly pick some element from IEnumerable (seq in F#) with a respect to probability value - second item in tuple (so item with "probability" 0.7 will be picked...
Specially in comparison to C/C++ (which are declarative), how is Java imperative?
...
OK, no cheating now.
No, really, take a minute or two and try this out.
What does "positions" do?
Edit: simplified according to cgrand's suggestion.
(defn redux [[current next] flag] [(if flag current next) (inc next)])
(defn positions [coll]
(map first (reductions redux [1 2] (map = coll (rest coll)))))
Now, how about this vers...
One of the main characteristics of functional programming is the use of side-effectless functions. However, this can be done in an imperative language also. The same is true for recursion and lambda functions (for example C++0x). Therefore I wonder whether imperative programming languages are a superset of functional ones.
...
I have been searching the web looking for a definition for declarative and imperative programming that would shed some light for me. However the language used at some of the resources that I have found is daunting - for instance at wikipedia.
Does any one have a real world example that they could show me that might bring some perspective...
How should I monitor the progress of a mapped function in clojure?
When processing records in an imperative language I often print a message every so often to indicate how far things have gone, e.g. reporting every 1000 records. Essentially this is counting loop repetitions.
I was wondering what approaches I could take to this in cloj...
Is there any deeper meaning in the fact that the word "statement" starts with the word "state", or is that just a curious coincidence? Note that english is not my native language, so the answer might be obvious to you, but not me ;)
...
It occurs to me that state control in languages like C# is not well supported.
By this, I mean, it is left upto the programmer to manage the state of in-memory objects. A common use-case is that instance variables in the domain-model are copies of information residing in persistent storage (i.e. the database). Clearly this violates the ...
I'm looking for a way to gain reference to a class that was instanciated via XML, but I need reference to it in imperative code. I usually do this via the datacontext of the control, but in this case, the user control does not have declaritive reference to the class that I require.
I know I have seen how to gain a reference to a class ...
Like most ppl, I started with and still do a lot of imperative code(mostly Java, Ruby, Javascript).
I've never been a big fan of OO, either because I never understood it properly or because I don't think OO.
Got my first glimpse of FP via javascript, passing functions around, closures, etc. Have been in love with FP since then.
Rece...