Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-30 Thread Christopher Done
On 30 August 2011 06:46, Albert Y. C. Lai tre...@vex.net wrote:
 In #haskell, we came up with the idea of running two instances of ghci. Try
 loading in one instance first; if good, commit to the other instance too; if
 bad, you still have the other instance in a functional state. Presumably,
 this should be automated by some middleware.

See my post from two days ago.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHC API question

2011-08-30 Thread Christiaan Baaij
Hi,

 This is what I've was referring to in my previous mail. Even though
 you're compiling to machine code, you are using the in-memory linker
 (i.e., the GHCi linker).  It seems like that this is a fundamental
 limitation of the internal linker. You may be using it in a way that
 doesn't trigger the sanity check and end up causing a panic.

I had similar problems when trying to profile an executable that was 
using certain parts of the GHC API [1]. If you are using parts of
the GHC API that are related to the GHCi profiling API bug [2],
then you will get errors/segfaults. AFAIK, a better error message
was never implemented for GHC API users, only for building GHCi in
profiling mode.

-- Christiaan Baaij

[1] http://hackage.haskell.org/trac/ghc/ticket/3285
[2] http://hackage.haskell.org/trac/ghc/ticket/2197

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] bitSize

2011-08-30 Thread Thomas Davie
That's reasonably believable – streaming units on current CPUs can execute 
multiple floating point operations per cycle.
if (*ra4 != 0xffc78948) { return false; }

