avatarJeremy Roberts

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3392

Abstract

er">17</span>]</pre></div><blockquote id="c020"><p>Compact Map()</p></blockquote><p id="b1c2"><code>compactMap</code> function is similar to <code>map</code>, but it also includes an additional step, it filters out any <code>nil</code> values that result from applying the transformation closure. This is particularly useful when you have an array of optional values and you want to transform them while simultaneously filtering out the <code>nil</code> elements.</p><div id="9cf9"><pre><span class="hljs-keyword">extension</span> <span class="hljs-title class_">Array</span> { <span class="hljs-keyword">func</span> <span class="hljs-title function_">compactMap</span><<span class="hljs-type">T</span>>(<span class="hljs-keyword">_</span> <span class="hljs-params">transforms</span>: (<span class="hljs-type">Element</span>) -> <span class="hljs-type">T</span>?) -> [<span class="hljs-type">T</span>] { <span class="hljs-keyword">var</span> result <span class="hljs-operator">=</span> <span class="hljs-type">T</span> <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> <span class="hljs-keyword">self</span> { <span class="hljs-keyword">if</span> <span class="hljs-keyword">let</span> element <span class="hljs-operator">=</span> element { result.append(transform(element)) } } <span class="hljs-keyword">return</span> result } }</pre></div><p id="fe9c">Here the only change from <code>Map</code> and <code>Compact Map</code> is avoiding the nil value with a condition.</p><p id="3b42">In the above code</p><ul><li>It takes a closure <code>transform</code> as an argument, which specifies how each element should be transformed.</li><li>Inside <code>compactMap</code>, a new array <code>result</code> is created to store the transformed non-nil elements.</li><li>It then iterates over each element of the original array (<code>self</code>), applies the transformation closure to each element, and checks if the result is non-nil.</li><li>If the result is non-nil, it appends the transformed element to the <code>result</code> array.</li><li>Finally, it returns the <code>result</code> array containing all the non-nil transformed elements.</li></ul><blockquote id="9909"><p>How to consume it?</p></blockquote><div id="41f1"><pre><span class="hljs-keyword">let</span> mapArray <span class="hljs-operator">=</span> [<span class="hljs-number">23</span>, <span class="hljs-number">43</span>, <span class="hljs-number">56</span>, <span class="hljs-literal">nil</span>, <span class="hljs-number">75</span>, <span class="hljs-number">9</span>, <span class="hljs-number">14</span>] <span class="hljs-keyword">let</span> result<span class="hljs-operator">=</span> mapArray.compactMap { <span class="hljs-variable">$0</span> } <span class="hljs-built_in">debugPrint</span>(result) output: [<span class="hljs-number">23</span>, <span class="hljs-number">43</span>, <span class="hljs-number">56</span>, <span class="hljs-number">75</span>, <span class="hljs-number">9</span>, <span class="hljs-number">14</span>]</pre></div><blockquote id="854c"><p>Flat Map()</p></blockquote><p id="b656">FlatMap is typically the same as <code>map</code> does, only difference is that it always return flatten array joining all elements. Typically used to collect specific data in n

Options

