I have a sequence generated by list comprehension as follows:
var a_bigram_list = lc[a[i..i+2] | (i <- 0..<len(a)), string]
Now, I would like to sort it but sort(a_bigram_list)
will result in the following compilation error
Error: type mismatch: got (seq[string])
but expected one of:
proc sort[A, B](t: OrderedTableRef[A, B]; cmp: proc (x, y: (A, B)): int)
proc sort[A, B](t: var OrderedTable[A, B]; cmp: proc (x, y: (A, B)): int)
proc sort[A](t: CountTableRef[A])
proc sort[A](t: var CountTable[A])
proc sort[T](a: var openArray[T]; cmp: proc (x, y: T): int; order = SortOrder.Ascending)
Is there any way of sorting a sequence? Or do I need to convert it to array? If so, can is there a way to obtain an array from lc?