Q:

Haskell, parse error in input 'if'

I can't for the life of me figure out why there is a problem with this if statement (haskell noobie.) Can anyone help me out?
fst3 (a,b,c) = a
snd3 (a,b,c) = b
trd3 (a,b,c) = c
fst4 (a,b,c,d) = a
snd4 (a,b,c,d) = b
trd4 (a,b,c,d) = c
qud4 (a,b,c,d) = d

fractionalKnapsack (x:xs) =
    fractionalKnapsack (x:xs) []

fractionalKnapsack (x:xs) fracList =
    ((fst3 x),(snd3 x),(trd3 x),(snd3 x) / (trd3 x)):fracList
    if length (x:xs) <= 1
    then computeKnapsack sort(fracList)
    else fractionalKnapsack xs fracList

computeKnapsack (x:xs) = (x:xs)

A:

There are a few things wrong with this code. You have two different definitions for fractionalKnapsack, each taking a different number of arguments, clearly that causes the compiler some trouble. Also the parse error on the if statement is because there shouldn't actually be an if statement where you are trying to put one, you have already completed the definition of the function before you reach the if statement. 
It might help a little bit if you better explained what you are trying to do, or what you expect to be happening with the code you wrote.

A:

: is the "cons" operator. It cons-tructs a list by providing the "head" element on the left, and a "tail" list on the right
ghci> 1 : [2,3,4]
[1,2,3,4]

You can pattern match on lists with more than 0 elements using :.
ghci> let (x:xs) = [1,2,3,4]
ghci> x
1
ghci> xs
[2,3,4]

The way that you are using (x:xs) in your code hints that you do not yet have a firm grasp of the definition of lists nor of pattern matching. Rather than using
if length (x:xs) <= 1

it is more common to simply pattern match. A simple example:
howMany :: [a] -> String
howMany [] = "Zero"
howMany [x] = "One"
howMany (x:xs) = "Many"

Haskell functions can be defined with a sequence of "equations" like this where you pattern match on the possible cases that you are interested in. This brings us to the other issues with your code, which are:

The equations for fractionalKnapsack don't match. One has 1 argument, the other has 2. You probably meant to name the second fractionalKnapsack'.
Neither of the fractionalKnapsack definitions handles the empty list case. I'm not sure about this; this may be acceptable if you know that it will never be given an empty list.
None of your functions have type signatures. Type inference can infer them, but it is usually a good idea to write the type signature first, to express your intent for the function and guide you in its implementation.
The second definition of fractionalKnapsack doesn't make sense. There can only be one expression after the = sign, but you have provided two, separated by a newline. This is invalid Haskell and explains why there is a parse error on "if": because whatever compiler/interpreter you were using did not expect the beginning of another expression!

A:

computeKnapsack sort(fracList)

That's probably an error too. It should be computeKnapsack (sort fracList) (or, equivalently, computeKnapsack $ sort fracList).
When you do computeKnapsack sort(fracList) it's equals to doing computeKnapsack sort (fracList), which is equivalent for doing computeKnapsack sort fracList, which means: "give computeKnapsack two arguments: sort and fracList".

