I'm wondering how would the following function look without any syntactic sugar:

```
tails1 :: [a] -> [[a]]
tails1 [] = [[]]
tails1 [email protected](x:xs') = xs:tails1 xs'
```

I'm mostly concerned with the usage of the @ operator, I've tried what follows, but that's obviously not the correct way

```
tails1 ((:) x ((:) xs' [])) = xs:tails1 xs'
```

# Best How To :

First you need to understand the list data type. Here are the list data constructors:

```
[] :: [a]
(:) :: a -> [a] -> [a]
```

where:

- [] create an empty list
- (:) takes an
`a`

, a list of `a`

and returns a list of `a`

with the new element appedned

Let say you have a list `[1,2,3,4]`

. This can be written as `(:) 1 ((:) 2 ((:) 3 ((:) 4 [])))`

In expression `x:xs'`

, `x`

hold `1`

and `xs'`

will hold `(:) 2 ((:) 3 ((:) 4 []))`

. In other words `:`

takes an element and a list, appending this element to the list.

The equivalent expression for your example is:

```
tails1 ((:) x xs') = ((:)x xs'):tails1 xs'
```

Where `x`

is holding the first element of the list and `xs'`

the rest of the list. `xs'`

cannot hold multiple elements. In your example `tails1 ((:) x ((:) xs' [])) = xs:tails1 xs'`

, `xs'`

should hold everything except first element and `[]`

. (in my examle it should be 2:3:4 which is not a valid list because is not ended by []).