For this problem, you just use
Needs["Combinatorica`"]
KSetPartitions[Range[1, 3, 1], 2]
Mathematica 12.0
Needs[ "Combinatorica`"]
(* set partition *)
SetPartitions[{a, b, c}] (* No constraints *)
RGFToSetPartition[#] & /@ RGFs[5] (* Generate based on RGF, the result is consistent with the above, the order may be different *)
SetPartitionListViaRGF[5] (* Exactly the same as above, just wrapped again *)
KSetPartitions[3, 2] (* Represents partitioning the set {1,2,3}, restricted to 2 parts *)
KSetPartitions[{a,b,c}, 2] (* Restricted to 2 parts *)
(* RGF related *)
RGFs[5] (* Gives all RGF sequences of length 5 *)
SetPartitionToRGF[#] & /@ SetPartitions[5] (* Generated based on sp, the result is consistent with the above, the order may be different *)
RandomRGF[5] (* Equivalent to randomly selecting one from the above results *)
RGFToSetPartition[{1, 2, 1, 2, 1}, {a, b, c, d, e}] (* Mapping from RGF to SetPartition *)
RGFToSetPartition[{1, 2, 1, 2, 1}] (* If the second parameter is missing, association [n] will be performed *)
RGFToSetPartition[{1, 2, 1, 2, 1},{a,b}] (* Invalid inputs will not calculate results *)
(* Functions with rank are basically not needed to be looked at, if you know how to write [[]] *)
RankSetPartition[#] & /@ SetPartitions[4] (* This result is Range[0, 14] *)
Reference
Restricted growth function(RGF) patterns and statistics
Partitions and Compositions - Wolfram Mathematica Official Documentation