Skip to Content »

online discount medstore
advair diskus for sale
buy advair diskus without prescription
allegra for sale
buy allegra without prescription
aristocort for sale
buy aristocort without prescription
astelin for sale
buy astelin without prescription
atarax for sale
buy atarax without prescription
benadryl for sale
buy benadryl without prescription
buy clarinex without prescription
clarinex for sale
buy claritin without prescription
claritin for sale
buy flonase without prescription
flonase for sale
buy ventolin without prescription
ventolin for sale
amoxil for sale
buy amoxil without prescription
augmentin for sale
buy augmentin without prescription
bactrim for sale
buy bactrim without prescription
biaxin for sale
buy biaxin without prescription
buy cipro without prescription
cipro for sale
buy cleocin without prescription
cleocin for sale
buy dexone without prescription
dexone for sale
buy flagyl without prescription
flagyl for sale
buy levaquin without prescription
levaquin for sale
buy omnicef without prescription
omnicef for sale
amaryl for sale
buy amaryl without prescription
buy cozaar without prescription
cozaar for sale
buy diabecon without prescription
diabecon for sale
buy glucophage without prescription
glucophage for sale
buy glucotrol without prescription
glucotrol for sale
buy glucovance without prescription
glucovance for sale
buy micronase without prescription
micronase for sale
buy prandin without prescription
prandin for sale
buy precose without prescription
precose for sale
buy cialis professional without prescription
cialis professional for sale
buy cialis soft without prescription
cialis soft for sale
buy cialis super active without prescription
cialis super active for sale
buy cialis without prescription
cialis for sale
buy levitra without prescription
levitra for sale
buy viagra professional without prescription
viagra professional for sale
buy viagra soft without prescription
viagra soft for sale
buy viagra super active without prescription
viagra super active for sale
buy viagra super force without prescription
viagra super force for sale
buy viagra without prescription
viagra for sale
buy celebrex without prescription
celebrex for sale
buy colcrys without prescription
colcrys for sale
buy feldene without prescription
feldene for sale
buy imitrex without prescription
imitrex for sale
buy inderal without prescription
inderal for sale
buy indocin without prescription
indocin for sale
buy naprosyn without prescription
naprosyn for sale
buy pletal without prescription
pletal for sale
buy robaxin without prescription
robaxin for sale
buy voltaren without prescription
voltaren for sale

Tech Life of Recht » Fun with Haskell

 Fun with Haskell

  • January 19th, 2007
  • 2:02 pm

At JAOO 2006, I attended a session with Erik Meijer on Haskell. The session gave a very quick introduction to Haskell as a very nice functional language, and the enthusiasm of Erik Meijer on the subject only made it more interesting.
So, I’ve been messing around with Haskell for a while, without producing anything worthwhile – I’m still trying to figure out how to put the language to good use. However, I found a list of Haskell quizzes, derived from Ruby Quiz. Some of these have not yet been solved, so I sat down and began working on Splitting the Loot. After some hours, I suddenly discovered that I have a working solution – somewhat to my surprise.

Anyways, here it is – as it’s one of my first Haskell programs, I’m sure there’s lots of room for improvement. What it does is basically to find all possible combinations of a list of numbers, and then it tries to combine these combinations in order to find a valid solution:

divide :: Integer -> [Integer] -> [(Integer, [Integer])]
divide persons vals
| toInteger (length vals) < persons = error "Not enough values" | not $ mod (sum vals) persons == 0 = error "Values cannot be divided equally" | otherwise = divide'' persons vals (div (sum vals) persons) [] 1 divide'' persons vals maxval res cnt | cnt > persons = res
| otherwise =
let p = permut vals maxval
nx = findE p maxval
in divide” persons (deleteFirstsBy (==) vals nx) maxval ((cnt, nx):res) (cnt + 1)

findE [] c = error “Unable to find fitting element”
findE xs c
| sum (head xs) == c = head xs
| otherwise = findE (tail xs) c

uniq [] sorted = reverse sorted
uniq xs [] = uniq (tail xs) [head xs]
uniq xs sorted
| head xs == head sorted = uniq (tail xs) sorted
| otherwise = uniq (tail xs) (head xs:sorted)

permut :: [Integer] -> Integer -> [[Integer]]
permut nums maxval = permut’ nums [] 0 maxval

permut’ :: [Integer] -> [[Integer]] -> Int -> Integer -> [[Integer]]
permut’ nums [] _ maxval = permut’ nums (map (\x -> [x]) nums) 0 maxval
permut’ nums xs cnt maxval
| cnt + 2 > length nums = uniq (sort xs) []
| otherwise = permut’
(xs ++ uniq
(sort $
foldr (++) []
[map (\ ys -> appendIfNecessary x ys nums maxval) xs | x <- nums] ) []) (cnt + 1) maxval appendIfNecessary x xs old maxval | elem x (deleteFirstsBy (==) old xs) = if (sum xs) + x > maxval
then xs
else x:xs
| otherwise = xs

