-- Lazily build a tree out of a sequence of tree-building events
build :: [TreeEvent] - ([UnconsumedEvent], [Tree String])
build (Start str : es) =
let (es', subnodes) = build es
(spill, siblings) = build es'
in (spill, (Tree str
i think, you are looking for this paper:
Functional programming with bananas, lenses, envelopes and barbed wire
http://citeseer.ist.psu.edu/meijer91functional.html
atm, the link is broken or server offline. so here is another reference...
http://doc.utwente.nl/56289/
the paper is pretty cool,
GADTs always reminds me of the japanese word gattsu.
ガッツ == ga-tsu-tsu == gattsu, spoken somehow like gah-t--ts... followed
by a half spoken english u (second half).
gattsu means in english guts.
that in mind, i was just GADDing in StarDict, which translates gatsugatsu
with burning with desire
Am Freitag, 21. Dezember 2007 schrieb Justin Bailey:
Given this function:
dropTest n = head . drop n $ [1..]
I get a stack overflow when n is greater than ~ 550,000 . Is that
inevitable behavior for large n? Is there a better way to do it?
Justin
[1..] equals [1, (1)+1, (1+1)+1,
Am Dienstag, 18. Dezember 2007 schrieb Joost Behrends:
snip
fix f is the least fixed point of the function f, i.e. the least defined x
such that f x = x.
What does least mean here ? There is nothing said about x being a variable
of
an instance of Ord. And why fix has not the type a - (a
Am Mittwoch, 12. Dezember 2007 schrieb Miguel Mitrofanov:
Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's
not native on my Mac; some Mac users don't install it and almost
all Mac users don't always run it.
the problem is Apple. if you want to have a native gui on OSX
i did just read the haskell description from galois [1]. i like
1) ...enabling much higher coding efficiency, in addition to formalisms that
greatly ease verification.
2) All programming languages suffer from a semantic gap:...
maybe we could compose sth similar to 1) to introduce static typed
Marc A. Ziegert [EMAIL PROTECTED]
tm_parallelizable_v1 = \n - sum . takeWhile (0) $ map (div n) fives
where fives = iterate (*5) 1
tm_improved_v1 n = sum . takeWhile (0) $ iterate (div `flip` 5) (div n 5)
tm_fastestIMHO n = let m=div n 5 in if m5 then m else m+tm_fastestIMHO m
whops... i did check it, but
that was a copypaste mistake.
buggy:
tm_parallelizable_v1 = \n - sum . takeWhile (0) $ map (div n) fives
where fives = iterate (*5) 1
should be:
tm_parallelizable_v1 = \n - sum . takeWhile (0) $ map (div n) fives
where fives = iterate (*5) 5
- marc
i interpret it as this:
all [ usage x usage y || fun_to_talk_about x fun_to_talk_about y
| let lang=[minBound .. maxBound] -- C++,Haskell,Java,etc.
, x-lang
, y-lang
, irc_channel_users x irc_channel_users y
]
- marc
Am Dienstag, 21. August 2007 schrieb Albert Y. C.
i just don't get it.
please, can anybody explaim me how to do that?
i tried it the last few days with ghc-6.7.20070807, ghc-6.7.20070809, and
ghc-6.7.20070810.
it always results in a broken library (without Prelude):
# ghc-pkg list
/usr/local/lib/ghc-6.7.20070810/package.conf:
Am Montag, 6. August 2007 00:48 schrieb Frank Buss:
I've created a small program to compose images with combinators:
http://www.frank-buss.de/haskell/OlympicRings.hs.txt
...
look very smooth. And it is very slow, it needs about 40 seconds on my
computer to calculate the image. Using
in old glut, the main loop was the core of the single threaded program. exiting
it did mean to exit the program completely.
in freeglut, you have alternatives. but for compatibility, it defaults to the
old behaviour.
to replace only libglut.so is not enough. if i understand you correctly, you
changed the backend without the API. (you need .h at compiletime, .a (an
archive of .o files) when you link everything to an executable, and .so at
runtime.)
my libglut installation comes with...
/usr/lib/libglut.a
This is ghc 6.6. Anyone else seeing this?
not here.
what do these output:
ghc --version
and
ghci --version
? are they different?
besides that.. why do you use 6.6? may it bee.. is your Unix-like OS sth
between OSX and linux? (i remenber there exists a Gnu/Darwin package manager
without the
Am Dienstag, 10. Juli 2007 00:25 schrieb Albert Y. C. Lai:
http://xkcd.com/c287.html
It disappoints me that there is no solution if each item is used at most
once. However, do change the code to allow multiple uses, then there are
many solutions.
i see only two solutions.
let menu = [215,
exercise done. :D
there is still a problem with the functional dependencies. see last line of
code.
- marc
Am Mittwoch, 4. Juli 2007 14:22 schrieb Conor McBride:
{? * 10 + ?} 4 2 = 42
http://hackage.haskell.org/trac/haskell-prime/wiki/FlexiblePartialApplication
(3) Exercise for
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
http://xkcd.com/c248.html
( join /= coreturn )
IMHO this could be a beautiful and easy way to explain monads.
comments?
- marc
pgpTFyuRioL8Y.pgp
Description: PGP signature
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
Am Donnerstag, 31. Mai 2007 05:52 schrieb PR Stanley:
What is the basic philosophy for Bool being a member of Ord?
you can do sth like
Data.Set.fromList [minBound .. maxBound] :: Data.Set.Set Bool
What justifies False True?
in most interpretations this equals:
False == 0
True == 1
and == (*)
you may want to use a container like Array or Map.
most times i use an Array myself to speed things up like this.
with Map it will either be a bit tricky or you'll need to use an unsafeIO hack.
here are some functions that may help you. my favorites are Array and MapMealey.
- marc
with which model in Combinatorics in mind do you want that function? with or
without repetition?
http://en.wikipedia.org/wiki/Combinatorics#Permutation_with_repetitionthe
order matters and each object can be chosen more than once
i don't know where my copy is or who it has, for years.
but i remember one bad thing... either i missread the following (my english was
not that good) or it is a bug in the book:
(in the first chapter, i guess)
if you have the function
sqr x = x*x
then haskell does reduce the term
sqr (1+2)
hi!
i've just discovered this strange behaviour of existential quantifiers with
runST:
---
Prelude Control.Monad.ST :t runST (return ())
runST (return ()) :: ()
Prelude Control.Monad.ST :t runST $ (return ())
interactive:1:9:
Couldn't match expected type `forall s. ST s a'
Am Samstag, 6. Januar 2007 05:12 schrieb Brian Hurt:
Even better, if I define:
nth 0 (x:_) = Just x
nth i (_:xs) = if i 0 then Nothing else nth (i-1) xs
nth i [] = Nothing
makelist i = i `seq` i : (makelist (i+1))
nth 1000 (makelist 1)
Hi Brian.
i just like to mention another
A weird question, what does the 1 element tuple look like?
there is one in Control.Monad.Identity:
Identity 1
i miss the short version
newtype Id x = x
writing (1,) is not that well defined; how do you want to use its constructor
alone?
writing (1;) may be the solution, i think. (;) could
Comments and suggestions welcome :-)
hi Joachim.
i have some suggestions:
apache:
use fastcgi instead of hacking an own http-server.
http://www.cs.chalmers.se/~bringert/darcs/haskell-fastcgi/doc/
http://www.cs.chalmers.se/~bringert/darcs/cgi-compat/doc/
server:
there are virtual linux servers
b needs a type.
[code]
Prelude Data.Array.IArray :t array
array :: (Ix i, IArray a e) = (i, i) - [(i, e)] - a i e
Prelude Data.Array.IArray let b = array (1,33) [(i,False) | i - [1..33]] ::
Array Int Bool
Prelude Data.Array.IArray :t b
b :: Array Int Bool
Prelude Data.Array.IArray b
array (1,33)
don't :: a
don't = error D'oh!
- marc
Am Donnerstag, 9. November 2006 04:47 schrieb Donald Bruce Stewart:
As seen on #haskell, from an idea by Malcolm,
14:42 ?let top'n'tail = (pre++) . (++/pre)
14:42 lambdabot Defined.
14:43 dons L.top'n'tail foo me now
14:43
[EMAIL PROTECTED]
I'd like to hear some comments about the following ideas; maybe they are
someway obsolete or even useless nonsense.
A few days ago, I thought about abstracting the instance of an object away,
like used in Foreign.Storable.sizeOf::(Storable a)=a-Int, where only the type
of an
hi Christophe.
In terms of speed, is haskell good enough ?
in some cases, optimized haskell may even be faster than C. (that depends on
your C-programming skills. i.e. function-inlining will speed C up, too.) how
possible? look at the mangler:
well, it is a little bit tricky.
you know, imps do not always make what you want.
imp_creates x = x `knot` imp x
where knot = (:)
imagine the following:
you pull a foulard out of your sleeve,
foulard : sleeve
where sleeve = imp_creates foulard
and pull
foulard : foulard
'.' is not always a namespace-separator like '::','.','-' in c++ or '.' in
java.
it is used as an operator, too.
(.) :: (b-c) - (a-b) - (a-c)
(f . g) x = f (g x)
remember the types of fst and snd:
fst :: (a,b)-a
snd :: (a,b)-b
so the function (.) combines
square :: Int - Int
with fst to
33 matches
Mail list logo