ested array, dictionary or set</p><div id="6431"><pre><span class="hljs-keyword">extension</span> <span class="hljs-title class_">Array</span> { <span class="hljs-keyword">func</span> <span class="hljs-title function_">flatMap</span><<span class="hljs-type">T</span>>(<span class="hljs-keyword">_</span> <span class="hljs-params">transform</span>: (<span class="hljs-type">Element</span>) -> [<span class="hljs-type">T</span>]) -> [<span class="hljs-type">T</span>] { <span class="hljs-keyword">var</span> result <span class="hljs-operator">=</span> <span class="hljs-type">T</span> <span class="hljs-keyword">for</span> element <span class="hljs-keyword">in</span> <span class="hljs-keyword">self</span> { result.append(contentsOf: transform(element)) } <span class="hljs-keyword">return</span> result } }</pre></div><p id="75fa">In the above code</p><ul><li>It takes a closure <code>transform</code> as an argument, which specifies how each element should be transformed into a sequence.</li><li>Inside <code>flatMap</code>, a new array <code>result</code> is created to store the flattened elements.</li><li>It then iterates over each element of the original array (<code>self</code>), applies the transformation closure to each element, and concatenates the resulting sequences into the <code>result</code> array.</li><li><code>append(contentsOf: )</code> will add the elements of a sequence to the end of the array.</li><li>Finally, it returns the <code>result</code> array containing all the flattened elements.</li></ul><blockquote id="2285"><p>How to consume it?</p></blockquote><div id="117f"><pre><span class="hljs-keyword">let</span> arrayOfArrays <span class="hljs-operator">=</span> [[<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], [<span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>], [<span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>]] <span class="hljs-keyword">let</span> transformedArray <span class="hljs-operator">=</span> arrayOfArrays.flatMap { <span class="hljs-variable">$0</span> } <span class="hljs-built_in">print</span>(transformedArray) output: [<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">6</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">9</span>]</pre></div><h1 id="3bda">Conclusion</h1><p id="057c">There are plenty of other use cases for higher-order functions. This is a gist of what we have discovered today:</p><ul><li>If you need to simply transform a value to another value, then use <code>map</code>.</li><li>If you need to remove nil values, then use <code>compactMap</code>.</li><li>If you need to flatten your result one level down, then use <code>flatMap</code>.</li></ul><p id="0a10">Thank you for your time and attention! 👏👏👏</p><p id="33e6">Do clap👏 if you like this and comment your suggestions!!! <i>Happy coding</i>!!!</p><blockquote id="1e0c"><p>Source Code: <a href="https://github.com/Vikassingamsetty/HigherOrderFunctions.git">GitHub</a></p></blockquote></article></body>

Self-centered actors need not apply: Gratitude from Barney Fife’s loyal gal pal

Eternally typecast for her beloved five-season arc on “The Andy Griffith Show,” Betty Lynn surprisingly expressed few regrets in the half-century since the character-driven comedy bid farewell while perched at No. 1 in the ratings. Tune your rabbit ears to WCTV channel 6 for a complaints-free chat with Tim McAbee, the co-author of Lynn’s posthumous autobiography, “Becoming Thelma Lou: My Journey to Hollywood, Mayberry, and Beyond.”

Resting on a hay bale, freckled redheads Ron Howard [Opie Taylor] and Betty Lynn [Thelma Lou] are kindred spirits in this charming “Andy Griffith Show” publicity shot, possibly taken for “The Rivals,” a season three episode which aired on April 8, 1963. Image Credit: The Andy Griffith Museum in Mt. Airy, N.C.

The Tim McAbee Interview

Who was responsible for your passageway into The Andy Griffith Show, and what exactly turned you into a diehard fan?

I can’t say that anyone was responsible for my interest in The Andy Griffith Show. I remember occasionally watching reruns as a kid, but I began regularly watching them in the early 1990s. I suppose the humor is what I found entertaining initially. I also enjoyed the lessons that we, as viewers, can glean from many of the episodes.

The relationships among the characters was a big part of what I came to love about the show. Whether it was Sheriff Andy Taylor and son Opie, or Deputy Barney Fife and Otis Campbell the town drunk, there are considerable examples of both funny and heartwarming interactions between the characters. The writing is wonderful and still holds up today. And the actors brought the characters to life in such a believable way that the show is truly a classic.

What was Betty Lynn’s most magnetic performance?

Not only was Thelma Lou Betty’s best-known role, but she did such a wonderful job bringing the character to life. Thelma Lou’s down-to-earth practicality was the perfect fit for Barney’s bravado. Thelma Lou was a lot like Betty, especially her kindness and warmth.

In real life you made Ms. Lynn’s acquaintance where?

We spoke by phone when I asked if Betty would call the Southern Nights Theatre in Sevierville, Tenn., on Aug. 5, 1999. I had booked Don Knotts to perform his one-man show, billed as “An Evening with Don Knotts.” It was the first time I had booked Don, or any act for that matter. His performance included some jokes, a few skits [e.g. a jittery weatherman originally honed on The Steve Allen Show in the late ‘50s], and a baseball pantomime routine.

