The Student Room Group

Writing lists using 'Head | Tail' form?

I've got a homework sheet for A2 computing, and one question says:

Write the following as a list using Head | Tail form:
Anna Bill Catherine David Edward Fred


What does this mean? There's no mention of anything like this in the AQA textbook, and I can't find any information online. Any guidance is greatly appreciated!
Reply 1
The head of a list is the first element. The tail is the rest.
Reply 2
Original post by JosephMalam
I've got a homework sheet for A2 computing, and one question says:



What does this mean? There's no mention of anything like this in the AQA textbook, and I can't find any information online. Any guidance is greatly appreciated!


The question does not make sense - are you sure that you haven't missed a bit out.
Reply 3
The tail is just another list, which can also be in the form (Head | Tail), does that help?
"A list can be written as [head | tail]. For example:

The list [a,b,c,d,e] can be written as [a|[b,c,d,e]] or [a|[b|[C[d|[e|]]]]]"


[Anna| [Bill, Catherine, David, Edward, Fred]] Should be the correct answer :smile:
(edited 12 years ago)

Quick Reply

Latest

Trending

Trending