On 30 Aug 2011, at 02:30, Richard O'Keefe wrote:

 
 On 29/08/2011, at 10:32 PM, Maciej Marcin Piechotka wrote:
 
 According to random side (http://gruntthepeon.free.fr/ssemath/) not so
 new computers can compute 15.5 milions of serial logarithms per second
 (62 millions in total). I'd say that overhead of Integer might be much
 bigger then cost of logarithm.
 
 That's floating-point logarithms, not Integer logarithms.
 Single-precision floats, at that.
 
 The code in question does not link at optimisation level 4.
 At least some of the benchmark results are impossible to believe:
benching  cephes_sinf .. 
- 12762.3 millions of vector evaluations/second
-   0 cycles/value on a 2000MHz computer

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-30 Thread Christopher Done
Oh, I didn't reply all. Whoops.

On 28 August 2011 13:40, Christopher Done chrisd...@googlemail.com wrote:
 On 27 August 2011 22:59, aditya siram aditya.si...@gmail.com wrote:
 I would like for the GHCI interpreter to save its environment before
 reloading a file and allowed the user to revert back to that state if the
 compilation was unsuccessful.

 Many times I've changed files, loaded them, hit a compilation error and
 needed, for example, the inferred type signature of some function. Even
 though that function hasn't been changed I have to either fix my code, undo
 a bunch of changes or comment out the last change I made and reload in order
 to do a :type on the function. This really breaks the flow of development.

 This has been bugging me for a long time and it's been on my TODO list
 for haskell-emacs: https://github.com/chrisdone/haskell-emacs

 I just implemented it. http://i.imgur.com/A71T5.png

 I just run two ghci processes, one for compiling, one for merely
 loading the code in when the former succeeds.

 It's not a very pleasant hack but in conjunction with :set
 -fobject-code it is fast and does not consume that much more memory.
 Considering tibbe's report is 4 years old, I think this solution is
 better than nothing.

 Set hs-config-preliminary-load-file to t in hs-config.el and it will
 do a preliminary load in a separate GHCi process.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Decompressing and http-enumerator

2011-08-30 Thread Herbert Valerio Riedel
On Mon, 2011-08-29 at 16:50 +0100, Colin Adams wrote:
 On 29 August 2011 16:45, Michael Snoyman mich...@snoyman.com wrote:
 chunked is the only valid transfer-encoding[1], while gzip
 must be
 specified on the content-encoding header[2]. For a simple
 example of
 these two, look at the response headers from Haskellers[3] in
 something like Chrome developer tools.
 
 [1]
 http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6
 [2]
 http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5
 [3] http://www.haskellers.com/
 
 Well [1] contradicts your claim:
 
 The Internet Assigned Numbers Authority (IANA) acts as a registry for
 transfer-coding value tokens. Initially, the registry contains the
 following tokens: chunked (section 3.6.1), identity (section
 3.6.2), gzip (section 3.5), compress (section 3.5), and
 deflate (section 3.5). 

This added paragraph was actually one of the major changes between
RFC2068 and RFC2616, in order to enhance the Transfer-Encoding field
to become full-fledged as the Content-Encoding field was, as the
previous definitions were deemed to have significant problems.[1]

So, using 'Content-Encoding: gzip' was required before RFC2616... but w/
RFC2616 'Transfer-Encoding: gzip, chunked' becomes possible too...

It's also been a long standing bug/deficiency in Firefox[2].


So, RFC2616 differentiates between the 'entity' (= the actual
information content, mostly end-to-end) and the 'message' (= transfer
wire format, mostly hop-by-hop). The content-* headers pertain to the
'entity', whereas the transfer-* headers describe the 'message' format.

But I have to admit, that we have an unfortunate situation here, where
the real-world implementations of RFC2616 don't follow the intent of the
RFC (or alternatively: they implement the obsolete RFC2068). And I'm
well aware that a 100% compliant RFC2616 implementation most likely will
cause a lot of trouble in terms of interoperability... maybe the
HTTPbis[3] effort will improve on the situation...


Long story short: HTTP client libraries should be flexible enough to let
the client-code decide whether transparent decoding of the specified
Content-Encoding is desired or not.


 [1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.6.3
 [2]: https://bugzilla.mozilla.org/show_bug.cgi?id=68517
 [3]: http://tools.ietf.org/wg/httpbis/


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Sönke Hahn
Tony Morris wrote:

 Pointed f = Pointed (StateT s f)
 
 but not
 
 Applicative f = Applicative (StateT s f)

I see. So StateT cannot be what you could call an applicative transformer. 
(Unlike for example ReaderT.)

Thanks.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] [CUFP 2011] Birds of a Feather sessions

2011-08-30 Thread Ashish Agarwal
=

Birds of a Feather sessions (BOFs)

 Commercial Users of Functional Programming Workshop (CUFP 2011)

http://cufp.org/bofs-2011
  Tokyo, Japan, September 22 - 23

=

Following last year's success, CUFP 2011 will again include Birds of a
Feather sessions. BoFs provide a place for our community to gather
informally at CUFP and reach consensus on matters of importance. Any CUFP
attendee can propose a BoF session, and grab one of the spare rooms to hold
a discussion. Attendance in the evening is open to all.

BoF sessions facilitate ad-hoc discussions and provide a place to gather and
start off the chat, before moving on during the evening to a local
restaurant or pub. There is no deadline for proposing a session, but we
encourage you to do so at the earliest possible time to help us with
planning and to publicize your proposed discussion. Attendees are also free
to show up even if you have not confirmed, but again earlier confirmation
will help us with planning.

Please see http://cufp.org/bofs-2011 for details on how to propose a BoF
session or confirm attendance at one of them. Scheduled BoFs will be listed
here as they are confirmed.

General information on CUFP 2011 can be found at
http://cufp.org/conference/2011. The conference is co-located with ICFP. You
can register for CUFP at the main ICFP website
http://www.icfpconference.org/icfp2011.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] installing/reinstalling haskell platform with profiling enabled on windows

2011-08-30 Thread MH
How can I install/reinstall haskell platform with profiling enabled on
windows?
Or the other way to put it, how can I install/reinstall haskell platform on
windows with my own cabal options?

I googled on it and didn't find any solutions for windows OS.
Thanks,

Malik
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-30 Thread Daniel Patterson
Chris, this is amazing! One question - do you have support for tramping in and 
running ghci remotely (or would that be easy to add)? I primarily develop 
inside virtual-machines, so while the source code lives where emacs lives, all 
the libraries are installed inside the virtual-machine (and the source also 
lives there, of course). 

On Aug 30, 2011, at 4:46 AM, Christopher Done wrote:

 Oh, I didn't reply all. Whoops.
 
 On 28 August 2011 13:40, Christopher Done chrisd...@googlemail.com wrote:
 On 27 August 2011 22:59, aditya siram aditya.si...@gmail.com wrote:
 I would like for the GHCI interpreter to save its environment before
 reloading a file and allowed the user to revert back to that state if the
 compilation was unsuccessful.
 
 Many times I've changed files, loaded them, hit a compilation error and
 needed, for example, the inferred type signature of some function. Even
 though that function hasn't been changed I have to either fix my code, undo
 a bunch of changes or comment out the last change I made and reload in order
 to do a :type on the function. This really breaks the flow of development.
 
 This has been bugging me for a long time and it's been on my TODO list
 for haskell-emacs: https://github.com/chrisdone/haskell-emacs
 
 I just implemented it. http://i.imgur.com/A71T5.png
 
 I just run two ghci processes, one for compiling, one for merely
 loading the code in when the former succeeds.
 
 It's not a very pleasant hack but in conjunction with :set
 -fobject-code it is fast and does not consume that much more memory.
 Considering tibbe's report is 4 years old, I think this solution is
 better than nothing.
 
 Set hs-config-preliminary-load-file to t in hs-config.el and it will
 do a preliminary load in a separate GHCi process.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Conal Elliott
I suspect this definition is what Sebastian meant by converting back and
forth to ordinary lists.

2011/8/29 Ryan Ingram ryani.s...@gmail.com



 On Sun, Aug 28, 2011 at 8:24 PM, Maciej Marcin Piechotka 
 uzytkown...@gmail.com wrote:

 f `fmap` FList g = _|_
 f `fmap` FList g = map id
 f `fmap` FList g = map _|_
 (+ variation of _|_*)


 f `fmap` FList g = \bs - map f (g []) ++ bs



 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-30 Thread Christopher Done
On 30 August 2011 17:48, Daniel Patterson lists.hask...@dbp.mm.st wrote:
 Chris, this is amazing! One question - do you have support for tramping in 
 and running ghci remotely (or would that be easy to add)? I primarily develop 
 inside virtual-machines, so while the source code lives where emacs lives, 
 all the libraries are installed inside the virtual-machine (and the source 
 also lives there, of course).

So either

1) You put all your source files on the server, too and then run the
GHCi process under tramp and access the files via tramp.

