You're trying to call List.concat on a tuple. The type of List.concat is
fn : 'a list list -> 'a list
That is, it takes a list of lists, concatenates all of those together, and returns the result. That's your error.
If, instead of using List.concat, we use the @ operator, we get a different error (which may look slightly different on your system):
File "test.sml", line 7, characters 14-53:
! else [getPrimeFactors bigNumber (divisor - 1)]
! ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
! Type clash: expression of type
! 'a list
! cannot have type
! 'a
! because of circularity
This error is because getPrimeFactors
is supposed to return an int list
, but here you're trying to stuff the result from getPrimeFactors
into a list, thus getting int list list
.