question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nthOr headOr lastOr

See original GitHub issue
nthOr :: a -> Int -> [a] -> a
headOr :: a -> [a] -> a
lastOr :: a -> [a] -> a

Gives safe way of extracting a value from a list that can be empty, similar to propOr

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:16 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
jethrolarsoncommented, Mar 3, 2017

For the record, I’m still in support of ramda getting Maybe

2reactions
jethrolarsoncommented, Apr 18, 2017

The head of a sparse array, that’s kinda zen. Like one hand clapping or something

On Tue, Apr 18, 2017, 8:31 AM Scott Sauyet notifications@github.com wrote:

Nothing would indicate that the input was [].

That’s not at all clear to me. Nothing should indicate that the item supplied has no head. But what does that mean with a sparse array without a first element? Should ‘0’ in list; //=> false imply that head(list); //=> Nothing It’s a reasonable alternative.

I understand that since JS can return undefined as a value, the algebraic types need to be able to wrap it. But it becomes uncomfortable when sparse arrays are included. That’s one good reason that in Ramda we’ve always punted on them. But that’s probably not a luxury that Sanctuary can afford.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ramda/ramda/issues/2111#issuecomment-294882664, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-4MoBkyDenottH_h63hbbkvsmYz-Hks5rxNdKgaJpZM4MRx-V .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Thor Ramsey - The Gospel Coalition
Thor Ramsey. ​Thor Ramsey serves as teaching pastor at Canyon Lake Community Church in Canyon Lake, California. He spent more than 20 ...
Read more >
Partridge Community Church Service, January 9, 2022 | Pastor ...
Pastor Sheridan will deliver a message focused on the Epiphany. ... There's nothing inherently special about Thor's. They're
Read more >
Thown Thor - Saint Paul Public Schools
Thown Thor. I am returning for my second year at Harding High School as the business teacher. I joined St. Paul Public Schools...
Read more >
THE BELONGING CO. SETS NEW STANDARDS FOR ...
“We had a great time, good conversation, and were able to answer remaining questions,” says THOR AV's Director of Sales & Marketing, Luke...
Read more >
PAPPG Chapter II - National Science Foundation
2. by the written approval of the cognizant NSF Assistant Director/Office Head or designee. These approvals to deviate from NSF proposal preparation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found