2) Sounds like you'd prefer to keep your files local, which, I suppose
means you want to send code to the server when you trigger a compile?

Could be done, could be done. I'll ponder it.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Project Euler: request for comments

2011-08-30 Thread KC
You might like this zipping  folding version.

Explicit recursion has the disadvantage that one has to read the
entire function in order to figure out what's going on; whereas using
the higher order functions makes things much easier to grasp.

listof4tuples xs = (zip4 xs (tail xs) (tail (tail xs)) (tail (tail (tail xs

prods xs = map prods4 (listof4tuples xs)

prods4 (t,u,v,w) = t*u*v*w

maxprods4 xs = maximum $ prods xs

On Mon, Aug 29, 2011 at 9:40 AM, Oscar Picasso oscarpica...@gmail.com wrote:
 Got it.

 f :: [Int] - Int
 f (t:u:v:xs) = helper t u v xs

 helper :: Int - Int - Int - [Int] - Int
 helper t u v (w:ws)
  | ws == []  = t*u*v*w
  | otherwise = max (t*u*v*w) (f (u:v:w:ws))

 I tend to overlook mutual recursion in my toolbox.

 Thanks for the nnlightenment.

 On Sun, Aug 28, 2011 at 4:54 PM, KC kc1...@gmail.com wrote:
 Try something like the following:

 -- Project Euler 11

 -- In the 20×20 grid below, four numbers along a diagonal line have
 been marked in red.

 -- snip

 -- The product of these numbers is 26 × 63 × 78 × 14 = 1788696.

 -- What is the greatest product of four adjacent numbers in any
 direction (up, down, left, right, or diagonally) in the 20×20 grid?


 import Data.List

 -- Doing the one dimensional case.
 f011 :: [Int] - Int
 f011 (t:u:v:xs) = f011helper t u v xs

 f011helper :: Int - Int - Int - [Int] - Int
 f011helper t u v (w:ws)
    | ws == []  = t*u*v*w
    | otherwise = yada nada mada

 -- What are yada nada mada?

 -- The 20x20 grid case will become:
 f0112D :: [[Int]] - Int
 -- where [[Int]] is a list of lists of rows, columns, major diagonals,
  minor diagonals.




 On Sun, Aug 28, 2011 at 5:10 AM, Oscar Picasso oscarpica...@gmail.com 
 wrote:
 No. The answer I posted is not good.
 It worked, by chance, on a couple of small examples I tried but it
 could end up comparing sequence of 4 numbers that where not initially
 adjacent.

 On Sun, Aug 28, 2011 at 12:32 AM, Oscar Picasso oscarpica...@gmail.com 
 wrote:
 Maybe this?

 f x@(a:b:c:d:[]) = x
 f (a:b:c:d:e:ys)  = if e = a
                   then f (b:c:d:e:ys)
                   else f (a:b:c:d:ys)

 On Sat, Aug 27, 2011 at 8:26 PM, KC kc1...@gmail.com wrote:
 Think of the simplest version of the problem that isn't totally trivial.

 e.g. A one dimensional list of numbers.

 What would you do?

 Note: you only want to touch each element once.

 The 2 dimensional case could be handled by putting into lists: rows,
 columns, major diagonals, and minor diagonals.

 This isn't the fastest way of doing the problem but it has the
 advantage of avoiding indexitis.


 On Fri, Aug 26, 2011 at 6:15 PM, Oscar Picasso oscarpica...@gmail.com 
 wrote:
 Like:
 20*19*21*18
 is bigger than
 100*100*3*2
 ?

 If so I need to think about how to formalize it.

 Thanks for the hint.

 On Fri, Aug 26, 2011 at 8:55 PM, KC kc1...@gmail.com wrote:
 Is Problem 11 the 4 consecutive #'s problem?

 If so what must be true for 4 #'s to have a large product?

 Hint: x * y * z * 2 is that going to be larger?

 --
 --
 Regards,
 KC





 --
 --
 Regards,
 KC






 --
 --
 Regards,
 KC





-- 
--
Regards,
KC

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Ambiguous module name `System.Directory'

2011-08-30 Thread John Millikin
Note that once you upgrade it (to =0.4), you'll still need to remove the 
older version to fix the error.

I wish cabal-install defaulted to hiding every package it installs. The 
current behavior of exposing every installed module is unreasonable and 
confusing. Packages should be namespaces, not just installation aliases.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Off-topic: Mathematics

2011-08-30 Thread Andrew Coppin

On 29/08/2011 01:13 PM, Christopher Done wrote:

There's also #math on freenode, but it's a scary wilderness.

On 29 August 2011 13:34, Benedict Eastaughionf...@gmail.com  wrote:

On 29 August 2011 09:34, Andrew Coppinandrewcop...@btinternet.com  wrote:

This is fairly wildly off-topic but... does anybody know of a good forum
where I can ask questions about mathematics and get authoritative answers?


Apart from math.stackexchange.com and mathoverflow.net, which people
have already mentioned, people often discuss mathematics on
#haskell-blah on Freenode.


I know of several places where I can ask maths questions and half a 
dozen people will take guesses at what the correct solution might be. I 
haven't yet found anywhere where I can say when would a chi-squared 
test be more appropriate than a KS test? and get an informed, 
knowledgeable answer. (Answers from people who /know/ what they're 
talking about rather than just /think/ they know.)


Anyway, from this thread I've got the names of a few places to start 
looking. And that's really what I was hoping for. Thanks for the tips.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Off-topic: Mathematics and modesty

2011-08-30 Thread Jerzy Karczmarczuk

Andrew Coppin :
I haven't yet found anywhere where I can say when would a chi-squared 
test be more appropriate than a KS test? and get an informed, 
knowledgeable answer. (Answers from people who /know/ what they're 
talking about rather than just /think/ they know.)



With all my respect:
I think I know several mathematicians who learning that a person asking 
for help begins with trying to distinguish  between knowledgeable, and 
those who just think they are, will simply - to say it politely - refuse 
to engage.
(There might be some impolite answers as well, but you don't need the 
details).


Jerzy Karczmarczuk



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Off-topic: Mathematics and modesty

2011-08-30 Thread Chris Smith
On Tue, 2011-08-30 at 20:58 +0200, Jerzy Karczmarczuk wrote:
 With all my respect:
 I think I know several mathematicians who learning that a person asking 
 for help begins with trying to distinguish  between knowledgeable, and 
 those who just think they are, will simply - to say it politely - refuse 
 to engage.

I don't agree with this.  It's the most natural thing in the world to
listen to an answer and then try to figure out whether the speaker knows
what they are talking about or not.  Those who expect us to forego that
step aren't really engaged in mathematics any more.

-- 
Chris Smith


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Text.Parsec.Prim

2011-08-30 Thread Albert Y. C. Lai

On 11-08-29 12:35 PM, Roly Perera wrote:

Cool. I assumed that since I already had Parsec installed as part of
the Haskell Platform it wouldn't have made any difference, but
actually it sorted it. Thanks a lot!


The combination of ghc 6.12.1 and haskell platform suggests it is a 
pretty old haskell platform, whose parsec is version 2. It does not have 
ParsecT.


Your recent cabal install parsec gets you version 3.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Off-topic: Mathematics and modesty

2011-08-30 Thread KC
He said Trying to distinguish first between knowledgeable, wise,
guru, wizard, etc. before asking the actual mathematics related
question.

Beware: the expert
X is an unknown quantity
spert is a drip under pressure
:D


On Tue, Aug 30, 2011 at 12:16 PM, Chris Smith cdsm...@gmail.com wrote:
 On Tue, 2011-08-30 at 20:58 +0200, Jerzy Karczmarczuk wrote:
 With all my respect:
 I think I know several mathematicians who learning that a person asking
 for help begins with trying to distinguish  between knowledgeable, and
 those who just think they are, will simply - to say it politely - refuse
 to engage.

 I don't agree with this.  It's the most natural thing in the world to
 listen to an answer and then try to figure out whether the speaker knows
 what they are talking about or not.  Those who expect us to forego that
 step aren't really engaged in mathematics any more.

 --
 Chris Smith


 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe




-- 
--
Regards,
KC

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] installing/reinstalling haskell platform with profiling enabled on windows

2011-08-30 Thread Albert Y. C. Lai

On 11-08-30 10:52 AM, MH wrote:

How can I install/reinstall haskell platform with profiling enabled on
windows?


It already is.

Program Files (x86)\Haskell 
Platform\2011.2.0.1\lib\extralibs\text-0.11.0.6\ghc-7.0.3\libHStext-0.11.0.6_p.a
Program Files (x86)\Haskell 
Platform\2011.2.0.1\lib\extralibs\text-0.11.0.6\ghc-7.0.3\Data\Text.p_hi


are just a few examples.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Off-topic: Mathematics

2011-08-30 Thread Peter Simons
Hi Andrew,

  I know of several places where I can ask maths questions and half a
  dozen people will take guesses at what the correct solution might be.
  I haven't yet found anywhere where I can say when would a
  chi-squared test be more appropriate than a KS test? and get an
  informed, knowledgeable answer. (Answers from people who /know/ what
  they're talking about rather than just /think/ they know.)

I believe this phenomenon is quite natural and easily explained. When
you're asking a non-trivial question, hardly anyone just knows the
correct answer -- especially when it comes to math. In order to answer
your question, people have to dedicate time and effort to study the
problem you're asking about. (Furthermore, formulating a coherent
response is usually be a bit of an effort, too.)

Now, a person who has profound knowledge of the subject you're asking
about is not very likely to do this, because he is probably not going to
learn anything in the process. Dedicating time and effort to studying
your particular problem is not an appealing prospect. A person who has
superficial understanding of the subject, however, is more likely to be
fascinated by the problem, and consequently he is more likely to
dedicate time and effort into formulating a response.

In other words, even if Donald Knuth himself is reading the forum you're
posting to, it doesn't mean that he is actually going to respond. On the
other hand, if you're asking the right question, Donald Knuth just might
respond to it, but not necessarily in the forum that you were originally
asking in.

Take care,
Peter


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Off-topic: Mathematics

2011-08-30 Thread Jerzy Karczmarczuk

Peter Simons :

Now, a person who has profound knowledge of the subject you're asking
about is not very likely to do this, because he is probably not going to
learn anything in the process. Dedicating time and effort to studying
your particular problem is not an appealing prospect.

You might be right.
You may be dead wrong... Some people like to teach, find some pleasure 
in explaining things they know, and find a pleasure in trying to be 
useful. But they might refuse, if they hear:
 ...if you are a real specialist and you know what you are talking 
about, tell me what is better, the chi-square test or (...).
Knuth admitted that he had learnt a lot while teaching things he already 
knew. So did Feynman. And Landau.


All the best.
Jerzy K.


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Ryan Ingram
On Tue, Aug 30, 2011 at 9:42 AM, Conal Elliott co...@conal.net wrote:
 I suspect this definition is what Sebastian meant by converting back and
forth to ordinary lists.

Yep, I know; and technically it violates 'fmap id' == 'id'

for example,
fmap id (FList $ \xs - xs ++ xs) = FList $ \xs - xs

If you add this FList law, though, you're OK:

runFList fl as = runFList fl [] ++ as

But, yes, this definition of fmap converts back to an ordinary list
representation.

  -- ryan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Project Euler: request for comments

2011-08-30 Thread KC
You also don't need mutual recursion for this explicit recursion since
I imagine it would use up more stack space.


-- Doing the one dimensional case.
f011 :: [Int] - Int
f011 (t:u:v:xs) = f011helper t u v xs

f011helper :: Int - Int - Int - [Int] - Int
f011helper t u v (w:ws)
| ws == []  = t*u*v*w
| otherwise = max (t*u*v*w) (f011helper u v w ws)


-- Note: f011helper does not call f011.


On Mon, Aug 29, 2011 at 9:40 AM, Oscar Picasso oscarpica...@gmail.com wrote:
 Got it.

 f :: [Int] - Int
 f (t:u:v:xs) = helper t u v xs

 helper :: Int - Int - Int - [Int] - Int
 helper t u v (w:ws)
  | ws == []  = t*u*v*w
  | otherwise = max (t*u*v*w) (f (u:v:w:ws))

 I tend to overlook mutual recursion in my toolbox.

Good going! :)


 Thanks for the enlightenment.

 On Sun, Aug 28, 2011 at 4:54 PM, KC kc1...@gmail.com wrote:
 Try something like the following:

 -- Project Euler 11

 -- In the 20×20 grid below, four numbers along a diagonal line have
 been marked in red.

 -- snip

 -- The product of these numbers is 26 × 63 × 78 × 14 = 1788696.

 -- What is the greatest product of four adjacent numbers in any
 direction (up, down, left, right, or diagonally) in the 20×20 grid?


 import Data.List

 -- Doing the one dimensional case.
 f011 :: [Int] - Int
 f011 (t:u:v:xs) = f011helper t u v xs

 f011helper :: Int - Int - Int - [Int] - Int
 f011helper t u v (w:ws)
    | ws == []  = t*u*v*w
    | otherwise = yada nada mada

 -- What are yada nada mada?

 -- The 20x20 grid case will become:
 f0112D :: [[Int]] - Int
 -- where [[Int]] is a list of lists of rows, columns, major diagonals,
  minor diagonals.


-- 
--
Regards,
KC

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Off-topic: Mathematics

2011-08-30 Thread Alexander Solla
Use Usenet.  sci.math, sci.math.research, and sci.logic are some of the best
mathematics and logic resources on the internet.

On Mon, Aug 29, 2011 at 1:34 AM, Andrew Coppin
andrewcop...@btinternet.comwrote:

 This is fairly wildly off-topic but... does anybody know of a good forum
 where I can ask questions about mathematics and get authoritative answers?
 (Apart from go visit the nearest university, that is.)

 __**_
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/**mailman/listinfo/haskell-cafehttp://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Sebastian Fischer
On Wed, Aug 31, 2011 at 6:13 AM, Ryan Ingram ryani.s...@gmail.com wrote:
 technically it violates 'fmap id' == 'id' [...]

 If you add this FList law, though, you're OK:

 runFList fl as = runFList fl [] ++ as

I think the idea of functional lists is that the monoids of 'lists'
and 'functions on lists' are isomorphic with isomorphisms toFList and
toList:

toFList [] = id
toFList (xs++ys) = toFList xs . toFList ys

toList id = []
toList (f . g) = toList f ++ toList g

These can be defined as:

toFList = (++)
toList = ($[])

Eliding newtypes, runFList is just the identity function so we need to check

f l = toList f ++ l

to verify your law. This is the same as

f = toFList (toList f)

which (once we know that toList and toFList are isomorphisms) does
indeed hold because:

toFList . toList = id
toList . toFList = id

Sebastian

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Pointed, but not Applicative

2011-08-30 Thread Sebastian Fischer
    toFList [] = id
    toFList (xs++ys) = toFList xs . toFList ys

    toList id = []
    toList (f . g) = toList f ++ toList g

These laws do not *define* the isomorphisms because their behavior on
singletons is not fixed. Combining them with laws using a 'point'
function for functional lists

point = (:)

the isomorphisms are characterized uniquely:

toFList [x] = point x
toList (point x) = [x]

This might be an argument in favor of a Pointed class without Functor
constraint as it shows that other pointed structures have reasonable
laws involving 'point' as well.

Sebastian

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] GHCI Feature Request: Last Successful Compilation State Saved

2011-08-30 Thread Daniel Patterson

On Aug 30, 2011, at 1:15 PM, Christopher Done wrote:
 1) You put all your source files on the server, too and then run the
 GHCi process under tramp and access the files via tramp.
 
 2) Sounds like you'd prefer to keep your files local, which, I suppose
 means you want to send code to the server when you trigger a compile?
 
 Could be done, could be done. I'll ponder it.

Actually, 1. is what happens, which seems like the easier thing. The folder 
does exist locally (ie, on the host), but it is shared with the virtualmachine, 
so it can be edited in either place. The sharing is either done through a a 
special mechanism provided by the virtualmachine (ie, in virtualbox, shared 
folders), or with plain old NFS (the latter is faster, for unknown reasons).

My normal workflow is to have an editor open that edits the files on the 
host. Then with a ssh connection to the client (the virtualmachine), I 
build and/or run ghci through that. I'm not sure if this is how other people do 
work with virtualmachines, but I would imagine it was relatively common. 

I'd be pretty excited about that working. As an added benefit, the same 
strategy could be used to jump into a project on an actually remote host. 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] bitSize

2011-08-30 Thread Richard O'Keefe

On 30/08/2011, at 7:45 PM, Thomas Davie wrote:

 That's reasonably believable – streaming units on current CPUs can execute 
 multiple floating point operations per cycle.

The figures for cephes_{sinf,cosf} are difficult to believe
because they are so extremely at variance with the figures that
come with the software.

First off, the program as delivered, when compiled, reported that the
computer was a 2000 MHz one.  It is in fact a 2.66 GHz one.  That
figure turns out to be a #define in the code.  Fix that, and the
report includes

benching  cephes_sinf .. - 12779.4 millions of vector 
evaluations/second
 -   0 cycles/value on a 2660MHz computer
benching  cephes_cosf .. - 12756.8 millions of vector 
evaluations/second
 -   0 cycles/value on a 2660MHz computer
benching  cephes_expf .. -7.7 millions of vector evaluations/second
 -  86 cycles/value on a 2660MHz computer

The internal documentation in the program claims the following results
on a 2.4 GHz machine:

benching cephes_sinf .. - 11.6 millions of vector evaluations/second
-  56 cycles/value on a 2600MHz computer
benching cephes_cosf .. - 8.7 millions of vector evaluations/second
-  74 cycles/value on a 2600MHz computer
benching cephes_expf .. - 3.7 millions of vector evaluations/second
- 172 cycles/value on a 2600MHz computer

It seems surpassing strange that code compiled by gcc 4.2 on a 2.66 GHz
machine should run more than a thousand times faster than code compiled
by gcc 4.2 on a 2.60 GHz machine with essentially the same architecture.

Especially as those particular functions are *NOT* vectorised.
They are foils for comparison with the functions that *ARE* vectorised,
for which entirely credible 26.5 million vector evaluations per second
(or 25 cycles per value) are reported.  Considering that sin and cos
are not single floating point operations, 25 cycles per value is well
done.

28 cycles per single-precision logarithm is not too shabby either,
IF one can trust a benchmark that has blown its credibility as badly
as this one has.  But it's still not an Integer logarithm, just a
single precision floating point one.



___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] iOS and Haskell

2011-08-30 Thread Vasili I. Galchin
Hello,


  I know nothing about the architecture of iOS running on an iPad.
However, I have a friend who just bought the newer iPad. It seems that
either C++ or Objective C is available on iPad for development(actually the
icon says C++). What are the prospects of getting Haskell ported to iOS?

Vasili
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] iOS and Haskell

2011-08-30 Thread Brandon Allbery
On Wed, Aug 31, 2011 at 00:32, Vasili I. Galchin vigalc...@gmail.comwrote:

   I know nothing about the architecture of iOS running on an iPad.
 However, I have a friend who just bought the newer iPad. It seems that
 either C++ or Objective C is available on iPad for development(actually the
 icon says C++). What are the prospects of getting Haskell ported to iOS?


http://www.haskell.org/haskellwiki/IPhone is a compendium of discussion and
work on the subject.  I don't know the current state of it.

-- 
brandon s allbery  allber...@gmail.com
wandering unix systems administrator (available) (412) 475-9364 vm/sms
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe