Re: [Haskell-cafe] Re: XML (HXML) parsing :: GHC 6.8.3 space leak from 2000

2008-09-23 Thread Marc A. Ziegert
-- 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

Re: [Haskell-cafe] Haskell Related Reading

2008-06-29 Thread Marc A. Ziegert
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,

Re: [Haskell-cafe] GADT rhymes with cat

2008-03-16 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Why does this blow the stack?

2007-12-21 Thread Marc A. Ziegert
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,

Re: [Haskell-cafe] MonadFix

2007-12-18 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] GUI

2007-12-12 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] New slogan for haskell.org

2007-12-11 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Style

2007-08-24 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Style

2007-08-24 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] #haskell irc channel reaches 400 users

2007-08-22 Thread Marc A. Ziegert
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.

[Haskell-cafe] howto install ghc-6.7.* ?

2007-08-11 Thread Marc A. Ziegert
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:

Re: [Haskell-cafe] creating graphics the functional way

2007-08-06 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Exiting GLUT application

2007-07-31 Thread Marc A. Ziegert
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.

Re: [Haskell-cafe] GHC and GLUT

2007-07-25 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Weird ghci behaviour?

2007-07-21 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] xkcd #287 NP-Complete

2007-07-10 Thread Marc A. Ziegert
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,

Re: [Haskell-cafe] Haskell's partial application (not currying!) versus Business Objects Gem Cutter's burning

2007-07-04 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] found monad in a comic

2007-06-14 Thread Marc A. Ziegert
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

[Haskell-cafe] found monad in a comic

2007-06-11 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] What puts False before True?

2007-05-30 Thread Marc A. Ziegert
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 == (*)

Re: [Haskell-cafe] Memoization

2007-05-27 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] how can I select all the 3-element-combination out of a list efficiently

2007-05-20 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Haskell: the Craft of Functional Programming

2007-05-20 Thread Marc A. Ziegert
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)

[Haskell-cafe] runST $ return () /= runST (return ()) ??

2007-03-24 Thread Marc A. Ziegert
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'

Re: [Haskell-cafe] Stupid newbie question

2007-01-05 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Showing the 1 element tuple

2006-12-19 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Getting my feet wet - small browser game

2006-12-18 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] Why is this array use wrong?

2006-12-16 Thread Marc A. Ziegert
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)

Re: [Haskell-cafe] don't: a 'do' for comonads?

2006-11-09 Thread Marc A. Ziegert
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

[Haskell-cafe] throwing sugar into the void.

2006-05-06 Thread Marc A. Ziegert
[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

Re: [Haskell-cafe] [Newbie] Why or why not haskell ?

2005-12-10 Thread Marc A. Ziegert
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:

Re: [Haskell-cafe] Confused about Cyclic struture

2005-07-07 Thread Marc A. Ziegert
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

Re: [Haskell-cafe] pair (f,g) x = (f x, g x)?

2005-07-02 Thread Marc A. Ziegert
'.' 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