Welcome to Toffees TV. I am joined by an Everton legend, absolute legend, and a legend of football in general. Changed the face of the way we view football and he's now chilling in his apartment in Qatar, it is the one and only Andy Gray. Andy, lovely to have you on a game, mate. That's good to talk to you, it's really good, yeah.  How are you finding it, mate? You're okay over there? I'm not bad with my own company most of the time. Sadly, my business got caught in the UK and she's not been able to get back to Qatar yet, so that's a bummer. But normally, I'm all right with my own company, but I think when you're being like, I've had it for five weeks now and the main thing, the golf course is shut and that's the big thing for us. I think if we could get the golf course open it would help our mental health, you know, honestly. No football and no golf? No, so what does it do? What does it do? Let's move on to slightly brighter things and reminisce about your Everton career, which always fills me with a warm glow. Talking about that side and you and your blonde locks, how did the move come about to Everton? Obviously, you'd been at Wolves and you were a big nameshiker and you'd had some injuries. How did the move come about to Everton? Well, I think obviously instigated by Howard and Everton. I think that Howard was in a bit of trouble then. I think we all remember that. There was pressure on the board, there was pressure on Howard, there was pressure on the board to make a decision about him. And he was running out of money. He bought his magnificent 7 if you remember, either that, the season before I think it was. I hadn't quite worked from him that way. And he was running out of options. I was an option, a cheap one. I was at a club that had gone into the administration. So I would be sold as soon as a half decent offer came in. And I think Howard had a look and thought, you know, I don't know. I mean, in fairness to him, he took a gamble with someone who, if I was being totally honest, I wasn't quite sure if I could hack it again. I'd had a couple of poor years at Wolves, a couple of great years to start with, then followed by a couple of poor ones. There were various reasons for that. The club in the administration didn't help. The club was in the right state. Owner after different owner was coming in, no one knew what was happening. It was affecting everybody, not just me. So I needed to get away as well and see if I really could do it again. I think the combination of Howard's last shot, really, I'd get somebody in to try and change it a bit. And my last shot at getting out at Wolves to see if I could still do it again. It just came together. I enjoyed my time at Wolves, but when Howard asked me and wanted me, as soon as I met him, I thought, yeah, I'm on the way. No problem. I'll definitely come up. You've told me this story before, but just reiterate the story of you and your medical records, because it wasn't quite computerised, was it, in those days? No, it wasn't. And as I said, Wolves were going to the administration, so everything was a bit all over the place. So of course, on the Thursday, I think it was, I was asked to go into Molyneux to pick up my medical records and I could take them with me on Friday morning up to Goodison for Doc Irving to have a look at and just sort of skim over. So I went to pick them up.  I thought, I nearly needed a wheelbarrow to take them out of Molyneux. And I thought, I can't take that up there. I said, you must be joking. So I thought, right. So I went home and had a big open fire. So I went through them all and I thought, right, that can go into fire. That can go into fire. That can go into fire. Suddenly, this must have been six inches thick, at least. This file that was six, seven inches thick, suddenly was an inch thick. And looked a lot, looked a lot like he could carry. When I went to Goodison, he gave me a witty doc Irving and he went, oh, I'm surprised at that. And I said, what's that doc? He says, well, I thought there'd be a lot more than that. He says, nah, popular misconception doc. I'm not really being that badly injured before. You know, people just talking. And in actual fact, my knee was swollen still, because I'd played on Wednesday night. And would you believe in a cup tie against Preston, a lead cup tie? That's why I missed the lead cup that night. And I'd played that Preston, but I shouldn't have done with a swollen knee. Went up to Goodison, sat down with the doc. And looked at my knee and he went, whoa, a bit on the swollen side. I said, yeah. I said, it's always a bit like that doc. But it's not going to cause me a problem. He said, well, if we don't sign you this morning, what will you be doing tomorrow? I said, well, I'll be playing for Wolves. I'm like, oh, OK, all right. And off he went and came back and he said, well, we can't get you registered in time, how I'd said, but I can get you to sign a loan deal, which means you can play tomorrow. And then we'll sign the contract at the beginning of the week. So that's how I got to play that game, because it was tight. Was I signed a loan deal for 24 hours and then we did the contract after that. But yeah, it was a little surprised at how uninjured I was. And that was it. That was a key game. Actually talking to Adrian Heath last week. He done one of these with me last week. And he said it was first to home, wasn't it? Your your debut. And he said he hadn't scored. In fact, I just had it up before. He hadn't actually scored a league goal. He scored a couple of goals in the league cup.  And he said, and he didn't. After time, he said he didn't even try and win the ball. He just made sure the centre back didn't win it. And lo and behold, you took one on your chest, rolled it across and he knocked it in. And we won the game one, no? Yeah, well, I do remember saying that to him. Because listen, I know what we was feeling like. You know, he was a big money signing. He was the young lad. Hadn't quite worked for him. The league goals were hard to come by. And so I knew it was going through. I was like 28. So I had an idea of what he was going through. 27, was it? 27, yeah, 27. I might be coming up for 28. So I knew it was going through. And I had a little bit more experience in in shape. And I meant it. You know, I did enjoy scoring goals. But I also got as much joy out of creating something for my mate as well. So I did say, I just said, listen, any time the ball comes anywhere near me in the ball. Be man. I said, just get yourself near me. I said, because I guarantee you, I'll get something dropping for you. I'll get something dropping for you. And lo and behold, it did. And he took his chance in. Well, as we say, it was, he never looked back really after that. Yeah, he was up and running. You scored your first goal ironically against Villa. One of your, one of your ex-clubs. Did I? Your first goal for us, yeah. Villa, a one-ones row. Paul, ride out to score for Villa, actually. He went on, obviously, to play for Everton. And you scored in injury time to get us a point on December the 10th. That was your first, your first goal. That was a good quiz question, because if you'd have said to me, who did I score my first goal for forever? I would not have been able to tell you. There you go. There you go. I usually remember every goal I scored. Yeah, yeah. I've no idea. I see. I remember creating the goal for Inchey. Funny that, isn't it? Yeah. I remember that vividly in that moment, in that game. But I don't remember my first goal. Yeah, 10th of December. The header, the header. The header, I think, 10th of December. Yeah, like, like all injury time equaliser. We drew one-one, one-one. So, so there you go. We went into that, we went into that December, and I remember us getting bumped three and ill at Wolves, actually, you know. We didn't play very well, let's leave it there. And then the Coventry game. A game I always have spoke to many people about, I think me and you, about the chat about this before, but Birmingham City away on the 2nd of January. Yeah. It was a tough game, because we hadn't won for weeks, and you said that Howard said some words before the game, kind of, it's your last chance or something like that for the players, was that right? Yeah, yeah, he did. He came in, I remember him coming in sitting with us before that game, it was a big game. Not easy going to St Andrews, trying to get a win when you hadn't been playing well. And he said, this is, I'm under pressure, and you know, I believe in you, the majority of you, a vast majority of you, I believe in you, and I want you to succeed, but if we don't get a performance or result today, then I'm seriously going to have to shake this thing up big time. So we knew, we knew when we went into that game what was required, and you know, people talk about other games, the Stoke game, the Oxford game, yes, they all played a part, but for me, in my opinion, that was the one that started it, because I think from there, results started to improve, confidence started to build, Howard became more confident in what he was doing as well, I believe, and started to find his team at last, that he thought, this is going to be my team, this is what I'm going to go in with. You know, he had to make his mind up with Jim Arnold, or Neville, Jim Arnold, or Neville, he did Neville with the nods, that was another big time in it. So I think that game was big for that, for me, I still believe that, even though Stoke and Oxford were massively important games, so was Birmingham City. Yeah, we won the game too, and then Stoke, like you just mentioned, that was on the Saturday, that was the famous window opening, doing it for that lot, you come up big, and that one you scored the first goal, and that one didn't you, and Alan Irvine scored the second, and it was a big result, because that was a tough place to go, the victory of that one. Stoke was never easy, it was a cup tie, wasn't it? Cup tie, yeah, third round, yeah. And I would open the windows, and the noise that come through that window, my goodness, it blew us all away, and you know, as we say that, we just always said to be, nah, we're not letting these people down, we just said, no chance boys, come on, I said, well, you're absolutely right, and we had the word momentum as a brilliant one, it wasn't used as much back then as it is now, but that's, I know it was only two games, but it was amazing what the Birmingham game did to our conference, going into that, that was two away games where you'd need to be playing pretty well to go and win both, right? You need to be a really good team to go to St Andrews and Stoke, and win both games. We were down near the bottom of the league, and hadn't shown much at all, but yet we went to those two places and I think we had two clean sheets. Two clean, yeah, yeah. But when in both two now, clean sheets, four goals, suddenly we were walking around thinking, we can play, and it was amazing how we just suddenly went whoosh, and off it took. Yeah, you're absolutely right, the Birmingham game. There was only last one of the next 12 league games when considering where we'd been at Christmas was incredible, obviously the FA Cup it's a different competition, but you've right the momentum was building there, wasn't it? Obviously, I don't know whether people remember that we had Jillingham and those three games, you know, the 2-0-0s and then a 3-0, and then we beat Shrewsbury 3-0, we were also doing well in the league. You just mentioned before you played against Preston how hard was it for you to be in the team and then having to sit out for that league cup run? Horrible, horrible, because I could see we could see the confidence growing. I could see, you know, every game we played we got more and more belief in our ability to get results and beat teams and I could see it growing in the league cup and it was horrible, you know, being in the league games and dropping out for a league cup and being in the FA Cup and dropping out for the league cup and it was horrendous. But I mean, I'm delighted as well, you know. There's a lot of people saying, you know, you don't want your team to win when you're not playing. I do, I did want my team to win even though I wasn't playing. It was so important. And it was a big psychological boost for a lot of the young boys to go all the way to the final. And particularly the final as it was, and as we said, final, first time ever in the history. And, you know, we were a lot of unlucky. We got done by a really bad decision when Jocky Hanson should have given up where we didn't get the decision that probably would have won us a game at Wembley and then we lost the ball on that main road. But that was a big, even though we lost it was a big moment. It was a big moment because it gave all the young boys and there were a lot of them now beginning to stamp their credentials in and stay in the team, a lot of them. And it gave them that we can live with this team. This Liverpool is the best team in the country and we should have beaten them and we'll keep them right to the wire and I think that that gave us a huge belief in going into the FA Cup. It certainly made me more determined to do the FA Cup because I wasn't involved in the League Cup. So I was doubly determined that I wanted to get back there for the FA Cup and just sample that. So I'd been there a couple of League Cup Finals I'd won a couple of League Cup Finals but I hadn't been there in the FA Cup Final and so I was pretty determined to try and help the boys get there and luckily we did. Just go to win it in the League Cup Final as well. So don't leave that out mate. Adrian Eats said that after funnily enough actually after the Liverpool game we come off and although we'd lost it was like we're there now because we've just ran them close we know we're coming and everything built from that. We can't not talk about not counting the header. What were you thinking? No idea. I still don't know. 30 years on 30 odd years on to this day I just felt and it's funny I mean she's got such a lovely left foot and he's always looking to feed it in there and when it comes over I kind of my first thought is I'm going to head that obviously. I was better with my head than I was with my feet and it was coming on to my right side as well which was my weaker side and it's amazing how quickly a footballer's brain works in a few seconds because I really believe if I had gone with my right foot I wouldn't have had a direction power control to have had a good contact on it because I would really have been stretching that at it. And I just thought if I can get there my best option is to try and hit it but it dipped a little bit earlier when it came over the defender when a shot came in I thought I'm going to get it before it hits the ground I thought I was going to be the diving header but then it suddenly dips quite short on me and I think well I'm committed to going for it I couldn't stop myself and the only thing I could do was just hoping and they had a folly header just listen it could have gone anywhere but the goalkeeper I think was so surprised that was more the reason why he didn't save at the end and it was just usually kind of awkward what the hell is he doing and I had posted a voice thought as well what the hell are you doing Andy but listen it was an important goal really important goal and it got set as set that game and just put us through and it just kind of put pain to notice county who again were a decent side in those days girls and their team you know we were away from home it wasn't easy I mean they admitted to their cup run they did pit us against a lot of big teams in that run we were fortunate we played Taylor Bird and we played we had Jalingum didn't we no Jalingum yeah and we played in that year we had Stoke Jalingum, Shrewsbury, Not County and then Telford was the year later, Southampton then in the semi-final obviously Southampton they were a good side they were an experienced side if you look at their team Shiltingold didn't he Frank Worthington at top end Mick Bells playing left and back they were back for like smart right they had bags of experience much more than us and I think they really fancied themselves but that was another day Big Neve was terrific a big save early on that he made that were important it looked like it was drifted it looked like we were going to have to go to a replay again and have to go through it again till the wee man popped up with a lovely little header and that was that that was such a great feeling and the best bus journey I've ever had coming back from that game Exactly what I didn't he said it's 40 miles an hour all the way back loads don't go Take your time Gem get your foot off that Outstanding Outstanding memories and then obviously one thing that Aiden he did say was that two things he thinks that you and Peter Reid did for that team was one made the players accountable to each other he said because it was made everybody question each other you know it's Howard didn't need to do it all the time you did it for them you and Reid and you become that unit and then he said you in particular on the final week said if I hear anyone saying they're coming here to enjoy themselves I'm going to have them he said because I'm coming here this is you I'm coming here to win we're coming here to win and he said that focused everybody for that particular game he's writing about the coming final week because I was hearing from Watford Elton John, Graham Taylor we're going to have a good time we're going down to enjoy themselves they might be effing on to enjoy themselves we're effing on to win it we won't get any enjoyment unless we walk away from there having won it I'm telling you now the boys were going win two or three and I kept saying if I hear any you say we're going to win this easy we don't want that either but they were so confident the kids and all the boys they were all so confident we were going to win the football match we had to just try and keep feet on the ground I get no enjoyment I'm losing anything and I said that remember how you felt you don't want to feel that again but in all honesty we were never I don't think we were ever going to lose that I don't know I think Barnes he missed the header early on good chance for John because he's a decent header of the ball and Barnes he missed the header early on and after that, Athena scored two we'd have got three, if they had got three we'd have got four I think we were that much better than them and in the end it was a comfortable comfortable win really was for any final it really was people when you watch it again you realise how good we were you lose that at the time and obviously as a player you're in it so you part of it as a fan the nervousness of wanting to win but when you go and watch it back we were just so good in the game you write that Barnes had the header I think that Lez Lez, what was his name had a chance in the first half that just went wide but other than that there was nothing you scored a wonderful header not an honorary not an honorary Steve Shea what's face by the way nothing wrong with it it doesn't say anything but grey in the record books that's all it says it does I don't think there was anything wrong with it he didn't have his hands on the ball he touched it I definitely headed the ball I said to everybody it looks bad but it looks bad because you know what happened he fell over his own player he fell over Steve Terry I just put my head in there I just got in contact with the football listen the way it looked 9 times out of 10 he might well have given a free kick but especially in the cup final you know what I mean so I guess it's what I've always said to be good at any sport you need to have luck on your side as well that was fortunate for me a lot of referees would have given the fill although I didn't think it was and I got the goal and it was great that me and Shappie two jocks were able to score both goals for everything in that cup final that was special for us obviously the next season we signed Paul Briceville in the summer and the next season we kick off with a win against Liverpool and Wembley in the charity shield which was a brussey bonus she had tried to claim it but it was definitely Grobala own goal that would be pretty good at claiming own goals I have to say a couple of them he did, he certainly did going into that next season obviously we've been on a high two cup finals, finished seventh great run, think we lost a couple of the last 18 or whatever was there a belief that we could actually do something that season or was there there was a genuine belief and particularly the way he had strengthened that way that made a massive difference and Trevor Steven and Sheets were dominant and the fact that Alan Irvin was phased out, Terry Curran was phased out these were good players the two young kids had come in and made it their own and everyone was boying because of the FA Cup when you think you've taken the FA Cup win into the summer with your fantastic feeling and you couldn't come around quick and sadly I got injured in pre-season and obviously the charity show because he decided he wanted to give base a game I wasn't quite ready and I was gutted to miss that game and again another something about Liverpool Mersley said like Wembley game I wasn't going to play so I never got to play the season was we got a kick in the butt early on because we just never started the way we thought we got hammered at home Clive scored the hat trick I think Clive, Alan got a hat trick that day before, yeah and then the baggies beat us in the midweek at all and I remember going in the Friday night game it was a live game on a Friday night at Stafford Bridge and Howard had said to the boys listen I don't care what happens the season we have to start tonight I don't care now but we're not going to concede we can see these six goals ridiculous we don't concede goals I want a clean sheet and whatever comes with that we'll take it and we'll move on got a fantastic winner that was it that let the blue touch play for the season and and off we went we were off and on part of that season was a struggle for you because obviously the injury and then Heath and Sharp were kind of in but you scored your first goal this season it was a big big goal at St James's Park we won 3-2 you scored ahead it was a big big win that for us because you've just kept that momentum going but was it tough sitting out and watching those two doing well I remember that game I'd been out injured when I came back Howard decided to play me in in shape at St James's that was a big decision because Graeme played alright first few games and then I was fat so Howard had to make a decision and he decided he would go with me in in shape and Sharp he was furious and he might deny this but he was close to sending a transfer request and he was so upset I talked him out of that I said as strange as it would be I said listen pal Sharp you're angry you're not thinking straight I said football changes quickly so don't do anything stupid right now promise me you won't do it and he went alright I'll let him think about it there and lo and behold what happens the man who's telling him don't put a transfer request in smashes his metatarsal that game and I'm out for 8 weeks and those 8 weeks or 6 weeks whatever it was I'm the 2 best Rudmen and the best partnership in the country by some distance they were brilliant together absolutely brilliant together all the way through that horrific injury that Yadrin got when was it November? December 1st I think Shiff will Wednesday that horrific injury that Inchie got I sat on the bench for I think 12 games 11 games something like 10 games it was hard but Terry Daraquot kept me going for a bit Terry because I had to play games played a few reserve team games just to tick over and Terry was brilliant for me there kept me going, kept my chin up I was never going to get down too often anyway and there was nothing I could do and I could say I couldn't go and knock on Howard's door and say listen I went back in the team he just turned around and said well where tell me who I'm leaving out Andy and I'll do it Andy and Graham were brilliant together and it was tragic for Adrian what happened to him and what happened the rest of the season the same for me I lost my place through injury and I got it back through injury to someone else that is the nature of the sport we work in but we listen I never wanted Inchie to get injured or Sharpie they were brilliant together and although I wasn't playing and I was frustrated it was great to see them play the way they were they were brilliant but you did obviously it was awful for Adrian he was 11 goals by December he said when I spoke to him last week that he had been told he was going to be in the next England squad and everything was going and obviously it's over isn't it like that for the season but you got back in and obviously you and Sharp then with a hamfall and we were getting results but down at Leicester was your next goals in the league and you were up front with Trevor Steven that day it was and that was a massive win I had come back inside the World 8 Sharpie had 9 I had 8 on every game I played with 8 on I didn't score I think I went 12 games when I came back in although we were still winning I felt I was contributing but I was contributing but I wasn't scoring I was hitting the bar it just wasn't happening for me but the team was winning so it was ok for Howard to keep me on the side that respect but then when Graham was out at Leicester I took 9 back and I gave Trevor 8 and as soon as I put the 9 on what happens I get 2 big goals big goals that day and off I went on a run where I was scoring goals regularly after that I kept the 9 I wouldn't give Sharpie it back so he had to wear 8 after that and that wore 9 for the rest of the season Outstanding I mean scored one with your right foot as well right foot folly in that one didn't you Well it was not quite a folly Half folly I mean they won a score that taught them was probably better than that but that was a really good goal at Leicester they just got back in at 1-1 as well and we were just it was a big goal and at 1 is the game down there so it was great and I was off and running again and suddenly I believed again I was happy with my first 2 goals for ages and I just couldn't wait to get the playing again I thought well look start coming now and they did so that was good I think I've asked you this before I just want you to remind me because it's back in me you scored that folly I think it's the folly or the half folly but you've run up I think it might have been to Steve Lynex and you're pointing at someone very angrily Andy I was pointing at the linesman we thought Lynex was offside oh ok when he went through we thought Steve and the linesman kept him slagged we were furious and I was going straight over the linesman pointing at him I can't tell you what I said I think I can lift weight it's fine the first part was stuff you I can't lift it I'll leave it at that for the imagination I remember Jimmy Hill I remember Jimmy Hill God bless him when he did the game that night and he was analysing that and he said there's Andy Gray scoring you go and there he is look at him pointing to Howard Kendall saying look I can still do it well Jimmy could have been further from the truth you're right about you got but you know obviously the confidence came back you got a hat against Fortuna Sittard which set us up brilliantly in the cut when there's cut to go over there you've told me stories about that one you shouldn't have been on the bench in that one you were relaxing and you got put on it I'm not going to let you go into that on here but that was another one but a great result over there Ray Peter Eagle over there as well and then you did you went into you got against Arsenal at home and then you've just mentioned it before which was an absolute key result the Tottenham victory away your volley after about 10 minutes there's an absolute screamer and what a big win that was that night that was a great win they were good Tottenham we know that as we say they thumped us 4-0, 4-1 in the opening day and they were the biggest challengers and going into this game I seem to remember we had about we do have 10 games left something like that and they had six at home I think not only four I think we'd be the opposite and I think they believed and so did a lot of pundits at the time they thought they were calling it the league decider, they've taught them win this that will set them up to go and take the title for the first time in so many years if everyone can get something from it that would be a great result for them and we knew the importance of it and it was a mid-week game the place was jumping I mean jumping and it was such a, I remember Martin Tyler interviewed me and Martin said well so I draw satisfy you tonight Andy and I said to him before the game no Martin only wins satisfy this team and he went oh okay and he interviewed me after and he said well you did say that I said Martin to be honest with you we would have taken the draw and I've seen that recently actually I can't remember from the time remember the game obviously but I've seen that interview before and you're very very focused before the game and that line draws won't satisfy us yeah oh a massive game I can't not ask you about Neves save from Mark Falco with a few minutes like oh such a huge save wasn't he well I've said all along I've done so many interviews and talked so many times I think one of the things I said about that save is you know there's all sorts of things when you lead titles and it's not beating United Five one at Goodison you know that doesn't when you lead title it's not those results what wins your title is you know one in two one going into your last minute and a big game that you really need to win and your goalie does that for you not winning titles you know I've talked many times about the Gillian game the year before Tony Cascarino goes through yeah yeah he jumps round to Neves and scores what happens to ever who knows future may have held for us you know we wouldn't have won the FA Cup and who knows what would have happened Neves saved Dr. Mscorin and we won the third replay it's the second replay so these are the things it's the small things that win you the titles you know it's not great results we win four five now four one no it's the list there's a way like that really we dig in and somebody does something special like Neve did that night that's the difference between winning a title and coming second unbelievable but again you know few days we play Sunderland and you score two brilliant diving editors two you know totally different either corner the street end I mean the first one is amazing because it demonstrates how good the football team we were it demonstrates Peter lead Megan someone and using blister and pace and you with a diving editor absolutely brilliant and that to me is one of the iconic goals of that championship side it's whenever we try to sum up that team that's the goal that they show you diving in with it I mean what was it like playing in that team for a centre forward like you you know when you got in that role perfect I mean when you play Graham Sharpe or myself or both of us or one of us you've got two amazing wide players and Shady and Steven, driver Steven you know you're going to get service you've got two full backs you've got terrific delivery and you've got a coach who wants you to play fast attacking football doesn't want you to pass it around the back too often but once you pass it once you pass it with a purpose forward and play fast football and pressure people people have gone about front men pressing now as if it's just been invented Sharpey and I used to put defenders under pressure I used to do it when I was at Villa when I was 19 used to try and win the ball as high as I was told the higher up the pitch you win the football the less distance you have to go to score that's now it's called a gig in press or something like that you know I mean you know rushy rushy spent a life doing it he did he did so we were like that if you were a front man to play and that team was brilliant because you were always involved they always wanted to get the football to the front men as often as we could because why not we'll get goals or we'll get chances yeah but those those two goals first goal I mean the move was great for the first goal I agree with you you know the ball down the line read he's not Megan a Peter Daniels he's balling in your post that was a wonderful football goal but it was an easy header it was a really easy header for you yeah but the second one was a was a really difficult header my weak side it was dipping a bit again braces cross and to get it up anywhere I got it even for me I was surprised at the finish on it that was a much much better header but two great goals I loved them especially at that end oh yeah super obviously this the time recording is the 35th anniversary of by me by me you know I'm doing tonight because I can't remember when the last time I saw the whole game so what I'm doing tonight is when I'm finished with you yeah when I make my dinner it's now 10 to 7 in Qatar okay make my dinner yeah and when you have some food and I'm going to go on YouTube and I'm going to put the whole game on and I'm going to sit here with a small drink and watch it Outstanding I spoke to you ready today same as you I said I'm going to watch oh that's a good idea I might do the same myself because I don't remember we were having a laugh because he was saying to me I remember he said I gave Trevor Steven so much stick that night I don't know if you spoke to Trevor but he said he had a nightmare he had a really bad game Trevor look at that he said no no watch it he said for the first 20 minutes I'm going come on trick, come on wee man after an hour I'm saying get out get out he said he just lost it with him I don't remember that I don't remember Trevor having the poor game you were involved in your own battle that's right because I mean we'd had a great result over in Bayern and we'd have a full team that night we had players missing you know the Olympic stadium we'd come back to Gouldersen it was unbelievable and he remember bunking off school and getting the buster and coming up and getting in the grand about a quarter past five or something and it was incredible and then obviously they score the noise was amazing and they go they score and you'll remember it as a player but silence I think they had 200 in the top balcony but it was silence it was airy as the ball went in wasn't it, it was so strange and what were you thinking a half time I thought we were still in it I mean we knew listen we knew we were against one of the top teams in Europe they were they got pedigree, they got history they got experience, they got great players in the team and this wasn't a dumpling team that were coming over from Germany this was Bayern Munich where the likes of Faf and Sorin Lerbe added to them Kogel was playing I think Lotham Atheist played, a young Lotham Atheist might have played that now, I'm sure he did they were a really top side we were like rag-ass rovers nobody in Germany had heard of any of us until we played them the first game got a nil-nil they would not have heard of any of our players they would but they were about to and they would have been big favourites to win that and especially at one nil at half time they must have thought we'll see this game out quite easily now but they didn't no they didn't I mean obviously you scored a huge goal and we got the two long throws and it amazes me that people were questioning whether your goal it was was a foul and when you went in again do you remember he fat jumped into his own player and you're just there ready to gobble it up aren't you I'm sure he's in a nil-nil there but he does make a mess of it to keep a big mess of it sometimes you know people go on about tactics and they talk about the game and passing it here passing it there but sometimes we knew that they didn't fancy the physical side of it I mean and when I say that as Reedy would tell you if he spoke to him he said I said to me do you remember I said yeah I said it was unbelievable pacing the game he said and it was a war he said it was brutal the word he used to me this afternoon Reedy he said it was brutal Andy and you remember his sock was red he had a massive hole in it but we knew and Howard knew and Colin knew that they're back three like didn't like physicality and they didn't like aerial confrontation and so we said if you don't like that we're going to make sure you get some of it and we had Gary Stevens who could throw the ball in for fun why not use them if the folly would be not to use it so we used it and we took it some time and again and we kept knocking at the door and the door opened you know it fell open and at the end they were we were desperate to get it off it battered and bruised so much it couldn't get off quick enough and there was a few like that there was a few like that and we had your assistant as well don't forget for the thread the through ball for Trevor Stevens sorry assist for the first goal as well by the way I've just mean the refine what a night not a bad night but the third goal obviously the ball to Trevor and that was the that was like the icing on the cake wasn't it when he's knocked that in to kill the game she's just funny when he talks about that I got the ball and I had a touch and then I had another touch and then I had another touch and then I had to make a move so I had another touch well I was just timing my fun so I didn't get offside yeah of course of course but what a lovely finish you see I said to somebody the other day we were winning 2-1 a young team apart from me and Reidie that were on the brink of getting into a semi-final a final of a European Cup for the first time the only time until now and here we had a young boy in the ball on the half railing 9 times out of 10 in a clubbed out of the corner and had me or Sharpie and just eat up time patient controlled it, waited played it to me, I played it to Trevor one touch goal so that's the measure of the team we are they say well you just had that long yeah we had that long at times because we were good at doing that we could do everything, we could battle we could play most things and that goal that goal typified it for me and we could easily have just cleared it Thubbed it in the pitch but she didn't he wanted to make something happen and he made something happen he made the third goal happen and that killed him you scored another massive goal for us at Sheffield Wednesday in the yellow and black hit probably wasn't your cleanest strike at the ball, is that fair to say it was a shocker, it was embarrassing but I'd been having a goal the goalie was an x7 goalie Martin Hodge right he played for Everton he'd been giving me some lip during the game he'd been giving me verbal so him and I had been having a lot of go at each other so and if you don't know if you notice with the goal the perfect that goes in and I turn immediately him before he'd disappear and that was another day though, Neville was at his best I get the ball, I get the plaudits I get the accolades Neve saved us that day one from Veradi the one from Veradi was just unbelievable and that's what I mean that's why it was team in every sense of the word and then I know that massive goalie score and if you're talking about this the other day on Keys and Gray the first goal against Wrapper Vienna the volley with the left foot and Sharpie does really well doesn't he for the goal I had scored the volley with my right foot in the first half a really well worked set play we made how it never lagged offside none of us thought it was offside even Brian Clough Brian Clough who was doing the commentary couldn't believe offside was given there so I had scored one first half with a right foot volley close in and then it's funny but again I said to you it's amazing it goes through your mind in a short spell of time on a football pitch but at that time nothing went through my mind really because I knew the goalie was out because I saw him go at Sharpie and I knew that all I had to do was make good contact not like I did Sheffield Wednesday a couple of weeks before but good clean contact and actually it looked simple and probably for most footballers it should have been simple but it was a cup final it was Europe it was Everton's first ever European final the first goal in the game wasn't the fourth but the first so all these things made it make it difficult but caught it perfectly absolutely perfectly and finished it lovely but there's a move in that match that if anybody watching should watch it it's just before we score the second goal from the corner where I think we have about 30 or 40 passes moving the ball all over the pitch it's a tremendous amount of pass I can't think it's a huge amount anyway for back then when people say we didn't play much and Trevor eventually gets in spins and he keeps making a great save and I think we score from the corner so it's the move just before that have a look at it because it's an unbelievable piece of football from a team that wasn't regarded as playing too much football at times it's fantastic it really is good to watch we're just outstanding at night obviously you just score off the corner Trevor scores and then we have one back doesn't he and then Sheeds with a brilliant finish for the third goal that was typical of that team now we're 2-1 now I'd be sure to be over me I'd be saying a hundred Hail Marys but we're in a second few seconds Sheeds is in and it's bang 3-1 and it was over obviously was that a good night after that? well that night it was fantastic we were miles better than them if the truth be known it wasn't really a con first half we battled they hardly had a kick first half and yet we couldn't score and they had a couple of opportunities second half but we were miles better than them we were just getting back we had to just get back as quick as we could we got back there are many stories about what people did and allegedly did and went to Chinatown and this and the other nonsense absolute nonsense happy and me and a couple of other boys went back to my house and we got back and put the game on we watched it we were just so proud of what we had done I had taped it there you go I had taped it we went back to my house and we watched the game again and that's what we did because we knew we were into the afternoon the next day so we could sleep in so they'd go back come in the afternoon for a bath we went back to my house two or three of us watched the game it was brilliant to do but I know there's a legendary story that Derek Hatton and many of the other boys went to Chinatown that genuinely didn't happen do you honestly think these boys were going to go to Chinatown when they were on the cusp of completing a treble no chance do you think I know what you're going to say but do you think if we would have had a day, two days we'd have been united on the Saturday yeah I do because we were spent we were spent I don't think it was anybody in our team would honestly say they were at 90% on a big pitch let alone 100% on that day it was a game too far I think if we had got a draw if we had held on I think we'd have beaten them in the replay we were better than them that season we were better than them they knew it I think Ron knew it we had thumped them 5-1 we had beaten them at Old Trafford we drew with them at Old Trafford they couldn't beat us and they knew that but they did in a day it was that kind of day there was no extra energy there was no extra energy there for much to push on we would normally have pushed on and destroyed a team that had a player less in us but there was genuinely very little left in any of the tanks and there was not a lot you could do because I think there was only one sub allowed in those days so you couldn't bring three players on to freshen it up it was one sub and that was it so it was a shame and for a bit of time a bit of time it was sad but very quickly it began to sink in what we had achieved and then the trip down Liverpool the sadness very quickly disappeared to one of pride and joy and happiness of what we had all been part of but I think there's not a player I don't believe there's a player who played there doesn't look back and think I wish I do I wish double was amazing being part of history it's amazing it really is but that would have cemented that team and I think it deserved it I think it was good enough to win the treble I think it just fell at the last hurdle and that was a shame because that would have been genuine recognition of something seriously special we weren't good enough anyway but that elevated above all the rest we had done the double before Liverpool and that would have been a big thing with the team we've said before the team somehow fell through the cracks because of whatever reason but we got to the summit and you were sold and I couldn't it's still now me and Padme talking you're a day about it it's still busy were you on the bench in the charity shield weren't you no I think I'd gone are you just gone? I'm sure you were I thought you were on a bit but we just got linke you leaving was just a it's busy absolutely I left before the season started we came into close season we were moving house actually just moving to a new house in Formby and you know I said to my missus don't move in, don't unpack anything else how it's jagged filled up I said no I said he's not coming here with good news I said don't move anything and I could see he was uncomfortable and we had a glass of wine and he just said I just thought I'd bring it to you that I said villa I've made an offer for you oh I said well it's so he said well I just thought because it was villa I'd let you know I said come on Edward I said we won the double won the Europe won the league got beaten the FA cup final won the FA cup the year before love the boys, love you, love Colin, love easy love everybody, love the club, love the fans so I know a lot of that love that I've got around here why do you think I'd want to go back to villa well I just I thought it would if you had wanted to go I've got an opportunity to buy a new cup I said oh you tell me, you want me to go no no no no let's talk about a new deal I said okay whatever and then we had a couple of glasses so listen I'm going to buy a lindicare anyway nice I said okay what do you mean for me he said I'll be sandwiched sharp and and Gary up front and obviously you and then she'll have to just buy your time and I said well and I was heasty I think in hindsight now I should have stayed I should have stayed but there was Heisel there was no Europe and you know I was 29 30 I didn't feel that having had the season we'd had I wanted to go back to playing reserve team football and it was a villa a team I knew and I'd spent four fantastic years at yeah so all that and the fact that I wasn't going to be playing I just said okay I'll make it easy for you I'll go that was that genuine I said I'll go he says I'll get battered I said for this I said good I hope you do and he did he did I got so many letters I mean an obscene amount of letters from Evertonians I still have them to this day about please don't go thank you he said do you know what he wrote to Howard and he wrote to the club when they got sent to me the club sent me a lot in fairness I love Andy so much that if I came home one night and found him in bed with my missus I'd tuck him in to make sure he didn't catch cold there's the love that kind of sums up the relationship I had with the fans there yeah it was great incredible I've got an issue about this because the management position the management story the legend of what actually happened because me again there's something me and Peder talked about often at one stage you were our manager it was reported as you were the Everton manager you were bringing Dwight Joachim you were the Everton manager and things were going to move forward obviously Joe had left and Waggy had had us for a few games and kept us up and then it was Andy Grey's the new manager and Evertonians were very excited by that and then three days later you weren't the Everton manager and you stayed at Sky Show you know what happened what is the truth with that it wasn't three days it was a lot longer than that the truth of the matter is when I met Peter Johnston and Cliff Finch I think Cliff was one of the others it was there and somebody else at Park Foods I went up and when I left home that day my partner at the time I think I'll be manager of Everton when I come back that's exactly what I said to him yeah had Everton offered me the job there and then that day if they were that Finch that was the right man and turned to me and said here's the deal sign it I chatted with him for hours we talked about hypothetically Andy what would you do, how would you see it how would you do it spent hours going through things with him talking about it and it took me completely by surprise because the following day I was due to fly to La Manga to play in a golf tournament a footballer's classic and that was like a six or seven day tournament so I thought well they won't let me go it was the middle of summer you've got to start making plans for the new season this was urgent forever so at the end of the talks lo and behold Peter says well thanks very much for coming up Andy we've got another couple of people to interview we'll be in touch and I thought well wow I thought that's taken me a little by surprise that I didn't realise there was a list of people to be interviewed I thought I was the choice and I was going to be that so I went away to La Manga I talked to a load of people there loads of people in the game respected a lot of them are great news if you take it and if you get offered it others will say don't do it you've got a great job where you are now television is brilliant it's fantastic why would you put yourself in there say we're Severton and before I left Peter Johnson said so obviously Andy everything we've talked about everything absolutely no one every time I picked up a paper in Spain there was another story about me and Everton could only have come from the four people that were in that room so it wasn't me it had to be one of Peter's boys or Peter himself there were leaking stories Andy Gray was never offered the job never once was offered the job I came back Sky obviously had by now and unlike a few years ago they didn't want me to leave at that time and they were desperate for me to stay I had a young daughter who lived in the Midlands she was important in my life as well I had time to think about where was I going to see her if and when I became a coach that would have been more difficult so one or two things had crept into the decision in that week that Peter hadn't said anything and then I came along and when I got back it wasn't everything that called me it was Sky we need to talk to you and they made me an offer which was ridiculous and I hadn't heard from Peter Johnson nothing and I signed the deal then Peter comes out and says can't believe it as he said to Evertonians Andy Gray turned this down I never, I never I don't know what I had done the other problems I had had but I never was offered the job once I was never offered a contract I was never offered payment I was never offered a wage I wasn't had I been offered it the day I went there as I've said because my heart was definitely real in my head I was excited I couldn't believe might be happening I'd have been the manager but because of the time that he lapsed with Peter I think he must have talked to Howard as well for the third time yeah that was what happened Howard and I think somebody else was in the frame and I thought well if he wanted me he could have had me and he could have offered me there and then and things might have been different but they were and that's how that's how it unfolded that's how it unfolded and it was unfortunate the way he moved it out or let it out like that but no I never turned my back at everyone having said I'd be a manager that's absolutely wrong thank you for clarifying so on that do you have any regrets then that you didn't make a decision to be a manager somewhere or not you know what I think I'll always have regrets about not testing myself as a coach I loved the year I had my big role in it he's assisted I loved it I would be lying if I said it it was a brilliant year I learnt so much from the big man and enjoyed working with the players and loved it and that had given me a little feeling of what it would be like and this ever thank you along about four years later five years later so you know it would mean and yes I'll always wonder but I think Everton was right club but I honestly believe it was the wrong time with Peter and Jobs and I think you saw that in the years that followed it was a tough job for anybody as it was for anybody to make a success of it and so yes I'll always wonder you know, Reedy did it he can look back with pride at what he achieved at Sunderland City clubs like that I made the decision to stay in television and at the time for me it was the right one I think it's when I'm sitting in my rocking chair hopefully when this body is not able to move about in any way I will probably still wonder what it would have been like to coach a team that's still you've changed the face of the way we view football so it is what it is isn't it, you were part of something that changed football for a lot of people's show even though you haven't been a coach you have got that other side to where I haven't used show I'm not, you're right you'll probably sit back and go could I have done it to be at the beginning of what happened with the Premier League to be at the forefront of that to be given a cat launch basically to rewrite the analysis book and TV analysis was fantastic without the pressure of getting the result every week it was brilliant I loved it I threw myself into it to be right there to be the first lot to do that was great I massively enjoyed that part of my life as well have to be honest Andy, thank you so much thanks so much for taking a good hour a good hour out your day to sit and chat with me about that so I know you want to go make your tea before you sit down and watch the back of me in the game so thank you so much thanks for joining us see you soon thanks a lot Andy, take care mate stay safe love to everyone take care Andy cheers pal massive thanks there to Andy Gray joining us all the way from Qatar to talk about his Everton career as well as some other subjects notably whether or not he was going to become the Everton manager give this video a thumbs up, subscribe if you haven't and if you want more videos all the videos in full make sure you get over and join us on page and see you later


