As an example of a generic type, List is a singly-linked list with values of any type.
We can define methods on generic types just like we do on regular types, but we have to keep the type parameters in place.
In the main function, we can use these generic functions and types:
To compile and run this Cilk program:
Cilk’s implementation of generics is based on C++ templates, which provide similar functionality to Go’s generics. The main difference is that in Cilk (and C++), the type parameters are specified at compile-time, while in Go they can be inferred at runtime in many cases.