Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How to determine & record all possible variations for 5 items? (Haskell)

by kelan (Deacon)
on May 19, 2005 at 14:59 UTC ( #458644=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    partition :: Integer -> Integer -> [[Integer]]
    partition total 1 = [[total]]
    ...
    
    -- then:
    partition 100 5
    
  2. or download this
    partition :: Integer -> Integer -> [[Integer]]
    partition total 1 = [[total]]
    ...
            subpart x = partition (total - x) (numparts - 1)
            numlist = filter twoorfive [total, (total - 1) .. 0]
            twoorfive x = x `mod` 2 == 0 || x `mod` 5 == 0
    
  3. or download this
    allLists :: Integer -> Integer -> [[Integer]]
    allLists n len = ?
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://458644]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-10-02 23:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (13 votes). Check out past polls.

    Notices?