..5] (\ x y - mod (x+y) 4)
[(0,4,0,0),(4,5,1,1),(5,3,0,1),(3,1,0,1),(1,3,0,1),(3,2,1,2),(2,3,1,3),(3,5,0,3),(5,4,1,4),(4,0,0,4)]
-}
Have fun!
/BR, Mirko Rahn
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo
quite complex, hard to follow and hard
to debug implementation.
As always, I prefer to write most code in Haskell, quick, easy, nice,
reasonable fast, ... If speed matters, I switch to some lower level
language, as you did staying inside Haskell.
/BR, Mirko Rahn
that a Haskell program that verifies these values will depend on
an external intset implementation. Or uses another data structure, for
example some Set_of_Intervals...
/BR, Mirko Rahn
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
to calculate a_{23448481} = 594261577728 and a_{2500} = 192365946 in
50s and ~1GB memory usage.
/BR, Mirko Rahn
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
for message
passing environments with the capability to send a message to a specific
receiver. I'm quite not sure how to adopt it to the channel-based
environment (except via simulating the message passing environment).
/BR, Mirko Rahn
___
Haskell-Cafe
The Rabbit Sequence:
1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,0,1,1,0,1,1,0,1,0,1,1,0,1,1,0,...
This nasty acquaintance of mine asked the students to write down a simple
procedure which generates the sequence after the infinite number of units
of time. Of course, any finite prefix of it.
In
of
0 - mzero
q - return (q,q)
)
I tend to not use |iterate|, when it is known in advance, which prefix
of the so constructed infinite list is used.
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http
, where others need some help...
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
memcpy()
I like to hear that you would reject it either.
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
rewriting it in Haskell (of any size) is a good idea to actually
understand the code. Please, could you do it.
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
documentation states it very clearly.
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
diff_eq_0 :: Eq a = [a] - [a] - Bool
diff_eq_0 = diff (\ u v - null u null v) (const . const $ False)
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http
lists, btw.
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
). As a consequence my version is faster
and eats less memory.
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell
) -
[ Branch a b | a - the_trees l, b - the_trees r ]
nonempty_splits (x:y:ys) = ([x],y:ys)
: [ (x:l,r) | (l,r) - nonempty_splits (y:ys) ]
nonempty_splits _= []
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn
- insert x part]
all_trees [] = []
all_trees (x:xs) =
let this = Leaf x
more = all_trees xs
in this : more ++ concatMap (insert this) more
/BR
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn
(Leaf 4)
(Leaf 5)))
So please, what's going on here?
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
$ unlines . filter (ubuntu `super`) . lines
BR,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Map.updateLookupWithKey ins y m of
(Nothing,_ ) - mzero
(_ ,m') - return m'
in not . null . foldM upd mx
Thanks for your time,
BR,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn
sorting)
...but is exponentially slower than necessary, and fails on infinite
lists. Try this one:
sublistsN 0 _ = [[]]
sublistsN n (x:xs) = map (x:) (sublistsN (n-1) xs) ++ sublistsN n xs
sublistsN _ _ = []
triples = sublistsN 3
BR,
--
-- Mirko Rahn -- Tel +49-721 608 7504
!
Correct (and more natural):
nOf 0 _ = [[]]
nOf n (x:xs) = map (x:) (nOf (n-1) xs) ++ nOf n xs
nOf _ [] = []
BR,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe
: This statement contradicts your easyness claim!?
Add 2: In contrast, the Haskell solution does'nt uses advanced Haskell
features (whatever this might be), it consists of 6 lines of plain
Haskell 98 only.
Regards,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn
this in your favorite language!
Regards,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
A. understand the problem
B. decompose or reduce it into subproblems
C. solve the subproblems
D. compose a solution from the sub-solutions
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing
constructed function.
Regards,
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
module Main where
import System.Posix.DynamicLinker as DL
import System.Process ( runInteractiveProcess , waitForProcess )
import Foreign.C ( CString , withCString )
import Foreign ( FunPtr
) = [ x:y | x - xs, y - combinations xss ]
BTW, I think 'cross_many' would be a better name.
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org
-type technique first reads all options and then
post-processes the complete set. Here the order of options on the
commandline has no impact on the final result.
Regards, Mirko Rahn
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn
!
Best regards, Mirko Rahn
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
/haskell-cafe/2006-March/014947.html
--
-- Mirko Rahn -- Tel +49-721 608 7504 --
--- http://liinwww.ira.uka.de/~rahn/ ---
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
29 matches
Mail list logo