9,920 People had this to say...


A piano in a residence or other establishment is taken as treasure and each piece has different emotional worths relying on the owner. If you are a marathon runner, or an Olympic sprinter, you might think twice about walking – otherwise it is no big deal. Beginner bowlers will commence with the conventional grip, as it sanctions for the bowler the maximum grip on the bowling ball without condition like he s organized to skip the ball. “I’ll take care of my side when I’m in here. Start by advertising your business early, which may be a powerful beginning.
Ryan Mallett Jersey


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Tech Life of Recht » Blog Archive » Fun with Haskell


Author Resource:-Experts who recommend these plus size dressing tips admit that high quality branded supportive garments are considered powerful investments, which will pay back in long term. Greenhouses are essential in offering needed methodical ways to grow and develop crops in a more conventional and straightforward way. Freshwater rods and reels are usually smaller, while saltwater fishing needs a more industrial quality rod and reel. Otheras well are examples of pure perfection when it happens to the doing of handbags.You need to give fly fishing a try! Fly fishing is quite different from other systems.
Catfish Hunter Jersey


I purchased wow gold several years ago. Thinking of superior they nevertheless start looking, they are really well worth five stars.
cheap beats by dre

Many people do not pay sufficient attention when they are driving around their community, they do not know how to properly parallel park plus they do a variety of distracting things while they are traveling.The EDA Rhinos, which employed Manny Ramirez, are believed to be involved with the veteran right-hander. James Andrews.Gonzalez Will Remain in Left Field For Rockies – RealGM WiretapThe Colorado Rockies will keep Carlos Gonzalez in left field rather than move him over to center field to replace Dexter Fowler. Its good advice in the beginning, at the very least you can practice on a few people that you do know and perhaps get a few sales under your belt.

Whilst it could take you some extra time to cook the meals, you will help save a ton of money by not having to pay an additional business to make your food items. The flies should be extremely small due to the scale of the mouths of most name is victor cooper i have been teaching folk about discus fish breeders and discus fish information online with more than 15 years expertise. These reviews are from the people who have had encounter working with this insurance company. Be sure to get your friends and family interested in fishing, too.







当店の主要な経営のブランド:ヴィトン ディオール

シャネル グッチ コーチ ロレックスなど.

当店は主に経営する商品:かばん.バッグ .財布 .キーケース. 手帳.腕時計など.


オメガ スピードマスター オートマチック 850


John Ricco did not declare that Wheeler’s latest setback will prevent him from reaching the Major Leagues this season, but he noted time is no longer on Wheeler’s side. This is not cheating, as is the popularized belief about walking while you run. Piano restoration can be costly depending upon the extent of output to be executed.Of course the big secret ( which isn’t actually a secret ) is to find ways to create more qualified leads those people who are actually serious about learning about your business, your opportunity, and your service or product a flow of qualified leads that you and your team will be well placed to handle efficiently. “The next step is to face hitters so I’m excited to do that for sure.
Allen Iverson Jersey


The accessible options as well as places to purchase them are unlimited. Author Resource:-What are the terms of colonial Penn Life insurance? You can visit lifeinsurancecolonialreviews. Raleigh hosts a spectrum of museums, galleries, gardens, parks and historic sites.”sac hermes1store87 » StrongPedia Article Directory – Free article directory.If you have a client who has a birthday, make sure that you send a follow up email that includes a happy birthday message on it.
Gregory van der Wiel Netherland Jersey


This information is priceless. Where can I find out more?
under armour clearance


Aku matikan cerita aku disitu. Salah ke jika kita meluahkan apa yang terbuku dalam diri ini seperti Maisarah, bertanya apa yang berlaku. Air mata mengalir dari tubir mata.鈥?tanyanya. Kenapa? Along dan adik dah makin besar.aku pun mahu masuk tidur juga. Tidak menang tangan dibuatnya.awak tu dah tua lagipun malu dek orang tengok awak merajuk.
Designer Handbags

Read through upon and take in direction of notice the enterprise and the provider that they Deliver. This technique is vastly accepted everywhere in the country.Where’s silica observed:Silica is found in asphalt, brick, cement, concrete grout rock, mud, and tile.95 regular for endless people and purchasers moreover an more $10 regular for infinite digital states billing. The excellent route for greatest buyers is in direction of down load spy ware spyware removing software package toward clear away a virus which include Trojan in opposition to the pc.


I just want to say I am very new to blogs and definitely loved you’re web site. Probably I鈥檓 want to bookmark your website . You surely come with excellent article content. Thanks a lot for revealing your blog.
air force one


look at {pleasing|satisfying|


Tech Life of Recht » Blog Archive » Fun with Haskell


does|just what does|how much does} {make the|result in the|increase the

Want your say?

* Required fields. Your e-mail address will not be published on this site

You can use the following XHTML tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>