I basically wanted Betty to call at the end of Don’s show during the Q&A segment and surprise him and the audience by letting them hear the call. She was happy to do so, and the audience enjoyed briefly hearing the two of them chat.

Six months later I met Betty in person on January 19, 2000, at the ceremony when Don received his star on the Hollywood Walk of Fame. She was on the sidewalk, and we chatted briefly. Later that day there was a luncheon in Don’s honor, and we spoke again. She invited my friend Chris Osborne and me to join her for some iced tea, and we had a nice visit.

She would later attend some of the Mayberry reunion events that I produced, which led to our friendship. Hearing her stories over the years and encouraging her to share them is how I came to play a small part in the completion of her book.

Just one more spoonful of yummy pie, Barney: Directed by zany Ernest T. Bass actor Howard Morris, “Barney’s Physical” functioned as the second episode of “The Andy Griffith Show’s” fifth season when broadcast on Sept. 28, 1964. Sheriff Andy Taylor [Andy Griffith] weighs Barney Fife [Don Knotts] while the deputy’s long-suffering girlfriend Thelma Lou [Betty Lynn] tries to fatten him up so he won’t lose his job due to new guidelines for law enforcement. In April 2012 yours truly reached out to the Andy Griffith Museum, where Lynn would meet fans once a month. Staffers kindly obtained Lynn’s autograph and mailed to me in Georgia. Her inscription reads, “Hugs & kisses — to Jeremy — Betty Lynn — ‘Thelma Lou.’” Image Credit: CBS / Paramount Pictures / The Jeremy Roberts Collection
For the week of Oct. 17–23, 1964, the Chicago Tribune published a Sunday insert with Aneta Corsaut [Helen Crump] and Betty Lynn [Thelma Lou] getting real cozy with handsome devil Andy Griffith [Sheriff Andy Taylor] on the cover. Image Credit: Tribune Publishing / The Bart Boatwright Collection

It’s not always advisable to come face to face with our favorite Hollywood heroines, who may indulge in self-centered behavior.

From the moment I encountered Betty she was as kind and genuine as anyone I have ever met. She was not at all a self-centered actor. I always found her to be the very opposite. Betty truly cared about others, and it showed. She was humble and grateful for all her blessings and was quick to share what her faith meant to her. Betty was a devout Catholic and very forgiving person.

Just one example of her genuine gratitude for the love fans showed her was her ability to remember the names of so many. And even as years passed she kept up with their growing families because she was truly interested. We laughed at the fact that Betty’s autograph line was always the slowest-moving line at any event. It was because she chose to spend a few minutes with everyone who came to see her. Her gratitude was sincere, and folks knew it.

Did Ms. Lynn trust you and Jim Clark to tell her story from the get-go, or did it take some convincing?

When I first encouraged Betty to do her memoir, she said she did not think the general public would be interested in her life and career. I persisted in bringing up the subject, and she eventually agreed to start recording our sessions.

Did any of Ms. Lynn’s Hollywood pals coax her to pen her memoirs?

I am not aware of any colleagues who prodded Betty, as it seemed that our book request was the first she considered granting. I can verify that Betty never attempted to write her autobiography with any other co-authors.

