Scheme How to Take the first item in the List? -


Say I want to get the first items of lists '(4 3 1)' (5 6 8) < / Code>

I want something like this

  (first '(4 3 1)' (5 6 8))  

I should return the first item

  (4 3 1)  

as a result.

The car does not work, because it only gives me the first item inside the 1 list

The list-reef does not work, the only reason above, I have 1 item inside the list

How can I do this? If I want to write it myself first?

You can use the process to get an element from a list, using its index By example, for example:

  (two ((L ((4,3 1) (5 6 8))) (List-specified L0)); Get element at index 0  

However, if you want only the first element, you can use it:

  (two ((' (4 3 1) (5 6 8)))) (Car L))  

The snippet is running.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -