On Fri, Aug 21, 2009 at 7:03 PM, Sebastian
Sylvansebastian.syl...@gmail.com wrote:
I think that there must be standard function that can do this. What do
experienced Haskellers use?
I usually just whip up a quick parser using Text.ParserCombinators.Parsec
I usually prefer ReadP for quick
Hi,
There is a mistake is logBase:
$ ghci
GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude logBase 10 10
1.0
Prelude logBase 10 100
2.0
2009/8/22 Roberto López plasterm...@hotmail.com:
If 4.0 / 2.0 was 1.98, it would be ok?
I think yes. However, hardware can afford to do computations as
accurately as possible, whereas software like Haskell Prelude can't.
The real value of log10 1000 is 3 (3.0). It can be
On Sat, Aug 22, 2009 at 6:35 AM, Peter Verswyvelenbugf...@gmail.com wrote:
I'm going start my very first blog, documenting my everyday struggle to
switch my old imperative mind to the lazy functional setting, with a focus
on FRP.
Although you can find a lot of articles that provide help to get
Thanks. At first sight gitit requires that I setup my own server.
Although this has advantages and I did that in the past, I prefer to use a
public server (actually my internet provider's license forbids hosting a
server)
Does one exist for gitit?
Also Gitit is an unfortunate name since Git It
Thank you for the reply.
Thomas ten Cate wrote:
Although you most certainly can use a State monad, in most problems
this isn't necessary. Most algorithms that you need to solve
programming contest problems can be written in a purely functional
style, so you can limit monadic code to just
On Sat, Aug 22, 2009 at 3:20 PM, staafmeister g.c.stave...@uu.nl wrote:
Thank you for the reply.
Thomas ten Cate wrote:
Although you most certainly can use a State monad, in most problems
this isn't necessary. Most algorithms that you need to solve
programming contest problems can
Hello,
What I do is I write my blog posts using a literate Haskell +
html. This allows me to actually run all the code and make sure it
works. I can then use hscolour to transform the literal Haskell into
html (with syntax highlighting).
As a reader, I think you imagine that I have two distinct
On Sat, Aug 22, 2009 at 3:35 AM, Peter Verswyvelenbugf...@gmail.com wrote:
Could you share your experiences with me about starting a blog?
BTW: I'm on Windows.
I've found it hard work to post a mixture of English, Mathematics and
Haskell. Neither of the most popular blogging web sites are very
Ok. I wonder if someone could help me with this problem...
I want to calculate the number of digits of a positive integer. I was
thinking of ...
numDigits n = truncate (logBase 10 n) + 1
But (logBase 10 1000) = 2.9996 so numDigits 1000 = 2.
Maybe adding a small amount
Use 'round' instead of 'truncate'.
Prelude let numDigits = (+1) . round . logBase 10 . fromIntegral
Prelude map (numDigits . (10^)) [0..9]
[1,2,3,4,5,6,7,8,9,10]
2009/8/22 Roberto López plasterm...@hotmail.com:
Ok. I wonder if someone could help me with this problem...
I want to calculate the
Or better numDigits = length . show
It's probably even faster.
2009/8/22 Eugene Kirpichov ekirpic...@gmail.com:
Use 'round' instead of 'truncate'.
Prelude let numDigits = (+1) . round . logBase 10 . fromIntegral
Prelude map (numDigits . (10^)) [0..9]
[1,2,3,4,5,6,7,8,9,10]
2009/8/22
2009/8/22 Eugene Kirpichov ekirpic...@gmail.com:
Use 'round' instead of 'truncate'.
Prelude let numDigits = (+1) . round . logBase 10 . fromIntegral
Prelude map (numDigits . (10^)) [0..9]
[1,2,3,4,5,6,7,8,9,10]
round won't work because 999 is close to 1000.
You simply need to use logBase
On Sat, Aug 22, 2009 at 12:31 PM, Derek Elkinsderek.a.elk...@gmail.com wrote:
2009/8/22 Eugene Kirpichov ekirpic...@gmail.com:
Use 'round' instead of 'truncate'.
Prelude let numDigits = (+1) . round . logBase 10 . fromIntegral
Prelude map (numDigits . (10^)) [0..9]
[1,2,3,4,5,6,7,8,9,10]
Ouch, my bad. length.show is better :)
2009/8/22 Derek Elkins derek.a.elk...@gmail.com:
2009/8/22 Eugene Kirpichov ekirpic...@gmail.com:
Use 'round' instead of 'truncate'.
Prelude let numDigits = (+1) . round . logBase 10 . fromIntegral
Prelude map (numDigits . (10^)) [0..9]
On Sat, Aug 22, 2009 at 12:56 PM, Dan Piponidpip...@gmail.com wrote:
On Sat, Aug 22, 2009 at 3:35 AM, Peter Verswyvelenbugf...@gmail.com wrote:
Could you share your experiences with me about starting a blog?
BTW: I'm on Windows.
I've found it hard work to post a mixture of English,
On Sat, Aug 22, 2009 at 9:34 AM, Peter Verswyvelenbugf...@gmail.com wrote:
Thanks. At first sight gitit requires that I setup my own server.
That's how the Happstack model works.
Although this has advantages and I did that in the past, I prefer to use a
public server (actually my internet
Hello Roberto,
Saturday, August 22, 2009, 9:19:26 PM, you wrote:
I want to calculate the number of digits of a positive integer. I was
fastest way
digits = iterate (`div` 10) takeWhile (0) length
--
Best regards,
Bulatmailto:bulat.zigans...@gmail.com
Nice tricks!
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
It looks like length . show is faster
Prelude Control.Arrow let numDigits n = length $ show n
Prelude Control.Arrow let digits = iterate (`div` 10) takeWhile (0)
length
Prelude Control.Arrow let n=2^100
Prelude Control.Arrow :set +s
Prelude Control.Arrow numDigits n
301030
(0.39 secs,
Hello José,
Saturday, August 22, 2009, 10:36:33 PM, you wrote:
ghci doesn't optimize
It looks like length . show is faster
--
Best regards,
Bulatmailto:bulat.zigans...@gmail.com
___
Haskell-Cafe mailing list
From: staafmeister g.c.stave...@uu.nl
Thank you for the reply.
Thomas ten Cate wrote:
Although you most certainly can use a State monad, in most problems
this isn't necessary. Most algorithms that you need to solve
programming contest problems can be written in a purely functional
Fellow Haskelleers,
I'm pleased to announce the release of haskell-src-exts-1.1.3.
* On hackage: http://hackage.haskell.org/package/haskell-src-exts
* Via darcs: darcs get http://code.haskell.org/haskell-src-exts
* Report bugs: http://trac.haskell.org/haskell-src-exts
haskell-src-exts is a
Nice!
Does this mean that in the near future trhsx won't strip out all the
haddock comments? That would be great.
- jeremy
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
The following program
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8445#a8445
should echo the ASCII code of each character the user types, on the fly,
with no line buffering whatsoever.
But it doesn't. At least not under Windows's cmd, and even less with msys.
Under Windows, I have to press
On Sat, Aug 22, 2009 at 2:14 PM, Peter Verswyvelenbugf...@gmail.com wrote:
The following program
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8445#a8445
should echo the ASCII code of each character the user types, on the fly,
with no line buffering whatsoever.
But it doesn't. At least not
Okay, I'll file a bug report. Maybe someone else on Windows could confirm
this behavior?
On Sat, Aug 22, 2009 at 11:36 PM, Jason Dagit da...@codersbase.com wrote:
On Sat, Aug 22, 2009 at 2:14 PM, Peter Verswyvelenbugf...@gmail.com
wrote:
The following program
On Sat, Aug 22, 2009 at 2:37 PM, Peter Verswyvelenbugf...@gmail.com wrote:
Okay, I'll file a bug report. Maybe someone else on Windows could confirm
this behavior?
On Sat, Aug 22, 2009 at 11:36 PM, Jason Dagit da...@codersbase.com wrote:
On Sat, Aug 22, 2009 at 2:14 PM, Peter
Yep, that seems to be it. I should first do a search on trac before spamming
here!
But my first reaction when something basic as this goes wrong is blame
myself and ask for help :-)
On Sat, Aug 22, 2009 at 11:40 PM, Judah Jacobson
judah.jacob...@gmail.comwrote:
On Sat, Aug 22, 2009 at 2:37 PM,
Hi all,
I wrote a small library in haskell do deal with oauth authentication. It
turns out it is my first library in haskell as well. As I'm beginner in
haskell, I'm asking for a review of someone more experienced/proficient
before even daring to create a cabal pkg and dist it to hackage. :-)
Even if you are only slightly irritated by offset syntax, why are you using it?
{;} works fine.
On Sat, Aug 22, 2009 at 3:51 AM, John D. Ramsdellramsde...@gmail.com wrote:
Let me put all my cards on the table. You see, I really am only
slightly irrigated by offset syntax. In contrast, I am a
Hi all,
is anyone currently using takusen with odbc on Win32? In particular with
MS Access?
I'm asking because I noticed that when database libraries are declared to
work with ODBC no one seems to mean Win32 ODBC, but rather Unix ODBC.
Günther
On Sat, Aug 22, 2009 at 4:36 PM, Diego Souzadso...@bitforest.org wrote:
Hi all,
I wrote a small library in haskell do deal with oauth authentication. It
turns out it is my first library in haskell as well. As I'm beginner in
haskell, I'm asking for a review of someone more
Yeah, it's broken in windows. Here's the workaround
courtesy of Alistar Bayley. (ticket 2189)
{-# LANGUAGE ForeignFunctionInterface #-}
import Data.Char
import Control.Monad (liftM, forever)
import Foreign.C.Types
getHiddenChar = liftM (chr.fromEnum) c_getch
foreign import ccall unsafe
staafmeister wrote:
Yes I know but there are a lot of problems requiring O(1) array updates
so then you are stuck with IO again
Or use ST. Or use IntMap (which is O(log n), but n is going to max out
on the integer size for your architecture, so it's really just O(32) or
O(64), which is
35 matches
Mail list logo