Betty Lynn autographed this endearing moment to future biographer Tim McAbee on Aug. 7, 2000, backstage at a Pigeon Forge, Tenn., theatre. McAbee brought Lynn, Maggie Peterson Mancuso, the Dillards, and James Best to town for a special “Tribute to Mayberry” variety concert. The previous year McAbee’s First Class Productions came into existence by booking Don Knotts’ one-man show at the Southern Nights Theatre in Sevierville, Tenn. As of June 2022 First Class was still bringing top talent to Southern audiences, including a gig teaming Country Music Hall of Fame alums Connie Smith and Statler Brothers tenor Jimmy Fortune in Franklin, N.C. Image Credit: The Tim McAbee Collection
Don Knotts and Betty Lynn along with Aneta Corsaut and real life flame Andy Griffith promote “The Andy Griffith Show’s” fifth season circa Aug. 1964 on Aunt Bee’s front porch. Left Image Credit: CBS / Paramount Pictures / eBay; On Jan. 19, 2000, Knotts earned a star on the Hollywood Walk of Fame and was feted after the ceremony with a luncheon held at the Four Seasons Hotel in Beverly Hills. Lynn planted an affectionate kiss on Knott’s lips in an homage to the fantastically funny, lipstick-smearing “Up in Barney’s Room” episode from season four. Right Image Credit: Photography by Jim Clark / The Andy Griffith Show Rerun Watchers Club [TAGSRWC]

At what point did you guys officially document Ms. Lynn’s memories?

Interviews commenced in 2004. Basically, Betty shared her life story, and we recorded the sessions and later transcribed them. We chose to use this approach rather than ask specific questions. Occasionally, we clarified a date or name, but we primarily let Betty tell her story as she chose.

Our visits with Betty were sporadic over the years, and there were long periods of time that no work was done on the project. Then, Jim or I would see Betty and pick up where we left off.

At the beginning of 2021 Betty expressed her desire to finish the book. That was the impetus Jim and I needed to get the manuscript in order for her to make final edits. We had a few questions to clarify, and Betty recorded her answers for those questions [Ms. Lynn lived to see her 95th birthday on Aug. 29, 2021. Despite failing health, she gamely served as grand marshal of the Mayberry Days parade in Mount Airy and peacefully died under hospice supervision on Oct. 16].

What subjects were off-limits?

Our approach was to let Betty share what she chose to share. For the most part, Jim and I only clarified dates and names. Betty did struggle with the decision of whether or not to discuss her father. We felt it was important to do so. She only agreed to include him if his name was not mentioned in the book. As you can read on pages 2–6, his abusive actions were the reason Elizabeth Lynn and her 10-month-old baby had to go live with Elizabeth’s parents.

Who knew Betty Lynn could have been a pin-up girl? Lynn began painting ceramic tiles in the summer of 1953 according to pages 135 and 136 of her memoir. The L.A. Times even profiled her knack for the decorative art pieces the following year. She sold a handful but presented most as gifts to friends, colleagues, and fans. Left Image Credit: Pinterest user “Patrick V;” Robert Young, who acted alongside Lynn in her debut film, the 1948 box office hit comedy “Sitting Pretty,” can be seen in the audience rooting for his former costar in this very unexpected shot of a sex kittenized Lynn owning a Los Angeles fashion show runway in 1963. Right Image Credit: The Gilmore-Schwenke Archives / appears on page 233 of “Becoming Thelma Lou: My Journey to Hollywood, Mayberry, and Beyond”
Tom Tryon based his portrayal of the titular character on a real-life Wild West sheriff in Tombstone, Arizona. Here’s a black and white still from “Texas John Slaughter” with Betty Lynn as the sheriff’s second wife Viola. Lynn joined the 60-minute western, part of the “Walt Disney Presents” umbrella anthology on ABC, for nine color episodes between Dec. 18, 1959, and April 23, 1961. Image Credit: Walt Disney Pictures / Surry Arts Council / appears on page 174 of “Becoming Thelma Lou: My Journey to Hollywood, Mayberry, and Beyond”

Besides TAGS, what projects signify Ms. Lynn’s acting range?

I suggest fans watch her first film, Sitting Pretty [1948], with Robert Young, Maureen O’Hara, and Clifton Webb rendering debonair manny Belvedere. Both of her movies with Bette Davis are also good — the comedy June Bride [1948, also notable as Debbie Reynolds’ silver screen debut] and the breakdown of a marriage as depicted in Payment on Demand [1951]. Seeing her as the loyal frontier wife of Tom Tryon in Disney’s Texas John Slaughter is fun and a great instance of her versatility as an actress.

Have you watched all of Ms. Lynn’s IMDB credits, or are some still tangled in the mire?

