functional

Functional Design and Technical Design Documents for a Web Application

Hi All, I am going to work on a Web Application which I have to start with Gathering the Business Requirements up on which I need to develop Functional and Technical Documents. I have not developed Functional and Technical design documents on my own, could you let me know how to start and what are the things I need to take in to conside...

Uses for Haskell id function

Which are the uses for id function in Haskell? ...

Functional unwrapping of nested array

Given an array containing other nested arrays, I want to create an array containing only the elements from the first array. For example [["1", "2"], "3", [["4"]]] should evaluate to ["1", "2", "3", "4"]. I've managed to make a method that works: @@unwrapped_array = [] def unwrap_nested_array(array) if array.respond_to?('each') ...

How many oo-functional hybrids are there?

We're discussing oo-functional hybrids here, but I wonder, how many languages actually qualify for this name. Scala, Clojure, F#? Any more? It'd be great to get one such language per answer, and a little explanation, why you think it is oo-functional hybrid. ...

Scala Performance: imperative vs functional style

I'm new to Scala and was just reading Scala By Example. In chapter 2, the author has 2 different versions of Quicksort. One is imperative style: def sort(xs: Array[Int]) { def swap(i: Int, j: Int) { val t = xs(i); xs(i) = xs(j); xs(j) = t } def sort1(l: Int, r: Int) { val pivot = xs((l + r) / 2) var ...

Haskell doubt: how to transform a Matrix represented as: [String] to a Matrix Represented as [[Int]] ?

Im trying to solve Problem 11 of Project Euler in haskell. I almost did it, but right now im stuck, i want to transform a Matrix represented as [String] to a Matrix represented as [[Int]]. I "drawed" the matrices: What i want: "08 02 22 97 38 15 00 40 [ ["08","02","22","97","38","15","00","40"], [[08,02...

Strong typed Windows Forms databinding

Edit: I prefer this solution I found eventually in Google's cache (it has been deleted from the author's site) as it only needs one type specification and does it in a way I haven't seen before. I don't know why the original author deleted it. // Desired call syntax: nameTextBox.Bind(t => t.Text, aBindingSource, (Customer c) => c.FirstN...

Measuring code complexity of functional language and imperative language

What is the best way of comparing code complexity of functional language and imperative language? In my case I have to compare complexity of certain programs written in F# and C++. As for now as a code quality measure I am using lines of source code. ...

infinite loop in functional programming ?

I was wondering: can infinite loops be done in functional programming? example: when using the windows API to get windows messages, it is usually implemented in a loop. I know it is possible to make a function that will keep going into recursion indefinitely. I expect that this will result in a stack overflow. are infinite loop the...

What are functional and non functional parts of an application ?

I was asked this question in an interview. What are functional and non functional parts of an application ? ...

functional concurrency

Hi, when there is some list of advantages of functional languages, there is usually mentioned that it makes concurrency easier because there is not any variables which are subject of change. But, as my assembler-school-lessons-memory knows, there are registers in cpu and memory, that are both mutable. So when the high-level functional co...

Suspending function calls in Python for passing later (functional paradigm)

I'm writing a python command line program which has some interdependent options, I would like for the user to be able to enter the options in whichever order they please. Currently I am using the getopts library to parse the command line options, unfortunately that parses them in-order. I've thrown together a system of boolean flags to...

difference between integration testing and functional testing

Is functional testing and Integration testing same?? You begin your testing through unit testing... Then after completing unit testing you go for Integration testing where testing the system as a whole. So is functional testing same as Integration testing as in functional testing also, we take the system as a whole and test it for funct...

functional integration testing

Is software testing done in the following order? Unit testing Integration testing Functional testing I want to confirm if Functional testing is done after Integration testing or not. Thanx ...

Coding Enhancement: Generic Method using Func<T> as parameter

Hi Guys.. I have this two objects class RNB { public RNB(double roomRate, double roomDays) { RoomRate = roomRate; RoomDays = roomDays; } public double RoomRate { get; set; } public double RoomDays { get; set; } public const double BasicLimit = 100; } ...

Couldn't close file in functional way in python3.1?

I wrote a line of code using lambda to close a list of file objects in python2.6: map(lambda f: f.close(), files) It works, but doesn't in python3.1. Why? Here is my test code: import sys files = [sys.stdin, sys.stderr] for f in files: print(f.closed) # False in 2.6 & 3.1 map(lambda o : o.close(), files) for f in files: print(...

Common Lisp or Scheme for server-side?

I wonder if some functional languages are used for web development and which are most useful and supported with that goal? ...

New to ML: How to store return values of type a* a* a*....

Hi I have a program that returns int*int (Example for illustration purposes): fun program(a,b) = (1,2) I want to do something along the lines: fun program(a,b) if a = 0 then (1,2) else val x,y = program(a-1,b) return (x-1, y) Basically, I want to manipulate the tuple that is returned, and then return a modific...

Which Functional programming language offers best support in Eclipse?

As an exercise my team is looking at learning functional programming. One of the factors to choose a language is its support in Eclipse. Any language with Eclipse plug-in is fine but what language offers the best free plug-in? Bonus question: the best online/book tutorial for this language. ...

PHP Calling a Function

How can I pass a function as a variable and then call it using that variable? e.g. test(echo); function test($function) { $function("Test"); } ...