Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by kelan (Deacon)
on May 19, 2005 at 14:59 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found