McNuggets problem: Difference between revisions

m
→‎{{header|Haskell}}: no need to use uncons
m (→‎{{header|Haskell}}: no need to use uncons)
Line 313:
=={{header|Haskell}}==
<lang haskell>import Data.Set (Set, fromList, member)
import Data.List (uncons)
 
gaps :: [Int]
Line 335 ⟶ 334:
main =
print $
case uncons gaps of
Just (x, :_) -> show x
Nothing[] -> "No unreachable quantities found ..."</lang>
 
Or equivalently, making use of the list comprehension notation:
<lang haskell>import Data.Set (Set, fromList, member)
import Data.List (uncons)
 
gaps :: [Int]
Line 360 ⟶ 358:
main =
print $
case uncons gaps of
Just (x, :_) -> show x
Nothing[] -> "No unreachable quantities found ..."</lang>
<pre>43</pre>
 
Anonymous user