Hi All,
I've written this piece of code to do permutations -
perms :: String - [String]
perms []= []
perms (x:[])= [[x]]
perms (x:xs)= concat (f [x] (perms xs))
spread :: String - String - [String] -- interpolate first string at various
positions of second string
spread str1 str2 = _spread
CK Kashyap wrote:
I've written this piece of code to do permutations -
First off, this is a recurring topic. If you search the archives, you'll
find some more topics about it.
perms :: String - [String]
Why this type? Since a String is just a list of Char, and you don't use
the fact that
Oh!
I was pretty sure that I made these patches correctly. But guess what, the
added flags to hsc2hs are different from the others. And I did a bling
copy/paste.
Thanks for reminding it Gregory.
Best,
2010/1/6 Gregory Collins g...@gregorycollins.net
Ozgur Akgun ozgurak...@gmail.com writes:
Will Ness wrote:
Heinrich Apfelmus writes:
Concerning lists as producer/consumer, I think that's exactly what lazy
evaluation is doing. Neither filter , map or span evaluate and
store more list elements that strictly necessary.
I laways suspected as much, but was once told that Chris
Am Donnerstag 07 Januar 2010 09:37:42 schrieb CK Kashyap:
Hi All,
I've written this piece of code to do permutations -
perms :: String - [String]
Nothing in the algorithm needs the list elements to be Chars, there's no type
class
involved, so it should be
perms :: [a] - [[a]]
perms []=
Hello,
I'm happy to announce another member in the 'monadic regions' family:
safer-file-handles:
http://hackage.haskell.org/package/safer-file-handles-0.1
The package uses my 'regions' and 'explicit-iomodes' packages to add
two safety features on top of the regular System.IO file handles and
Hi,
Is there an entry in the haskell wiki for permutations? Since this is a
recurring topic, as primes, shouldn't we create a topic for that in the
wiki?
Regards,
Rafael
On Thu, Jan 7, 2010 at 08:46, Daniel Fischer daniel.is.fisc...@web.dewrote:
Am Donnerstag 07 Januar 2010 09:37:42
Dear all,
I'd love to use Data Parallel Haskell
(for now, just as a demonstration, in a lecture).
I want to convince my students (and myself)
that this thing really works.
What would be an easy-to-understand, but still
impressive enough benchmark? (to be run on 8 core amd64)?
What is the
Dear all,
It's not exactly Haskell-specific, but ...
I am trying to track down the origin of the proverb
the existence (or: need for) a preprocessor
shows omissions in (the design of) a language.
I like to think that in Haskell, we don't need
preprocessors since we can manipulate programs
Hello Johannes,
Thursday, January 7, 2010, 3:32:03 PM, you wrote:
the existence (or: need for) a preprocessor
shows omissions in (the design of) a language.
yes, that's the common opinion. the same true for comments and
identifiers :D
shortly speaking, preprocessor is just another language
On Thu, 2010-01-07 at 00:37 -0800, CK Kashyap wrote:
Hi All,
I've written this piece of code to do permutations -
I assume that it's training piece not real code as in such I'd
recommend:
import Data.List
perms = permutations
perms :: String - [String]
perms []= []
As pointed out
Hello Bulat,
Thursday, January 7, 2010, 4:03:07 PM, you wrote:
the existence (or: need for) a preprocessor
shows omissions in (the design of) a language.
forget to add: for language designers, analysis of typical
preprocessor usage and adding analogous features to language instead
is a great
Am Donnerstag 07 Januar 2010 14:04:20 schrieb Maciej Piechotka:
As pointed out perms [] = [[]]. You can note that:
length . perms == factorial
Surely you meant
genericLength . perms == factorial . (genericLength :: [a] - Integer)
___
Haskell-Cafe
On Thu, 2010-01-07 at 13:32 +0100, Johannes Waldmann wrote:
Dear all,
It's not exactly Haskell-specific, but ...
I am trying to track down the origin of the proverb
the existence (or: need for) a preprocessor
shows omissions in (the design of) a language.
I like to think that in
On Thu, 2010-01-07 at 14:12 +0100, Daniel Fischer wrote:
Am Donnerstag 07 Januar 2010 14:04:20 schrieb Maciej Piechotka:
As pointed out perms [] = [[]]. You can note that:
length . perms == factorial
Surely you meant
genericLength . perms == factorial . (genericLength :: [a] -
It strikes me that this question may be related (perhaps distantly) to
Godel's incompleteness theorem. Anyone else see similarities here?
On Thu, Jan 7, 2010 at 7:32 AM, Johannes Waldmann
waldm...@imn.htwk-leipzig.de wrote:
Dear all,
It's not exactly Haskell-specific, but ...
I am trying to
Hello,
As I explained in my announcement of 'safer-file-handles', I
discovered a serious lack of expressive power in my 'regions' package.
I have now solved that problem in the way I envisaged by removing the
'resource' parameter from 'RegionT' and using existential
quantification to bring the
BTW
As can be seen from the documentation of 'safer-file-handles', I'm
currently not satisfied at all about my implementation of the standard
files (stdin, stdout and stderr). To quote the docs:
BIG WARNING: I'm not satisfied with my current implementation of the
standard handles (stdin, stdout
On Thu, Jan 07, 2010 at 04:00:31PM +0100, Bas van Dijk wrote:
As I explained in my announcement of 'safer-file-handles', I
discovered a serious lack of expressive power in my 'regions' package.
I have now solved that problem in the way I envisaged by removing the
'resource' parameter from
Damn. Seems like I really need (True, False, True) as a result of
test.
On 7 Jan 2010, at 08:52, Miguel Mitrofanov wrote:
Seems very nice. Thanks.
On 7 Jan 2010, at 08:01, Edward Kmett wrote:
Here is a slightly nicer version using the Codensity monad of STM.
Thanks go to Andrea Vezzosi
Hi all,
I have a family of parsers that return either (Success t) or (Fail), using the
following data type:
data ParserResult a = Success a | Fail String
deriving (Read, Show, Eq, Ord)
isSuccess (Success _) = True
isSuccess (Fail _) = False
...
I want to add the results of different
If I understand you correctly, what you want is very similar to catMaybes
isSuccess' (Success a) = Just a
isSuccess' _ = Nothing
result = catMaybes $ map isSuccess ps
This should do the trick.
2010/1/7 rodrigo.bonifacio rodrigo.bonifa...@uol.com.br
Hi all,
I have a family of parsers that
В сообщении от Четверг 07 января 2010 21:35:10 rodrigo.bonifacio написал:
Hi all,
I have a family of parsers that return either (Success t) or (Fail), using
the following data type:
data ParserResult a = Success a | Fail String
deriving (Read, Show, Eq, Ord)
isSuccess (Success _) =
You could cast your parser result a to Dynamic using
Data.Dynamic.toDyn (and derive Typeable instances for all involved types).
http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.2.0.0/Data-Dynamic.html
Using an existential types may be another alternative.
Cheers Christian
Am Donnerstag 07 Januar 2010 17:13:38 schrieb Daniel Fischer:
compos :: [a] - [a]
compos = vips . itfold mergeSP . multip
Sigh! That's what I get for editing the code in the mail editor. I decided
to change the really stupid 'itfold' to 'smartfold' and forgot this
occurrence.
o...@okmij.org wrote:
The others have already pointed out the problem with the imperative
solution, which used the mutation of the global state with the new
random seed. Imperative approach is indeed often a problem.
As Daniel Fischer pointed out, my immediate problem was that iterateR
never
On Thu, Jan 7, 2010 at 5:15 PM, Felipe Lessa felipe.le...@gmail.com wrote:
On Thu, Jan 07, 2010 at 04:00:31PM +0100, Bas van Dijk wrote:
As I explained in my announcement of 'safer-file-handles', I
discovered a serious lack of expressive power in my 'regions' package.
I have now solved that
Hi,
Am Sonntag, den 27.12.2009, 09:50 + schrieb Stephen Tetley:
I'll try next with MinGW to see if that works...
Aye, it builds fine under MinGW.
I built and installed PCRE (c c++ library) from the source
(./configure, make, make install), though I think there is a package
On Thu, Jan 7, 2010 at 5:18 PM, Bulat Ziganshin
bulat.zigans...@gmail.com wrote:
Hello Bas,
Thursday, January 7, 2010, 6:25:34 PM, you wrote:
So now I'm confused... are these standard file handles always open on
program startup or are there abnormal situations when they are closed?
afaik,
Hello, My impression is that using existential types where possible
will result in more complete type checking than Data.Dynamic but I'm
not sure since I haven't yet tried Data.Dynamic in my own code. Can
someone confirm if this is right?
Best
Keith
On Thu, Jan 7, 2010 at 2:02 PM, Christian
Hello Keith,
Thursday, January 7, 2010, 11:26:51 PM, you wrote:
existential types has more limited usage compared to dynamics, but in
the cases they work they allow to have compile-time type-checking
instead of run-time one
Hello, My impression is that using existential types where possible
Hi all,
Does anyone know of a good/simple example of sending cookies and other
headers in an HTTP request via simpleHTTP or Browser? I know what the
cookies should be (i.e. I don't want them to be sent by the server). More
specifically, I'm looking for an analogue to curl's -b and -H flags.
Hi,
I am attempting to explain an example of dependent types to computing
practitioners who do not have any background in functional programming.
My goal is to explain the example rather than implement or improve it. I
have been told in previous postings that the approach below is a bit
dated. Any
Hey everyone! I have some computations that satisfy statistical properties
which I would like to test --- that is, the result of the computation is
non-deterministic, but I want to check that it is sampling the distribution
that it should be sampling. Is anyone aware of a Haskell library out
I liked it too. Seems like I have to show some real code, and my
apologies for a long e-mail.
Well, that's what I'm actually trying to do and what I've managed to
achieve so far.
module Ask where
import Control.Monad
import Data.IORef
import Data.Maybe
import System.IO.Unsafe -- Yes,
That is kind of what I thought you were doing.
Retooling to see if we can get any better performance out of collecting, it
seems that System.Mem.PerformGC does a foreign call out to performMajorGC to
ask for a global collection. But I would hazard that you might be able to
get most of the benefit
Hmm, interesting. Seems like I have to take a closer look at GHC's
garbage collection. Thanks!
On 8 Jan 2010, at 00:53, Edward Kmett wrote:
That is kind of what I thought you were doing.
Retooling to see if we can get any better performance out of
collecting, it seems that
On Thu, Jan 07, 2010 at 08:39:59PM +0100, Bas van Dijk wrote:
Another solution might be to encode the resources that a region opens
as constraints. I think 'control-monad-exception' uses a similar
technique to encode all the exceptions that a monadic computation may
throw.
Yes, yes, that's
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes:
I consider it show-stopping in the sense that I keep having people
on #gentoo-haskell asking me why they can't compile darcs 2.3.1
because that error comes up, and I have to explain to either disable
documentation or downgrade Cabal (if
Both darcs and xmonad are only great product i know!
thanks!
Reinier Lamers-2 wrote:
Hi all,
The darcs team would like to announce the immediate availability of darcs
2.4
beta 1. darcs 2.4 will contain many improvements and bugfixes compared to
darcs 2.3.1. Highlights are the fast
t...@cybersource.com.au (Trent W. Buck) writes:
Does Gentoo's cabal set documentation: True by default? On Debian,
cabal install foo will not build documentation; it's only when
building a .deb with CDBS that documentation is built.
No, but a lot of people have USE=doc which builds the
Thanks everyone,
Thanks Daniel for this really detailed explanation - thank you very much.
Regards,
Kashyap
From: Daniel Fischer daniel.is.fisc...@web.de
To: haskell-cafe@haskell.org
Cc: CK Kashyap ck_kash...@yahoo.com
Sent: Thu, January 7, 2010 4:16:33 PM
Subject: Re: [Haskell-cafe] Review
On Jan 7, 2010, at 14:44 , Bas van Dijk wrote:
On Thu, Jan 7, 2010 at 5:18 PM, Bulat Ziganshin
bulat.zigans...@gmail.com wrote:
Thursday, January 7, 2010, 6:25:34 PM, you wrote:
So now I'm confused... are these standard file handles always open
on
program startup or are there abnormal
Patched by Antoine S. Latter to interoperate with UUID.
http://hackage.haskell.org/package/system-uuid-1.2.0
--
Jason Dusek
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Greg,
Hey everyone! I have some computations that satisfy statistical
properties which I would like to test --- that is, the result of the
computation is non-deterministic, but I want to check that it is
sampling the distribution that it should be sampling. Is anyone
aware of a Haskell
45 matches
Mail list logo