Okay, I want to start just by saying a thank you, because Jim Fries, I don't know how many conferences have been in that you've organized a lot. He is tireless. And taking a risk and organizing, we have one more, a brand new one with a new group of people and a whole series of challenges. I'm just really impressed. And as you'll find out, he runs a great conference. He has a lot of detail that is really, really nice. So I just want to just, before we start, I was going to say thank you to Jim for organizing this. So this is Steve Jobs. He actually fought to have it think different. I can't stand that. It's got to be think different. Please. Um... Just leave the publisher and he gets all. Okay, so I think that if you don't keep renewing your thinking, well, there's a story in business that if you're not growing your dime, and I think it's the same mentally. I think if you're not growing mentally, if you're not thinking new things, if you're not challenging yourself, then basically you're stagnating your dime in your head. So I think it's kind of a duty to keep challenging ourselves, to keep trying to find new ways to do things. In my own career, I've been through a number of transitions. I mean, I started off, my first programming line was basic. And I really, really enjoyed that. I went to some early OO languages. I did all sorts of stuff. I keep changing paradigms as it goes along. But at the same time, I have been doing OO development of various kinds. Okay, how many people here are younger than 40 years old?  Because I've been doing OO development before you were born. And I got into a bit of a rut, because it was like easy to do. After a while, you learn it, and it becomes instinctual. It becomes tested, and that's how you code. And one of the things that I really love about this last 18 months has been that Elixir has changed the way I think about programming. Not just in terms of like, oh, it's a functional language. It's actually changed my conception of what it means to program. Now, the problem is, I would love to explain that to you. I'm going to try to explain that to you. But it's not easy, because it's kind of like how I think about stuff, and Lord knows how I think about stuff is weird. So I'm going to do my best to explain it to you. However, what I'm not trying to do is to sell you on my way of thinking. That's not what I'm doing at all. Instead, what I want to do is just to show you an example of a way in which the language and the environment have a profound difference on how you think about what you do. All right? So wish me luck. At that point, we're all supposed to say, good luck, Dave. Good luck, Dave. All right, so quite a bit of background. How many people here have done coding in Elixir? All right, less than a majority, good. So I'm not going to sit here and give like an introduction, basic lessons in Elixir. I just want to give a few things just to sort of cement the ideas. First idea is that we have pattern matching. And pattern matching is pervasive in Elixir. So oh, god, that blue is not sure enough to sit. All right, let's already say a equals sine 1. You're not assigning a to 1. You're challenging Elixir to try to find a way to make that true. And it can make it true by associating a value 1 with a. If I have a 2-pole, cd, and I try to match that against 2, 3, then obviously you can do that by associating 2 with c and 3 with d. And so it goes. There's a few less common forms of pattern matching. So for example, we can have the binary join there, Elixir join to rest, matches Elixir rocks. Well, the only way to make that true is if you set rest to be the row rocks. So it's quite subtle to do pattern matching if you do it. And of course, the pattern matching for lists allows you to match either a literary or a list of the fixed number of elements, like I do in the study example there, or you can match a variable length list by matching the head and then the tail. So the head is a single element, and the tail is then the rest of the list. So pattern matching applies there. It also applies here. So for example, I can say go and open a file, and that's going to return a tuple that says either OK, and here's the file, or error, and here's what we're wrong. So I can do pattern matching on that using a case statement. Nothing really exciting there. But that case statement does all the same pattern matching that I could do previously. And we have pattern matching in the functions too. We're all familiar with the pattern matching in name functions, but you also do it in anonymous functions. Anonymous function can have multiple heads inside the function body, and each head has a pattern match. So here, if the first parameter is the acting plus, then that first one's going to match. Otherwise, at this time, the second one's going to match. And then it appears in a common form with negative functions. All right, so let's just review. So pattern matching lets us match based on shape and content. It allows us to destructure data. That is, look inside composite data or structured data and extract and match as individual elements. And loosely, you can say it's recursive, in that you can actually match things inside a match that's going on. So this is a very, very powerful facility. And I'm about to draw a parallel between it and something else that we're all familiar with. So let's just, like, beat the horse to death first. I think, actually, almost every time I've stood up in this room, I've had Fibonacci on the slide somewhere, so to speak. So Fibonacci is a horial chestnut of pattern matching among other things. The cool thing about Fibonacci is, OK, here's the specification, the mathematical specification of Fibonacci, right? Fib 0 is 0, Fib 1 is 1. Otherwise, it's n minus 1 and plus n minus 2. OK, so that's not a big deal. And that very conveniently maps into elixicode. So here we have our magical Fib that has a function called Fib. There are three patterns or three heads to that function. If you pass it as 0, then it returns 0. That's the 1. It returns 1. Otherwise, it returns whatever. And so if you call, I don't know, Fib 10, I guess that's 55. OK, so I don't think dramatic there. So there are many ways of expressing that in elixicode. You could express that like this. You can have one function ahead rather than multiple ones. And then inside that, you could use a case table. Again, we're pattern matching. But we just have now a control structure inside our function. In reality, in terms of executing code, my understanding is that those two are identical. And inside the virtual machine, those two are actually the same code, i.e. it's mapped from one to the other. But it's very different at the source level. You can also choose to write it like that, which might be how a ruby-bob or what a ruby-bob. So if you look at those three, which of them best captures the idea of Fibonacci? The first one, thank you. I think the first one. The rest of them are perfectly valid. The rest of them work perfectly well. But to me, when I write that first one, it mirrors the specification. It mirrors what I've been told to do. And I think that's important from two sides. It's important from the developer's side in that I have a clear and transparent path from what I want to do to expressing what I want to do. But I think it's also clear and probably more importantly clear from some future reader's point of view. Because if they read that, it's going to look like something they can understand, something that they can tie into in this case the Fibonacci specification. So I think that this way of expressing things is expressive. It's clear, it's concise, and it says what we want to do. So I have been trying to work really hard over the last, I don't know, six months, to write programs as if they were specifications. And that has made a dramatic difference in a way I've heard. Now, let me just give you a few more examples. And then I'll get over to the beginning a bit deeper. Specification length of a list. OK, number of entries in a list. Well, an empty list has zero entries. And the other list has one for the front of the list and then the length of the rest of the list. I'll say you calculate the length of the list, but you'll be excited to know. And of course, the implementation of that, the recursive implementation, just follows that spec, right? Literally line for line. So the length of an empty list is zero, but the length of many other lists is one plus the length of the tail. Absolutely nothing surprising there. Man, our favorite map function, one that applies a function to every other in the list. So the map of an empty list is the empty list. The map of a list of the head and the tail is you apply the function to the head and then you append the map of the tail. Again, nothing particularly scary there. And the implementation, you know, trivial, if anyone could write that. OK, so these are going to like trot it out and you'll see people, I'm probably guilty myself, doing blog posts and tutorials that have these kind of examples in them. It's like, oh, OK, so what? So let's try doing something just a little bit more complicated. Let's say we have a list of values. In this case, that number's going to be empty. And we want to run length encoded. So that we're going to look for sequences of the same value and replace those sequences with some kind of remission. So here, if I have three twos in a row, I'm going to replace that with a tuple with two, that's the value, and then three, which is the repeat count. All right, this is not rocket science, but it's a bit tricky. Think about sitting down and coding that in your regular, like a movie or a job or a seashell, whatever you might be doing. And think of the things that you would have to think about. You'd have to think about all these special cases. In particular, there's the end of the list problem. You're going to be able to deal with that special case that you hit when you hit the end of the list. And as an experiment, I sat down and tried coding this up in Ruby, and sure enough, I actually had to bug you the first limitation I had to go back and fix it. All right. So this is where I want to get into the start of that kind of revelation I had. So my input is a list, and there are two special cases in that list. The first special case is if the two, first the head and the second element of that list are the same. And in terms of a pattern match, I represent that by just saying A and A. The same quote variable there means it's going to be the same value. So that will only match a list that has two identical elements to start. And what I want to do is to replace those two with a tuple that has the value of A, whatever that might be, and a tuple. The other special case I've got is if I've only got the tuple at the start of my list, and the next element is the same value as the value I've got in that tuple, then I'm going to replace those two elements with the same value, but M plus one. Yeah? So you can see that operating here is our list. One, nothing special, so it gets copied, but now look, we've got two twos at the start of the list. So we're going to replace them with a tuple, but now we have a tuple whose value is two, and the next number is also two. So now we're going to replace that with two, three. Now nothing special, there's no matches, so that just gets copied down. Three gets copied down. Oh, we've got two of those guys now, so we can form a pair out of those two, et cetera, et cetera. Okay, so that's how it's going to work. So how do we code that? Well, whenever we need to generate a new output from an input, we're going to need some kind of value to put that into, all right? We don't have state that we can just like stick into an instance variable, so the common pattern is we're going to have a helper function, so to encode our list, we're going to call underscore encode, that's our helper function, and we're passing it the output list. So the idea is that we're going to transform the input list into that output list. That's what happens when we finish, when the input list is empty, we need to just basically return the output list, and as is often the case, whenever you're recursing on the head, you're going to have to reverse the output list. This is where it gets interesting. Here's our pattern match to say if the input list has two identical elements at its head, and then any kind of arbitrary tail, then we're going to call ourselves again replacing those two elements with the tuple a comma two. All right? So we're not generating anything in the output yet, we're just moving stuff in the input list. If we have an input list that contains a tuple, which is a repetition of the value a, and the element following that is also that a, then we replace those two in the input list with a n plus one. And then the last case is, okay, anything else we just copy to the output list. That's all we have to do. That just worked. That's just an implementation effectively from the specification. And it just worked for us time. There's an interesting little side effect here. How do you know that this particular program will always terminate? It's actually pretty easy. Because if you look, here are our three significant patterns. So I get the elements, tuple and an element, or just some random element. In all three cases of recursion, we remove that pattern from the list and replace it with something shorter. So in all three cases, our input list is going to shrink in size, so we guarantee you we're going to terminate. There's all sorts of cruel side effects when you start looking at doing it this way. Let me show you another example. This is actually where I got all of this inspiration from, if you like. Because when I start learning a new language, I have little exercises I do, little things that program. Obviously the first one is always a whole little world. And then I'll get into different stuff. So I'll code up binary chops and this kind of stuff. And I really, really, really want to get into a language. My current, I wasn't going to call it my current favorite way of doing it, but it's anything but favorite, is to implement a markdown puzzle. And the reason I do that is that markdown is the ugliest, worst specified, full of special case thing you can think of to try to pass. All right.  So it's really tough to find ways tidally to break down markdown. And so as a result, it's a great way of challenging yourself when you're learning a language to try and find nice ways of expressing things. And this is what blew me away when I was coding millions. Now, this is probably my fourth elixir markdown implementation. It's the first one I actually finished because it's the first one I actually felt, yeah, that's just okay. And it's actually the least on hex as earmark. But anyway, let's imagine you're pausing markdown. So one of the many, many markdown rules, use that word like that, is that a full of heading will be a blank line, some text, a line of underscores, and then another blank line, okay? So that's a particular style of markdown heading. Let's assume that the first thing that you've done is taken your input and divided it into lines and done some normalization, like strip and blanks maybe, or maybe not depending on the stuff like that. So we have an input list, which is a list of lines. Well, here's a rule that recognizes a markdown header. And this is actually not quite like this because I have some stuff in there, but fundamentally that's what I've got in my markdown box. So to parse a list whose head consists of a blank line, a title, a line that starts with underscores on another blank line where the title has a length. Yeah, so then you replace that in the input with, oh sorry, you actually generate that into the output, by heading that has a title. So what have I just done here? I've used pattern matching to parse some syntax, extract out the information I want and then generate an output set, pretty cool. That's pretty cool. Another example, just uglier, but I mean just to show you stripping HTML comments. This is a little two state state machine written purely with pattern matching. So we're switching back and forth between being an outside comment and inside a comment and recognizing our comment start and stop just using a pattern matching. Again, really, really cool. All right, enough of those. The point of this first part is that you can think of pattern matching in every single context you use it as a form of parsing. Now sometimes it's trivial, like A is matched with one, well okay that's a trivial parse, it's just saying I have a single element. But sometimes it's way more complicated. Sometimes it could be a mockdown syntax or it could be error codes returned by file.over. It could be anything, but pattern matching can be considered to be a kind of parse. And our code that uses it is consuming stuff during that parse, during that pattern matching, it's consuming it and it can choose to generate outputs from it or it can choose to modify its future behavior by updating its inputs instead.  We were pushing back onto our input list a tuple if we found two elements the same at the beginning. So we can consume input, we can modify input and we can generate output. And because we can look into lists or other parameters or whatever, we have a degree of looking. I'm not a parser expert, but I'm thinking this is probably something like LLN parsing. Now why is that a big deal? We'll tell you later. So we're gonna come back to that. Second thing I want to talk about is functions. Now we all know that a function is something that transforms data. So the plus function takes two things and adds them together and the sign function takes something and does a sign on it, et cetera, et cetera. Wow, okay, that's not directly. But obviously there are bigger functions, more complex functions as well. So for example, if we were writing some kind of web servering kind of thing and we get sessions data come in, we're gonna want to go through some lookup function to find out who our user is or whatever else might be the case. Or if we have like a shopping cart and some payment information, then we might want to take both of those things through a function called checkout to generate an order. That's not normally how we think about functions. Or at least it wasn't normally how I thought about functions. I tended not to think about checkout as being a transformation from one stuff, one thing to another thing. I just thought about it as being something I did. So my second revolution is this idea that I want to think about everything as a transformation. Everything as being taking my inputs, moving into my outputs, and along the way getting closer to where I want it to be. And that's really useful because you can do really cool things with functions. Now as you know, functions compose. So if I was doing say anagrams, then I'd want to be able to find the signatures of each of my words. And the classic way of doing that is you take the letters in the word and you sort them. So if you had cat, C-A-T, then the signature would be A-C-T. And then any two words that have the same signature are anagrams. So a typical signature function looks something like that. You get the word, just a string.  So here we have, we generate, we use code points because it's a new GF-8 and that's obviously way more complicated than it has to be. And then we sort them and we join them. And being sort of like programmers would say, but wait a minute, we've got all these variables we don't want to use and we might be tempted to rewrite that like this. And the problem with that is that we've lost our functions. We've lost the ability to see what's going on in terms of functions because we have to kind of read this from the inside out.   Got that?  Okay, that's easy.  Now, what are we gonna do? Now, remember that last open parentheses? Now we're gonna skip backwards. We're gonna keep going, keep going to another one. And we're gonna take, whatever the value is from code points and we're gonna pass it. So it's sort of, okay, and he explained like this and explained like this and either we give up or she walks out, right?  It's really complicated. It's unnecessarily complicated. It obscures what we're trying to do. And so elixir, among that, a whole bunch of functional languages allows us to write that instead. Okay, so we can pipe a value through a function and then we can pipe the result of that through another function, et cetera, et cetera, as much as we want. So here, our word is being transformed by code points, then it's being transformed by salt, then it's being transformed by joint. Obviously, the pipeline is nothing more than some syntactic shift, right? All it is is a transformation from that form into the previous form. Nothing better. And yet, it is a profound difference to the way we write code. Come back to the idea of a shopping cart and check out being a transformation and a part of the payment into an order. So you can imagine that we're expressing that here in a pipeline. And we can think about our code purely in terms of transforming data, purely in terms of functions. If you start doing that, it also changes the way you think about programming. So it allows us to express all of our work in terms of transformations. We're no longer telling the machine what to do. We're describing what we want done. And that's actually suckable, it's a big difference. We're separating our data and our functions and we're looking at our code in terms of the flow of data and the transmutation of data by lots of different functions. And that allows us to code way, way closer to the actual problem than that. So, two things. We have the idea that pattern matching is a form of parsing. And we have the idea that functional programming is a series of transformations. So what does that get us to? Well, it gets us, I don't know is the answer. But I want to try and show you where it's got me. And this is where I'm going to get into the kind of like, you know, Dave's crazy part. So forgive me. Let's start with a simple function that looks like this. Okay, so we're getting some kind of response probably like HTTP response just given the numbers. Now it's got a code and a message. If the code is 200, we do nothing. If it's 404, we say not found if it's 500, we do something else. Okay, perfectly valid function. No one could criticize that. Does one thing relatively straightforwardly, no problem at all. But let's think of it instead in terms of parsing and transformation. We could rewrite it like this. Now what we have is one function. Actually the equivalent of that top function, we have one function which will respond appropriately given whatever that code is. Are you going to say, oh wow, that is clearly a better way of writing it in the first form? No, you're not. Because it probably isn't at this point. But this is all part of a build-up, okay, so trust me. So what we've done is we've removed logic from the body of our function and instead turned it into a very, very trivial parse. We're parsing an HTTP response by matching different things in our function heads. We've replaced imperative code with parsing. That's the whole point of this slide. Now, I get really bored writing all these death things. So just as like to save myself time, I actually wrote a little macro called mDeaf. My God, I love the fact that I got a language where I can do that. And so that's actually often the hex if you want to use it, it's called multi-death. But it basically does the same thing, if you say mDeaf format response, it just generates those three function heads. Okay, now it's getting a bit clearer. I kind of like that. So here's a slightly more complicated case. Again, perfect in reasonable code. We want to read a line from a file. So we're going to open the file. Now, the file will open returns a tuple that says okay and there's some kind of device IO for me and in which case we can read from it. Otherwise, we're going to have some kind of error. Yeah, so that's again a perfectly valid, nice little self-contained function. Now, you could argue it does two things. So maybe it should be an error. But I want to think about my world in terms of pausing and transformation. So here, my first step is to say, well the return from file.open is something that I can pause. And so I'm going to split that out. I'm going to say that to read a line, I am going to call my little helper method, underscore your line, and I'll pass it the result of opening a file. And then in my helper method I have a pause to say it's okay, I'll do one thing. If it's not okay, I'll do another thing. Okay? So here, again, I've replaced imperative logic with declarative pause. But I can take that a step further and make it obvious what I'm doing. By using a pipeline to show the transformations that are taking place. The transformation is I'm taking a name and then transforming it into the first line of a file with that name. And by writing it like this, I'll make that explicit. So I have my transformation going that way and I have my pause going down. This is getting interesting, at least to me. Excuse me for doing this. This is actually a code from IEX. It's the code that loads the .iex file, which is the one that does all the initialization if you want to customize your colors and everything else. So what it does is you can pass it explicitly, the path to your IEX file, in which case that's the one that it loads. Otherwise, it's gonna go and look for either a .iex in your current directory or in your home directory. So, first of all, says if you give me a path, then the only candidate is that path. Otherwise, I'm gonna take all of the known names and expand them into a full path name. Then I'm gonna find the first one of those candidates that actually exists as a file. If I can't find one, then I'm gonna return the original conflict. Otherwise, I'm going to merge in that new IEX file into the conflict that gets passed in. Again, an okay function. But there's a fair amount going on in there. I've had to write, or somebody has had to write, some if statements and some conditionals and blah, blah, blah, blah. Can we do that differently? Well, we could do it using transformations and parses. So, it's a little bit like .iex file. The fundamental thing we wanna do is to take a path. We want to go and use that path to find the possible IEX files, find the first one that exists, and then update our conflict from there. That's pretty straightforward. Express is a transformation like that. It's really obvious what we're doing. I think it's easier to read than they want with if statements. Now, to get our IEX files, we're parsing our input. And it's a trivial parse. Our input could either be a name or it could be nil. So, if our input is nil, we're gonna return the list of possibles. Otherwise, we're going to, I should have gotten spammed it all. Otherwise, we're going to find the path. And then to find the first, we just use the existing code. And then finally, we're gonna parse the response of finding that first one. If we find it, we're gonna merge it into the conflict. If we don't find it, we're not. Again, we're replacing imperative logic with pattern matching and transformation. We're beginning to see a pattern here. I think that this is worth exploring. My current lockdown parser is, I think it's about 1,200 lines of code. It has a total of, I think it's 11 imperative statements in it. And some of those I'll have to deal with now. I mean, I could probably get rid of them if I really, really wanted to get rid of them, but it turned out to be actually, I think my search will leave them as imperative statements. But even so, 11 imperative statements have a total of about 1,200 lines of code. And once I've worked this style out, once I've worked out that this is how I wanted to do this, it would believe how much simpler it got, how much easier it was to do. I needed to add, I released the first version and then I wanted to add table support. And it was just the modularization that comes from the parse was so beautiful. I just said, okay, to recognize a table, I have to parse a line to recognize one. A table has to have two successive lines that have the same number of vertical bars. So I can do that as a parse. The whole thing just fell out. It was like half an hour's work. I was expecting that all day, it was about half an hour. It's a phenomenally fun way of coding. It works on all sorts of scales. For example, maybe we're writing some kind of back end service, rest service, and we're doing some kind of site that does deals or coupons or whatever else. So I'm a particular user, or I'm doing it on behalf of a particular user, and they come in through some kind of rest space and all the tokens, so I think I'll find the user, and then for that user, I have to find their local offers, the ones that are around them, and then the kind of national offers like chain stores that are given to discounts or whatever else, and then I have to get those responses, merge them, and send them back down as a response to my rest interface. So this is kind of relatively straightforward stuff when you want to serve it. So I want to think about this now, not imperatively, but I want to think about it in terms of transformations and parsing. Oh, I'd just make it interesting, I'd like to make those two asynchronous. So I'm going to send off the two responses, the two requests to find the local offers, and then we can vote to come back before I send a response down. So it's going to look something like that. All right, this next slide is, I've got to say old slides, this one's ugly, but I still like to think about it a bit, because I can express all of that using pattern matches, and using a few simple transformations. I'm just showing the pattern match part there, I'm not going to show the actual functions to do it, but let's assume it looks something like this. My response comes in, my request comes in, and the little front end thing converts that into a map where it says get offers, and here's the authorization total. And this is probably going to get handled by some kind of gem sort of component somewhere. They're just sitting there handling these things. So the first thing that's going to do is match on that particular map. Actually, that is not just a Christmas default with that door. And the first thing it has to do is find the user. So it's going to respond by saying, okay, so now what I'm doing is getting offers, and I have a user. So it's going to go look up the user from the call and stick it into that map. So now we have a map with two elements in it, one is the request type, one is the user. So now we have a different pattern match. So I'm going to come in now with a second pattern match. So we're just looping around, calling ourselves, trying to pass this response. And we've made our input more complicated. We've added things to our input, just like we did with the run length and coding thing. We've added the user to our input. So now we match that. Now we're going to call two functions, async.local and async.getNational. And they're going to go off and do their business. We're not going to do anything else. We're not recursively calling ourselves at this point. They go off and do their business. And at some point, they send the responses back into our server. And our server is going to use those to update its state, update its input. Now, if the national comes back and says, hey, there was an error, then okay, we're going to throw the whole thing away just to respond with an error. Similarly, if local comes back and says there's an error, then we're going to throw it away. Otherwise, we just need to pattern match the case where we actually have national data and we have little data. And at that point, we can send the response back. If I could work out the time and whatever else, I would love to see some kind of server implementation based on those type principles. It's a server implementation where it gets declarative. Where the rules are obvious. And where what we code is what we want it to do and not all of the little kind of details of happening in coding. Now, this is not new. It's one of my real pet peeves is that as an industry, we have no memory. We keep reinventing things that we've done before. But this goes back to the 1960s. Cobalt programmers used to use decision tables, which were kind of a variant on this. Staying machines again in the 60s are a variant on this. And Glutonous limba, Blackboard system and all the others like that are also a variant in that you put data into the system and then you've pattern matched in order to generate an output. So this is not new. This is nothing, you know, totally radical. But for me, it isn't. For me, it's a different way about thinking when I'm writing code. And I am finding that incredibly powerful. Once you think about things this way, you get all these extra benefits too. It's easily made in parallel. Effectively, you're writing a DSL. And if you think about that previous slide with the maps, that could be considered to be a DSL, but you could wrap that in a really nice little DSL for specifying just as well if you really wanted to. You get phenomenally granular reuse. Because each function, I mean, typically when you're writing code this way, every function is one-on-one. So if you want the ultimate granular reuse, that's it. If you're into testing, clearly you're easier in testing. Because you can hook around with everything, like I said, it's one-on-one, you can test just that one thing. Really nice and easy to do. And you also get control of error handling. I think Bruce, you're going to talk about your type language, right? Oh, okay. But I mean, you can actually start codifying error handling. When you wrote things as a clause, then there are easier ways to handle errors. You can also start thinking about error recovery. I mean, the Pouser literature is full of ways of handling error recovery in a graceful way. We can start using that in our code. Yeah, it's kind of interesting. So I'm not saying throw away your infestations. I'm saying I have. And I'm saying it's really interesting for me personally to have done that. And I'm having a blast exploring or re-exploring what it means to permit. I don't think I'm advocating this as a universal solution for everybody that wants to code. But I'm saying the kind of changes that have its role to me have been so beneficial and so refreshing, I would like everybody else to experience change too. Do it for yourself. Find ways for yourself to think about things differently. I think one of the biggest benefits of elixir is that it is a breath of fresh air for developers. It's an ability to have a fresh start. We can think about things in a different way. And I think if we do that, the most important, if you like, we are a kernel around which this is going to start forming. The 105 people in this room are the starters of it. And we get to set a model direction. When something is so young and so small that every little input is going to be significant, we get a chance to do that. And that's fundamentally exciting. So here is my plea. Some of you may come from the Ruby community. Please, please, do not give us another Rails. Rails works. Rails is cool. So if elixir doesn't have a Rails, therefore we need to do L Rails or something. No, you don't. That's boring. That's being done. And it doesn't solve a problem. Maybe you come from the early on community. And you see this as a way of a better or easier syntax for creating the same applications you'd be creating with Rails. Again, I would say, please don't do that. This is the opportunity we all have to throw away a whole bunch of stuff. We've got a free restart. And that is so cool. So instead of reinventing the past, let's use what we have here. Let's use the power of what we have here to invent a new future. Let's think of cool things we can do with this opportunity. And let's make a difference. And while we're doing that, let's just remember to have fun. So thank you very much. So we have a bit of time for questions. Bruce. Let me throw you a bit of a current ball. In seven more languages, I'm looking at some language evolution, which I think is very much going in this direction. One of the things that, one of the languages is Idris, which does dependent typing. And it seems like the whole dependent typing style maps onto this approach very well. Where basically within your parse transforms, you capture the intelligence about those transforms in your typo. Right. Does that make sense? It does. And I think that for a certain, I'm going to say this, for a certain class of persons, that works well. However, I think once you start getting into dependent type systems, you're only a small step away from the moment. And I think that that's going to be in the depth now. There is a gorgeous, gorgeous, O'Cammel markdown parser. I mean, so it's not a full markdown parser, but it's closed. And it uses a type system to do exactly that parse. And that's really nice. However, it's also not as flexible. Because you can't do all these things like, you know, this is a line of underscores that has to be at least three long, or whatever else it might be, right? These things get tricky. So, I may be wrong, but I find that the type system-based ones are less flexible, and they have a tendency very rapidly to become academic. That's really good. Yeah, I completely agree. And I want to say this might not be the sexiest topic that you've ever given, but these are the biggest thoughts that I've seen when you talk. It's tremendous. Maybe it's not the sexiest topic. I'm worried about that. Anyone else? So, you really like the pipeline operator. I was wondering, so closure has a simple operator, but they only say it once at the beginning, because closure is this point. Would you find that syntax less obvious than some pipeline, but it only leads to the pipeline operator once? Since we seem to be chaining a bunch of them together, it's a semi-remembered way we're using it now. I think right now, maybe just kind of used to it, but I've developed a layout style where I put a pipeline in the beginning of line, so I'll start up with something, and now I'll have pipeline thing, pipeline thing, pipeline thing. And I've come to like that style for two reasons. First of all, it's significant when you look at the code. It stands out. I mean, seeing lines at the start of those characters, I mean, they do kind of jump out of that. So it's easier for me to see the structure of the code that way. The other reason I do that is it's way, way easier to refactor my code if I do that, because each line is a self-contained transform. And if I want to add a transform, I just add a line. If I want to get a line out or change the order, I just swap the lines. So in that respect, it's, for me, it works really well. Now, the closure way of doing things, if you lay it out in the same kind of way, you can do the same kind of things. So in that way, it's kind of like, you know, which particular flavor should it be like. But I kind of like the Elixir way of making it explicit. And then that question, I know you were involved in writing on a document. Are you involved with Exxon at all, or is that something you made? Not really. That was a tool, though. Because you do that. Exxon? Exxon? Yeah. Do I write what, sir? Do you write a lot of box vehicles? Yes and no. Do I write a lot of box from my code? If it's to be used publicly, then I will document the APIs. Because I'm a well-maintained citizen of the community. And if I'm doing something like not obvious, then I'll definitely document that. What I try to do increasingly is to make my code document itself. So for example, I'll go back to it, but that slide right to the IAX thing and bring it into functions with names, to me, helps document that code. And so that's the kind of approach that I would like to take. My personal thing is that once you start putting comments into code and documentation is just comments, once you start putting comments into code, then you now have two things to maintain. People being people, I pretty much guarantee that the comments will be out of date well before the code stop being used. So if I can make the code document itself in a way way better off, it doesn't matter. Is that the time? Yeah. Alright, thanks everybody. Thank you.