I have not watched every Betty Lynn movie or TV appearance. She did so much in the early years of television that there is a lot I have not been able to see.

Ms. Lynn was on the precipice of turning 40 years old when “The Return of Barney Fife” indicated her five-year, 26-episode tenure on TAGS was over. Was Ms. Lynn a frequent auditioner in the wake of Knotts departing TAGS for a shot at movie stardom, or was she already typecast as Thelma Lou? Her résumé is few and far between in the latter half of the swingin’ sixties. Inconsequential secretarial turns on sitcoms — i.e. Brian Keith’s Family Affair and Fred MacMurray’s My Three Sons — are as good as it got.

Betty did mention getting typecast, along with most of the other TAGS cast. She also focused on caring for her mother, who was not always in good health.

Why was Ms. Lynn only in four episodes of Andy Griffith’s comeback, the folksy criminal defense series Matlock?

It was after the Return to Mayberry NBC movie-of-the-week that Betty was asked to be on Matlock as Ben’s secretary Sarah. She had played a secretary on Family Affair and My Three Sons, and her concern was that the role of Sarah might become minimal. She offered a couple suggestions about playing a different character but was told that Matlock needed a secretary. Her ideas were not taken. Sure enough, the role of Matlock’s secretary was minimal and she was written off the show midway through season one.

Betty Lynn’s brief guest arc on “Matlock” comprised “The Seduction,” “The Don: Part 1,” “The Angel,” and “Santa Claus,” all first season episodes which aired between Oct. 14 and Dec. 9, 1986. Image Credit: Paramount Pictures / screen grab by “The Andy Griffith Show” Facebook group member Dwayne Stanton

What was the pinnacle and absolute nadir of Ms. Lynn’s life and career?

Without a doubt, Betty considered her years working on TAGS the happiest of her career. She never really mentioned a low point. She talked about times that she was not getting work as an actress and that she considered trying to find other work. But she did not speak of those times as her lowest points. She prayed a lot, and her faith was very important to her.

How much money did Ms. Lynn earn per episode of TAGS, and did she receive residuals?

Each episode was a full week’s work, including rehearsals, etc. Betty was paid $250 per day of filming, which was usually three days. Therefore, she made about $750 for most episodes, before taxes and withholdings. Her net ended up being about $500 for those episodes requiring three days of filming.

TAGS actors were paid for the original broadcast and also received residuals for the first five reruns. That was the standard deal back then. She received just over $100 for the first two reruns of an episode, then she received $50 for the subsequent reruns of that episode. Again, these amounts were before taxes, etc. You can see a copy of one of Betty’s contracts on page 187.

Issued on what would have been Betty Lynn’s 96th birthday on Aug. 29, 2022, the front and rear jacket of the 324-page “Becoming Thelma Lou: My Journey to Hollywood, Mayberry, and Beyond,” as told by Lynn to writers Jim Clark and Tim McAbee. Both Image Credits: BearManor Media / Amazon

Was it an odyssey finding a publisher for Becoming Thelma Lou?

To be honest, BearManor Media was the first publisher we approached about Betty’s manuscript. Jim has a long history with founder Ben Ohmart [i.e. TAGS guest star James Best’s memoir Best in Hollywood: The Good, the Bad, and the Beautiful] and mentioned a potential book by Betty the same year Best in Hollywood was distributed in 2009. Ben was interested then, and luckily, was still interested when it was completed. He made no changes to the manuscript or any other aspect of the book.

Are any in-person events scheduled for book promotion?

Jim and I have each done several interviews, either by phone or video conferencing. The Andy Griffith Museum in Mount Airy had a book launch on the day of its release [Aug. 29, 2022]. And it was a thrill taking part in the 33rd annual Mayberry Days festival in late September, where we met many mutual TAGS fans.

Is a second tome in the cards, and might you and Jim reunite?

There really are no beans to spill at this point. Jim has a few projects in the works, so I know he is not available to collaborate. I do have an idea I would like to pursue, but it is wayyyy too early to mention, since I have not yet discussed with the subjects.

