|
Lets see your goods...and keep it on topic ...hell ya.
Started by Jeff Norwell on
, 19 posts
by 14 people.
Answer Snippets (Read the full thread at jalopyjournal):
It is....
Trying to get some new stuff done for Torque Fest!
An old HD Flat Tracker hitting the turn sideways.. .
|
|
So, I'm looking through a java library (JScience) after someone here thoughfully pointed me towards it for getting Vectors (mathematical ones, that is) in java.
Unfortunately, I've never seen anything in my life before like:
public static <F extends...
Started by Jenny on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
<F....
Elements)
Lets break this down:
public static
Its a public static method.
Public static > DenseVector valueOf(F...
Real.ZERO; DenseVector<Real> v = valueOf(r1, r2, r3);
In this example, the type argument F number.
|
|
Design a function f such that:
f(f(x)) == 1/x
Where x is a 32 bit float
Or how about
Given a function f, find a function g such that
f(x) == g(g(x))
See Also Interview question: f(f(n)) == -n
Started by Unknown on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
Well, here's the C quick hack:
extern double f(double x); double g(double x) { static int parity = 0; parity ^= 1; return (parity ? x : f(x)); }
However, this breaks down if you do:
a = g(4.0); // => a = 4.0, parity = 1 b = g(2.0); //....
|
Ask your Facebook Friends
|
I read about 'side effect' from this website :
but still not understand why f = f++ considered unsafe ?
Can somebody explain?
Started by tsubasa on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
U should first understand how the compiler interprets ....
The article of the post incrementing operator i.e f++ is confusing, it is not considered unsafe.
Ólafur's code, it might yield f == 5 or f == 6 , depending on your compiler.
|
|
I'm thinking of buying Expert F# (Expert's Voice in .Net) - http://www.amazon.com/Foundations-F-Experts-Voice-Net/dp/1590597575/ref=pd_bbs_sr_3?ie=UTF8&s=books&qid=1229527045&sr=8-3
I'm a fairly accomplished C# developer looking to learn F#. What are ...
Started by Peanut on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
My favorite ones are in chapter 9, Introducing Language-Oriented Programming: probabilistic workflows... .
The examples are genuinely interesting.
The book is elegant, fun & practical.
For a fairly accomplished C# developer, Expert F# is the best book to learn F# .
|
|
A question I got on my last interview:
Design a function f , such that:
f(f(n)) == -n
Where n is a 32 bit signed integer ; you can't use complex numbers arithmetic.
If you can't design such a function for the whole range of numbers, design it for the ...
Started by Hrvoje Prgeša on
, 81 posts
by 80 people.
Answer Snippets (Read the full thread at stackoverflow):
f(n) = abs(n)
Because there is one more negative number than there are positive numbers for twos complement integers, f(n) = abs(n) is valid for one more case than f(n) = n > 0 ? -n : n solution....
This is true for all negative numbers.
|
|
I'm guessing that there must be a better functional way of expressing the following:
def foo(i: Any) : Int if (foo(a) < foo(b)) a else b
So in this example f == foo and p == _ < _ . There's bound to be some masterful cleverness in scalaz for this...
Started by oxbow_lakes on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Just in case it's not in Scalaz:
def x[T,R](f : T => R)(p : (R,R) => Boolean)(x : T*) = x reduceLeft ((l, r) => if(p(f(l),f(r))) r else l) scala> x(Math.pow(_ : Int,2))(_ < _)(-2, 0, 1 Expression[T](i : (T,T)){ def ....
|
|
This is the situation : I mostly program C# and have written types in it I don't want to lose. At the same time I would like to learn functional programming. The obvious answer of course is F#.
But for everything apart from C# I use emacs as an editor...
Started by Peter on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
That means that a lot of the concepts will be similar and you (as a procedural developer) will have to do the same mind-bending to use either but they are very different languages... .
They are both functional languages but syntactically they are very different .
|
|
I am translating a C# project into F#. While the logic part is easy, I am confused with the GUI part:
public partial class GomokuGUI : Form { private void GomokuGUI_Load(object sender, EventArgs e) { this.Width = 500; this.Height = 550; ... this.Paint...
Started by Yin Zhu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You could start with something like this....
Note that F# doesn't have any WinForms designer, so if you have some controls in the Form, you'll need to create them manually (alternatively you can design the form in C#, compile it and reference it from F#) .
|
|
I'm trying to write a small little scripting engine for a bullet hell game and I would like to do it in F#. I wrote some C# code to conceptualize it, but I'm having trouble porting it to F#. The C# code is posted below, and I would like some help porting...
Started by RodYan on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Type Runner = int -> Result and Result = Result of int * option<... .
That said, I think there may be a better/simpler representation choice, I'm still mulling it over .
Here's something that's almost a direct translation of the same solution strategy .
|