Hi all.
I'm trying to create a piece of code but cannot get it working. The simplest example I can think of is parsing some CSV file.
Suppose we have a CVS file, but the data is organized in some kind of hierarchy in it. Like this:
Section1;
;Section1.1
;Section1.2
;Section1.3
Section2;
;Section2.1
...
Hi
I am writing a Facebook application that would use a Postgres DB along with Facebook APIs and run on Amazon EC2. (and I am hoping for heavy loads )
With Java, I know that DB would be my primary bottleneck and concurrency limitations of Tomcat would be the secondary bottleneck. I could alleviate DB issues with caching and concurren...
There seems to be quite a bit of folklore knowledge floating about in restricted circles about the pitfalls of hash-consing combined with marshalling-unmarshalling of data. I am looking for citable references to these tidbits.
For instance, someone once pointed me to library aterm and mentioned that the authors had clearly thought about...
As far as I know recursion is very elegant but unefficient in OOP and procedural programming (see the wonderful "High Order perl", Mark Jason Dominus). I had some informations that in functional programming recursion is fast - keeping its elegance and simplicity. Could someone confirm and possibly amplify this? I am thinking in terms of...
Assume I have a record with a Hashtbl field:
type rec = {
table : (int, int) Hashtbl.t;
value : int;
(* more fields... *)
}
How should I update it in a functional way, i.e. something like that:
let new_rec = { old_rec with
value = old_rec.value + 1 ; (* that's ok *)
table = hash_table + (key -> value binding...
I'm really at a loss to explain why this is a type error:
foo :: (Eq a) => a -> a
foo _ = 2
Can anyone explain?
...
for F# array, is there an easy way to return sorting indices along with the sorted array?
like the sort() function from Matlab?
Background: I came from matlab/R, where manipulating array on indices are essential. I'd like to reproduce some index functions and trying to be able to pass indices array around as a variable in various funct...
Is there a way to use Haskell's "map" or something similar with multiple arguments?
i.e. to find the distance between a given point (defined as a tuple) and a list of other points:
map distance (-3,-3) buildings
Clearly, that doesn't work, because it tries to map "distance" to (-3,-3), where distance expects two tuples:
let distance...
I need a function, which is capable of iterating over the collection, calling a supplied function with element of the collection as a parameter and returning the parameter or it's index when received "True" from supplied function.
It is somethong like this:
def find(f, seq, index_only=True, item_only=False):
"""Return first item i...
Just to clarify, when I say multiple assigment, parallel assignment, destructuring bind I mean the following pattern matching gem
scala> val (x,y) = Tuple2("one",1)
x: java.lang.String = one
y: Int = 1
which assigns "one" to x and 1 to y.
I was trying to do
val (x,y) = "a b".split()
I was expecting that scala would attempt to patt...
Hello all
I have been given a strange requirement(challenging for me atleast) to write a logic in an application. I've to write a business logic wherein it should perform the following functionality
Total current consumption = current from A elements + current from B elements.
A and B are different types of devices
Now lets say the b...
Hi guys,
I want to do some numerical stuff in Erlang like this:
You've got an array with the following values:
[2,3,4]
In each iteration, you calculate
0.1 * [n-1] + 0.7 *[n] + 0.2 * [n+1]
This becomes the new [n].
If n == 0 then [n-1] = 0. If [n] == length of array then [n] = 0.
So I try an example:
[2,3,4]
calculations:...
I want to redefine several arithmetic operators in Haskell in order to make them more extensible and generic.
E.g.
class Mul a b c | a b -> c where
(*) :: a -> b -> c
This seems to work in combination with
import Prelude hiding ((*))
hiding the standard * operator. But of course all usual multiplications have to work as well, ...
Possible Duplicate:
Where do I find an Open Source project written in Scala?
I have been learning Scala for the past few weeks and I guess I am ready to get my hands dirty with some real meaningful project. But before actually starting a project and doing things wrong, I want to understand an existing opensource project done b...
Do any of the current crop of popular functional languages have good support for memoization & if I was to pick one on the strength of its memoisation which would you recommend & why?
Update: I'm looking to optimise a directed graph (where nodes could be functions or data). When a node in the graph is updated I would like the values of ...
I don't understand what "lifting" is. Should I first understand Monads before understanding what a "lift" is (I'm completely ignorant about Monads too yet:) ? Or can someone explain it to me with simple words ?
...
Can you people please suggest some good books / weblinks from where I can get to learn about above mentioned concepts?
(Please note that I am a Java programmer and have NO prior experience with functional programming. I have been studying Scala since last one month and would appreciate the resources that try to teach the above mentione...
Hi All,
I have following query on lambda calculus which am not able to understand:
Here is the lambda calculus representation for the AND operator:
lambda(m).lambda(n).lambda (a).lambda (b). m(n a b) b
Can anyone help me in understanding this representation?
Regards,
darkie
...
I am considering moving from Matlab to Python/numpy for data analysis and numerical simulations. I have used Matlab (and SML-NJ) for years, and am very comfortable in the functional environment without side effects (barring I/O), but am a little reluctant about the side effects in Python. Can people share their favorite gotchas regarding...
I've trying to learn F#. I'm a complete beginner, so this might be a walkover for you guys :)
I have the following function:
let removeEven l =
let n = List.length l;
let list_ = [];
let seq_ = seq { for x in 1..n do if x % 2 <> 0 then yield List.nth l (x-1)}
for x in seq_ do
let list_ = list_ @ [x];
list_;
It takes a list, a...