I'm afraid, but you are missing a case here. For example the tree
Branch (Leaf 1) (Branch (Leaf 3) (Leaf 2))
is not constructed by your program. Correct is
insert x t@(Leaf y) = [Branch s t, Branch t s] where s = Leaf x
insert x t@(Branch l r) = [Branch l' r | l' - insert x l] ++
Jon Fairbairn wrote:
Trees with all the elements of a list in that order:
the_trees [x] = [Leaf x]
the_trees l = zipWith Branch (concat (map the_trees (tail $ inits l)))
(concat (map the_trees (tail $ tails l)))
Sorry, but this problem seems to trigger incorrect
L.Guo wrote:
I have wrote the target function like this, and tested.
mkBlocks (w,h) = map concat . concat . transpose . chop h . map (chop w)
I don't understand how this relates to your original problem
description. But then, again, I probably did not understand that one too
well.
This is
Dan Piponi wrote:
Marc asked:
http://xkcd.com/c248.html
( join /= coreturn )
IMHO this could be a beautiful and easy way to explain monads.
comments?
I'll eat my hat if there isn't a formal way of looking at this. I'm
not qualified to put it together coherently but it goes something like
Hi Janis.
I think either my data format or my original question confuses you.
About the problem description.
When I send the question, I have not decide how to manage the block data.
If the rough question confuse you, I have to say sorry.
About the data.
The whole image is of type [[a]],
Stefan O'Rear wrote:
On Thu, Jun 14, 2007 at 12:38:27AM +0200, Iván Pérez Domínguez wrote:
Hi everyone,
As we all know, FiniteMap was deprecated, and with GHC-6.6 Data.Map
must be used instead. Some function names in Data.Map clash with names
in prelude, and Map is usually imported
Mirko Rahn [EMAIL PROTECTED] writes:
Jon Fairbairn wrote:
Trees with all the elements of a list in that order:
the_trees [x] = [Leaf x]
the_trees l = zipWith Branch (concat (map the_trees (tail $ inits l)))
(concat (map the_trees (tail $ tails l)))
Sorry,
On Thu, 14 Jun 2007, Janis Voigtlaender wrote:
Anyway, as a challenge to others on the list: write a one-liner that
splits an image like [abcd,efgh,ijkl,mnop], interpreted as
abcd
efgh
ijkl
mnop
into the list of images:
[
ab
ef
,
cd
gh
,
ij
mn
,
kl
op
]
It's just an
On Thu, 14 Jun 2007, L.Guo wrote:
About the data.
The whole image is of type [[a]], and after being devided, it is also [[a]].
I would store an image in an (Array (Int,Int)). This is not only more
efficient, but also ensures statically that the image data is rectangular.
I assume that you do
Henning Thielemann wrote:
On Thu, 14 Jun 2007, Janis Voigtlaender wrote:
Anyway, as a challenge to others on the list: write a one-liner that
splits an image like [abcd,efgh,ijkl,mnop], interpreted as
abcd
efgh
ijkl
mnop
into the list of images:
[
ab
ef
,
cd
gh
,
ij
mn
,
kl
op
]
It's
On Thu, Jun 14, 2007 at 11:31:23AM +0200, Iván Pérez Domínguez wrote:
Stefan O'Rear wrote:
On Thu, Jun 14, 2007 at 12:38:27AM +0200, Iván Pérez Domínguez wrote:
Hi everyone,
As we all know, FiniteMap was deprecated, and with GHC-6.6 Data.Map
must be used instead. Some function
Hi all,
I'm playing with signal handlers on Win32. I found a good post on
signal handlers but it works with System.Posix.Signals which on Win32
is empty.
Blog is here: http://therning.org/magnus/archives/285
I tried to adapt this code to GHC.ConsoleHandler, the Win32
counterpart of
I always thought that signal processing must be a good benchmark for
compiler optimizations and optimizer rules of libraries like 'binary' and
'fps'. Many signal processing functions process a signal from the
beginning to the end with a little of state, thus in many cases I expect
that they can
I'm proud to announce an updated version of dons' concurrent urlcheck.
It's a bad and buggy rewrite from scratch. It can check a file of urls or
the consistency of the transitive hull of a website incl. the existance of
the border urls. Futhermore the warnings from TagSoup parsing can be
On 6/14/07, Leif Frenzel [EMAIL PROTECTED] wrote:
Dan Piponi wrote:
Marc said:
Unfortunately that interpretation would have to rely on an equivocation
of 'accessible'.
I was going to deal with that using an isomorphism from the class
Metaphor. You know, the one that also contains the map from
Hello folks
I've recently asked some questions here about some little type hackery
implementing an embedded dsl. But now I wonder if it's worth the
effort at all...
The thing is enforcing static constraints turns out to be quite time
consuming, even for 'reasonble' things. The dsl I'm writing
Well, I eventually came up with this:
-
data Tree = Leaf Int | Branch Tree Tree deriving Show
pick :: [x] - [(x,[x])]
pick = pick_from []
pick_from :: [x] - [x] - [(x,[x])]
pick_from ks [] = []
pick_from ks xs = (head xs, ks ++ tail xs) : pick_from (ks ++ [head
Andrew Coppin wrote:
...is everybody else looking at a different web page to me? *blinks*
Everybody is interpreting it differently. (As usual.)
I see an unsafePerformIO. :)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
What about
blocks w h = concatMap transpose . map (map (chop w)) . chop h
?
@L. Guo:
map concat . blocks w h
is what you want.
Cheers,
Daniel
Am Donnerstag, 14. Juni 2007 09:42 schrieb Janis Voigtlaender:
Anyway, as a challenge to others on the list: write a one-liner that
splits an image
I found my mistake. Through my copy/paste I ended up changing a
readMVar into a takeMVar leaving the MVar empty and having the main
thread blocking to read it.
Changed takeMVar to readMVar in doNothing and everything is working fine now.
Sorry for the noise,
Olivier.
Hi,
I think the FFI Addendum should make explicit that FunPtr values are
stable (in the sense of StablePtr).
I'm writing a Haskell plugin for an application written in C, and the
control flow is:
C-Haskell-C ; C-Haskell-C ; ...
and I was confused by this statement in section 4.1 of
You have brought up prolog, unification, etc .. and knowing this is the
Haskell board, just wondering what anyones thoughts on the hybrid haskell
based language CURRY, for these kind of problems. It seems that it's
development is stalled... and sorry ahead of time if I am wrong on that
point.
Greetings,
I was trying to understand the magic inside Data.Binary, and found two
somewhat suspicious uses of inlinePerformIO, which imho has a far too
innocuous name:
| toLazyByteString :: Builder - L.ByteString
| toLazyByteString m = S.LPS $ inlinePerformIO $ do
| buf - newBuffer
Has anyone embedded a build language in Haskell? Something like
Rakehttp://rake.rubyforge.org/is to Ruby, but in Haskell or any
statically-typed functional language.
Thanks,
Greg
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Greg Fitzgerald wrote:
Has anyone embedded a build language in Haskell? Something like Rake
http://rake.rubyforge.org/ is to Ruby, but in Haskell or any
statically-typed functional language.
The closest I've seen is a tiny snippet from a blog posting:
Hi all,
Jason and I have been working on getting GADT type witnesses into darcs,
and have run into a puzzling error. For the life of me, I can't see how
this is an actual error, to the point that I'm wondering if it's actually a
bug in ghc. You can check out the code and reproduce this with
well, i see sth like this:
data IceCream = EmptyCone | Vanilla | Strawberry | Wasabi | ...
data Hypothetical a = ...
instance Monad Hypothetical where -- one Functor and two Natural
Transformations:
fmap :: (a - b) - (Hypothetical a - Hypothetical b)
return :: a - Hypothetical a
join
On 6/14/07, David Roundy [EMAIL PROTECTED] wrote:
src/Darcs/Patch/Show.lhs:50:0:
Quantified type variable `y' is unified with another quantified type
variable `x'
When trying to generalise the type inferred for `showPatch'
Signature type: forall x y. Patch x y - Doc
I was able to install the ghc binary for solaris x86, but darcs fails
on configure:
configure:2718: ghc -o conftest conftest.hs
ld: fatal: symbol `GHC_ZCCReturnable_static_info' in file /opt/local/
lib/ghc-6.6.1/libHSrts.a(PrimOps.o): section [1] .text: size 8212:
symbol (address 0x2014,
On Fri, 2007-06-15 at 01:03 +0200, Udo Stenzel wrote:
Greetings,
I was trying to understand the magic inside Data.Binary, and found two
somewhat suspicious uses of inlinePerformIO, which imho has a far too
innocuous name:
It's not really supposed to be a public api. We've decided to rename
On Fri, Jun 15, 2007 at 06:46:11AM +0100, Duncan Coutts wrote:
On Fri, 2007-06-15 at 01:03 +0200, Udo Stenzel wrote:
The other occurence is:
| unsafeLiftIO :: (Buffer - IO Buffer) - Builder
| unsafeLiftIO f = Builder $ \ k buf - inlinePerformIO $ do
| buf' - f buf
| return
31 matches
Mail list logo