Then-recent “Andy Griffith Show Book” authors Jim Clark [far left] and Ken Beck [far right] are welcomed by Andy Griffith and George Lindsey to the Los Olivos, Calif., location set of the “Return to Mayberry” reunion TV movie sometime between Feb. 11 and 24, 1986. Clark is the “Presiding Goober” of the Andy Griffith Show Rerun Watchers Club and the writer-editor-publisher of the eBullet, the official newsletter of TAGSRWC. Beck spent 31 years as the TV critic for the Tennessean newspaper. Together the journalists have published multiple tomes including “Aunt Bee’s Mayberry Cookbook” [1991], “Goober in a Nutshell” [George Lindsey’s 1995 memoir], “In the Kitchen with Elinor Donahue [1998], and “Mayberry Memories: The Andy Griffith Show Photo Album” [2005]. On his own, Clark teamed up with two-time “TAGS” guest star James Best for his 2009 autobiography, “Best in Hollywood: The Good, the Bad, and the Beautiful,” which paved the way for Betty Lynn’s memoir finding a publication route courtesy of BearManor Media. In 2010 Thomas Nelson Publishing dangled a tantalizing carrot in front of “TAGS” aficionados by distributing the cover of Griffith’s first-ever memoir, “I Appreciate It: My Life,” with Clark listed as the co-writer. However, for reasons that remain shrouded in mystery, the notoriously prickly and private Griffith halted the book. He succumbed to a massive heart attack two years later at age 86. “I Appreciate It” has yet to seen the light of day in any shape or form. Image Credit: The Nashville Ledger

Ms. Lynn was born under a bad sign in one respect. It was deeply troubling and ironic that she was robbed in 2010 after relocating to Mount Airy to escape the crime-ridden City of Angels.

Very much so. I’ll refer you to page 286 of Becoming Thelma Lou for the entire tale. “I had been robbed three times in L.A. — twice on the street and once while shopping at a department store,” Ms. Lynn reminisced. “My home was also burglarized twice in the months right before I finally decided that enough was enough. During the second burglary, the culprits really tore everything apart. I suppose that they were looking for valuables. The house was totally ransacked — a real mess. The combination of the destruction and being made to feel so vulnerable made me scared even to be in the house that I had lived in for almost 60 years…just over three years after I moved to Mount Airy, I was standing outside of Lowe’s grocery store on a Sunday afternoon in April when a man sneaked up on me, snatched my wallet right out of my hands, and ran away. The Mount Airy police caught him a short time later, and I got my wallet back with only a few dollars missing. I just had not expected that kind of thing to happen in Mount Airy. Newspaper headliner writers naturally made the most of the incident: ‘Thelma Lou Robbed in Mayberry’ and so on. It turned out that the man who robbed me lived across the state line in Virginia. As in Mayberry, my crime troubles in Mount Airy came from out of town. That made me feel a little better.”

I had no idea Ms. Lynn was robbed repeatedly. Personally speaking, such traumatic incidents would have roused bitterness — ‘why me, Lord?’ — and other destructive tendencies. She must have had career regrets at the very least.

Sure, Betty got passed over for a few roles she wanted, but I never heard her complain. She had the attitude that she got some roles, which caused other actresses to miss out, and sometimes it was her who missed out. She was always grateful for the parts she landed. A huge lesson I learned from Betty during the process of helping with the book is always having gratitude. She considered herself very blessed and was truly one-of-a-kind. I wish you could have met her.

What’s your hurry? Circa March 22, 2016, 89-year-old Betty Lynn is right at home in a royal blue dress and gold cross necklace. Gripping a black Sharpie, Lynn awaits eager fans inside the Andy Griffith Museum in Mt. Airy, N.C. Image Credit: The Andy Griffith Museum

© Jeremy Roberts, 2022. All rights reserved. Conducted by email, the Tim McAbee interview was sequenced cohesively. To touch base, email [email protected] and mention which story led you my way. I appreciate it sincerely.

Television
Life Lessons
Humor
Books
Interview
Recommended from ReadMedium