I had two parameters. The first one was list, and the other was integer n.
Our function formed a new list which contained the first n elements of the parameter list and suppose that n
([1,2,3,4],2 )
[1,2]
How do I do that only using -> nil, ::, @ ?
What you describe is
List.takefunction in SML basis library:If you want to make the function yourself:
Or to demonstrate the use of
-> nil, ::, @(the use of@is not recommended, just for illustration purpose):