Call for Copy: The Monad.Reader - Issue 16
--
Whether you're an established academic or have only just started
learning Haskell, if you have something to say, please consider
writing an article for The Monad.Reader! The submission deadline
for Issue 16 will
On Tue, Mar 09, 2010 at 08:42:44PM +0100, Sebastian Hungerecker wrote:
> On 09.03.2010 20:04, boblettoj wrote:
>> score :: String -> String -> String
>> score [s] [] = false
>> score [s] [g] =
>> if valid 4 g
>> then (s1 ++ s2 ++ s3 ++ s4) where
>> s1 = "Golds "
>>
ttempts to automatically infer the kind of a specified type, type
> constructor, type family, type class, or pretty much anything else that has
> a kind.
>
> This package was developed in response to a sort-of challenge from Brent
> Yorgey on #haskell to create this functional
I already have one or two submissions, but a few more would be
great. If you've been thinking about submitting something but
weren't sure or haven't gotten around to it yet, now's the time!
--
Whether you're an established academic or have only just started
learning Haskell, if you ha
On Fri, Mar 19, 2010 at 03:15:02PM +, Ozgur Akgun wrote:
> Hi Cafe!
>
> Disclaimer: I know what I'm going to ask is now available as a language
> feature normally.
> And sorry for the subject of this message, I couldn't compe up with a
> good&descriptive subject.
>
>
> Is there any way to li
On Fri, Mar 19, 2010 at 04:03:52PM -0400, Ben Derrett wrote:
>
> trace2 a = trace (show a) a
>
> In the definition of `trace2': trace2 a = (show a) a
These don't match. It looks like maybe you forgot the call to trace
in your definition of trace2?
-Brent
___
We are gauging interest in another Haskell hackathon to be hosted at U
Penn in May, the weekend of either May 15 or May 22. If you might be
interested in attending such a thing, send me an email (please DON'T
reply to all!) with your name and whether you have a strong preference
for one or the oth
Hi all,
Consider the following declarations.
> -- from vector-space package:
> (*.*) :: (HasBasis u, HasTrie (Basis u),
> HasBasis v, HasTrie (Basis v),
> VectorSpace w,
> Scalar v ~ Scalar w)
> => (v :-* w) -> (u :-* v) -> u :-* w
>
> -- my co
On Wed, Apr 14, 2010 at 09:51:52AM +0100, Stephen Tetley wrote:
> On 14 April 2010 03:48, Brent Yorgey wrote:
>
> > Can someone more well-versed in the intricacies of type checking with
> > associated types explain this? Or is this a bug in GHC?
>
> If you take the defi
On Thu, Apr 15, 2010 at 12:48:20AM +1000, Roman Leshchinskiy wrote:
>
> >
> > Right, this seems weird to me. Why is there still a 'u' mentioned in
> > the constraints? Actually, I don't even see why there ought to be
> > both v and v1. The type of (*.*) mentions three type variables, u, v, and
On Wed, Apr 14, 2010 at 09:14:18PM +0200, Dupont Corentin wrote:
> Hello Café,
> do you know Nomic?
>
> It's a fabulous and strange game where you have the right to change the
> rules in the middle of the game!
> In fact, changing the rules is the goal of the game. Changing a rule is
> considered
Conal,
Thanks for looking into this! Making (:-*) into a proper type seems
promising. I did try wrapping (:-*) in a newtype but that didn't
help (although I didn't expect it to).
I see you just uploaded a new version of vector-space; what's new in
0.6.2?
-Brent
On Sat, Apr 17, 2010 at 10:28:4
On Mon, Apr 19, 2010 at 09:40:25AM -0700, Conal Elliott wrote:
> On Sun, Apr 18, 2010 at 9:02 PM, Brent Yorgey wrote:
>
> > Conal,
> >
> > Thanks for looking into this! Making (:-*) into a proper type seems
> > promising. I did try wrapping (:-*) in a newtype but
There is still plenty of space to register [1] for Hac phi 2010, but
time is running out to get a hotel room at a reduced rate --- if you
want the special rate for the block of rooms we have reserved at the
Club Quarters, you must contact the hotel by this Friday, April 23.
Instructions are on the
I am very pleased to announce that Issue 16 of The Monad.Reader is now
available [1].
Issue 16 consists of the following three articles:
* "Demand More of Your Automata" by Aran Donohue
* "Iteratee: Teaching an Old Fold New Tricks" by John W. Lato
* "Playing with Priority Queues" by L
On Fri, May 14, 2010 at 02:37:19PM +1000, Ivan Miljenovic wrote:
> On 13 May 2010 04:12, Brent Yorgey wrote:
> >
> > * "Demand More of Your Automata" by Aran Donohue
>
> Great, because of Aran I now can't change some of the bits of API in
> graphviz
On Fri, May 14, 2010 at 11:30:40PM +1000, Ivan Lazar Miljenovic wrote:
> Brent Yorgey writes:
>
> > On Fri, May 14, 2010 at 02:37:19PM +1000, Ivan Miljenovic wrote:
> >> On 13 May 2010 04:12, Brent Yorgey wrote:
> >> >
> >> > * "Demand More
On Wed, May 19, 2010 at 04:27:14AM +, R J wrote:
>
> What are some simple functions that would naturally have the following type
> signatures:
> f :: (Integer -> Integer) -> Integer
Well, this means f is given a function from Integer to Integer, and it
has to somehow return an Integer, (poss
On Wed, May 19, 2010 at 01:12:16PM +, R J wrote:
>
> Is this how a rigorous Haskeller would lay out the proofs of the following
> theorems? This is Bird 1.4.6.
> (i)
> Theorem: (*) x = (* x)
> Proof:
> (*) x ={definition of partial application} \y
On Wed, May 19, 2010 at 01:37:49PM +, R J wrote:
>
> This is another proof-layout question, this time from Bird 1.4.7.
> We're asked to define the functions curry2 and uncurry2 for currying and
> uncurrying functions with two arguments. Simple enough:
> curry2 :: ((a, b) -> c) ->
On Thu, May 20, 2010 at 11:53:09AM +1200, Richard O'Keefe wrote:
>
> On May 20, 2010, at 3:18 AM, Brent Yorgey wrote:
>
>> On Wed, May 19, 2010 at 04:27:14AM +, R J wrote:
>>>
>>> What are some simple functions that would naturally have the following
On Sun, May 30, 2010 at 11:15:40AM -0700, Mike Dillon wrote:
> begin Michael Snoyman quotation:
> > http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/Control-Monad.html#v%3AliftM2
> >
> > Strangely,
> > Hayoo didn't turn this one up... anyone know why?
>
> Hoogle finds it. I didn'
Perhaps something here may be of use?
http://okmij.org/ftp/Haskell/types.html#class-based-overloading
http://okmij.org/ftp/Haskell/types.html#class-based-dispatch
-Brent
On Mon, May 31, 2010 at 01:32:18PM +0200, Steffen Schuldenzucker wrote:
> Dear Cafe,
>
> let:
>
> > data True
> > data F
On Mon, Jun 28, 2010 at 08:51:45AM +0400, Victor Nazarov wrote:
> >
> >> What we get with this instances is following code.
> >>
> >> > main =
> >> > do print (sizeof :: Sizeof Word16)
> >>
> >> Let's try it.
> >>
> >> $ runhaskell this.lhs
> >> this.lhs:78:14:
> >> Couldn't match expected ty
I don't know the answer to your questions, but just wanted to note
that you will probably get a better response on the
glasgow-haskell-users mailing list.
http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/mailing-lists-GHC.html
-Brent
On Fri, Jun 25, 2010 at 08:56:09PM -0700, braver wrot
On Fri, Jun 25, 2010 at 02:26:54PM -0700, Walt Rorie-Baety wrote:
> I've noticed over the - okay, over the months - that some folks enjoy the
> puzzle-like qualities of programming in the type system (poor Oleg, he's
> become #haskell's answer to the "Chuck Norris" meme commonly encountered in
> M
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090417
Issue 114 - April 17, 2009
---
Welcome to issue 114 of HWN, a newsletter covering dev
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090425
Issue 115 - April 25, 2009
---
Welcome to issue 115 of HWN, a newsletter covering dev
On Fri, Apr 24, 2009 at 06:52:09PM +, Keith Battocchi wrote:
> I'm trying to write some code to do folds on nested datatypes as in
> http://web.comlab.ox.ac.uk/people/Jeremy.Gibbons/publications/efolds.pdf but
> running into trouble getting things to typecheck.
>
> Given the types
>
> data
On Sun, Apr 26, 2009 at 03:23:17PM +0200, Thomas van Noort wrote:
> This is a recurring problem[1] and I'm still looking for a really
> satisfying solution. The only working and non-verbose solution I found is
> the one Miguel suggests. Although I'm not too fond of splitting up the
> monadic fun
On Sat, May 02, 2009 at 05:31:03PM +0100, Paul Keir wrote:
> On the wiki page for Applicative Functors
> (http://www.haskell.org/haskellwiki/Applicative_functor) a familiar
> characteristic of monads is quoted; that they "allow you to run actions
> depending on the outcomes of earlier actions".
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090502
Issue 116 - May 02, 2009
---
Welcome to issue 116 of HWN, a newsletter covering devel
On Mon, May 04, 2009 at 03:08:25PM +0200, Martijn van Steenbergen wrote:
> Andrew Wagner wrote:
>> [quote]
>> Here's [a]language to to interpret (where postfix * means tupling):
>> Variables: x Integer literals: i Terms: t = Lambda x*. t | Apply t t*
>> | Var(x) | Num(i)
>
> Can someone
On Mon, May 04, 2009 at 02:52:17PM +0200, Gü?nther Schmidt wrote:
> Hi,
>
> I've gotten used to darcs now, and use it for my project. There is one
> quirk though, I also added some rather large binary files, an sqlite
> database and an MS Access database to the repository.
>
> Now whenever I do a
On Tue, May 05, 2009 at 05:36:12PM +0200, Tillmann Rendel wrote:
>
> PS. I'm not a native speaker, but shouldn't it be "movies" and not "films"?
Both are correct. =)
-Brent
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/ma
On Mon, May 11, 2009 at 10:59:01PM -0700, michael rice wrote:
> In the code below, is the type returned by the return functions inferred from
> the result type in the function type signature, i.e., just change the result
> type to Maybe Int and the code will return a Maybe monad, (Just 4), instead
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090512
Issue 117 - May 12, 2009
---
Welcome to issue 117 of HWN, a newsletter covering devel
On Thu, May 14, 2009 at 03:58:18PM -0300, José Romildo Malaquias wrote:
>
> Then the resulting of pretty printing the given tree would be something
> like the following:
>
>a
>|
> +-+
> |||
> bcd
> ||
>+---++---+
>| |
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090516
Issue 118 - May 16, 2009
---
Welcome to issue 118 of HWN, a newsletter covering devel
Hi all!
We are in the early stages of planning a Haskell hackathon/get
together, Hac φ, to be held this summer at the University of
Pennsylvania, in Philadelphia. Right now we're looking at two
possible dates:
June 19-21or July 24-26
If you might be interested in attending, please add y
fusion. New and notable
in this release is support for lazy, chunked text, so you can process
text files far larger than memory using a small footprint.
Haskell Hackathon in Philadelphia. Brent Yorgey [10]announced Hac phi,
a Haskell hackathon to be held in Philadelphia in July. Ch
more info.
-Brent
On Sun, May 24, 2009 at 01:35:40PM -0400, Andrew Wagner wrote:
> Is there a list of projects that will be worked on during this, or how will
> that work?
>
> On Thu, May 21, 2009 at 5:39 PM, Brent Yorgey wrote:
>
> > Hi all!
> >
> > We ar
On Sun, May 24, 2009 at 10:39:50AM +0200, Petr Pudlak wrote:
> On Sun, May 24, 2009 at 12:18:40PM +0400, Eugene Kirpichov wrote:
> > Haskell has terms depending on types (polymorphic terms) and types
> > depending on types (type families?), but no dependent types.
>
> But how about undecidability?
On Wed, May 27, 2009 at 10:39:20AM -0700, Thomas DuBuisson wrote:
> Manu,
> Did you skip over the dozens of links at haskell.org answering exactly
> these questions? There are links to some great tutorials [1] and IRC
> information where you can get real-time help [2]. Also there are some
> good
Greetings,
I am very pleased to officially announce Hac phi, a Haskell
hackathon/get-together to be held July 24-26 at the University of
Pennsylvania in Philadelphia. The hackathon will officially kick off
at 2:30 Friday afternoon, and go until 5pm on Sunday (with breaks for
sleep, of course). T
On Sun, May 31, 2009 at 06:20:23PM -0700, Iavor Diatchki wrote:
>
> and so on. It is a bit verbose, but you only have to do it once for
> your protocol, and then you get the nice overloaded interface.
This also seems like the kind of thing perfectly suited to Template
Haskell. Especially if the
Haskell hackathon in Philadelphia, July 24-26. Brent Yorgey
[23]announced Hac phi, a Haskell hackathon/get-together to be held July
24-26 at the University of Pennsylvania in Philadelphia. The hackathon
will officially kick off at 2:30 Friday afternoon, and go until 5pm on
Sunday (with
Hi all,
This is a quick reminder for people interested in attending Hac phi
who have not yet reserved a hotel room: if you'd like to reserve a
room at Club Quarters at the reduced rate ($114/night single,
$129/night double), we ask that you send a note to Daniel Wagner
(dan...@wagner-home.com) by
On Wed, Jun 10, 2009 at 04:43:57PM +0100, Eric Kow wrote:
> Dear Haskellers,
>
> ICFP 2009 takes place from Monday 31 August to Wednesday 2 September,
> with the Haskell Symposium following it on 3 September.
>
> Would anybody be interested having a Haskell Hackathon during this? My
> thinking i
On Fri, Jun 12, 2009 at 03:00:12PM +0100, Paul Keir wrote:
> Thanks Ryan, I'm slowly becoming aware of the effects of Monomorphism. I'll
> look
> again at Neil Mitchell's blog post.
>
> I guess it's the same thing when I try:
>
> > let a = 1
> > a + 1.0
>
> I'm taking the "mono" as a clue that
On Fri, Jun 12, 2009 at 08:22:25PM +0200, Daniel Fischer wrote:
> Am Freitag 12 Juni 2009 18:46:41 schrieb Gwern Branwen:
> > There are only 3 bureaucrats/admins; one is a dummy account, one is
> > Ashley, and one is John Peterson (who hasn't edited for a year).
> >
> > One solution would be to hav
ecially be
useful for optimizing simple compilers for referentially transparent
domain specific languages.
Hac phi accommodation: register by June 15 for reduced rate! Brent
Yorgey [23]reminded anyone interested in attending [24]Hac phi that
Monday 15 June is the deadline for getting
On Mon, Jun 15, 2009 at 12:38:02PM -0700, Ashley Yakeley wrote:
> Magnus Therning wrote:
>> Philippa Cowderoy wrote:
>>> On Mon, 2009-06-15 at 13:52 -0400, Gwern Branwen wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512
On Mon, Jun 15, 2009 at 1:18 PM, Ashley Yakeley wrote:
On Sun, Jun 21, 2009 at 05:53:04PM +0100, Andrew Coppin wrote:
> OK, so I'm guessing there might be one or two (!) people around here who
> know something about the Lambda calculus.
>
> I've written a simple interpretter that takes any valid Lambda expression
> and performs as many beta reduction
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090621
Issue 122 - June 21, 2009
---
Welcome to issue 122 of HWN, a newsletter covering deve
On Sun, Jun 21, 2009 at 07:48:30PM +0100, Andrew Coppin wrote:
> Andrew Coppin wrote:
>> Well anyway, the obvious thing to do is after each reduction, strip off
>> all the variable indicies and rerun the labeller to assign new indicies.
>> But does this solution work properly in general?
>
> No.
On Sun, Jun 21, 2009 at 09:16:12PM +0100, Andrew Coppin wrote:
> Niklas Broberg wrote:
>> That's what GADTs are for:
>>
>> data Flag = HasZoo | NoZoo
>>
>> data Foobar a where
>> Foo :: Foobar a -> Foobar a
>> Bar :: Foobar a -> Foobar a
>> Zoo :: Foobar a -> Foobar HasZoo
>>
>
> Ouch #1:
On Mon, Jun 29, 2009 at 11:40:28AM -0700, Justin Bailey wrote:
>
> Anyways, for those who care, the heart of my VM implementation was a
> monadic fold over the program, with a mutable array representing the
> machine's memory, all inside ''runSTUArray.'' I used a simple data
> type to represent th
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090629
Issue 123 - June 29, 2009
---
Welcome to issue 123 of HWN, a newsletter covering deve
On Tue, Jun 30, 2009 at 09:45:45AM -0700, Bryan O'Sullivan wrote:
> I've thought for a while that it would be very nice indeed if the Monoid
> class had a more concise operator for infix appending than "a `mappend` b".
> I wonder if other people are of a similar opinion, and if so, whether this
> i
On Wed, Jul 01, 2009 at 12:00:50AM -0400, a...@spamcop.net wrote:
> G'day all.
>
> On Tue, Jun 30, 2009 at 08:02:48PM -0400, Daniel Peebles wrote:
>
>> But we don't want to imply it's commutative either. Having something
>> "bidirectional" like <> or <+> feels more commutative than associative
>> t
[48]FFI: calling into kernel32.dll.
* Greg Bacon: [49]Setting up a simple test with Cabal.
* Ketil Malde: [50]Dephd updates.
* Bryan O'Sullivan: [51]What's in a text API?.
* Brent Yorgey: [52]2009 ICFP programming contest reflections.
* Galois, Inc: [53]Galo
On Thu, Jul 09, 2009 at 10:57:19AM -0400, xu zhang wrote:
> I have trouble in returning a list of Figures. I want return a type of m
> (Maybe [Figure IO]), but the type of dv_findFigure is :: a -> Point -> s
> (Maybe (Figure s)). How can change the code below to get a s (Maybe [Figure
> s])?
> Than
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090712
Issue 125 - July 12, 2009
---
Welcome to issue 125 of HWN, a newsletter covering deve
On Sun, Jul 12, 2009 at 07:01:11PM +0200, Raynor Vliegendhart wrote:
> On 7/12/09, Heinrich Apfelmus wrote:
> > Raynor Vliegendhart wrote:
> > > On 7/9/09, Heinrich Apfelmus wrote:
> > >> Of course, some part of algorithm has to be recursive, but this can be
> > >> outsourced to a general recursi
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090718
Issue 126 - July 18, 2009
---
Welcome to issue 126 of HWN, a newsletter covering deve
* David Amos: [108]How to count the number of positions of Rubik's
cube.
* Edward Kmett: [109]Slides from Hac Phi: "All About Monoids".
* Brent Yorgey: [110]Primitive species and species operations, part
II.
* Magnus Therning: [111]Making a choice
On Fri, Aug 14, 2009 at 05:04:00PM +0100, Eric Kow wrote:
> Dear Haskellers,
>
> Just a quick reminder that we will be having a Hack Day in Edinburgh
> on Sunday 30 August (ICFP venue). That's in two weeks!
>
> For the interested, we will also be meeting up the day before 09:30
> Saturday 29 Aug
JSON in Haskell.
* Notes on the LHC: [83]Status update: New Integer implementation..
* Edward Kmett: [84]Clearer Reflections.
* Petr Rockai: [85]soc final report.
* Gergely Patai: [86]hp2any overview online.
* Brent Yorgey: [87]New 2D text layout library.
* Manuel
On Sat, Sep 05, 2009 at 11:18:24AM +, Gracjan Polak wrote:
>
> Hi all,
>
> In "DEFUN 2009: Multicore Programming in Haskell Now!"
> (http://donsbot.wordpress.com/2009/09/05/defun-2009-multicore-programming-in-haskell-now/),
> slide 30 I see:
>
> Don't “accidentally parallelize”:
> – f `par`
---
Haskell Weekly News
http://sequence.complete.org/hwn/20090905
Issue 129 - September 05, 2009
---
Welcome to issue 129 of HWN, a newsletter covering
Executive summary:
* I'm looking for someone to take over as HWN editor
* It is highly automated and doesn't take as much time as you might
think (about 3-4 hours/week on average)
* You DON'T need to be a Haskell guru
* It is far from a thankless job and is a fun way to provide an
On Sat, Sep 05, 2009 at 05:26:08PM -0400, Brent Yorgey wrote:
> Executive summary:
>
> * I'm looking for someone to take over as HWN editor
> * It is highly automated and doesn't take as much time as you might
> think (about 3-4 hours/week on average)
> * Yo
Hi all,
I've started developing a library to support a "Perl-style" numeric type
that "does the right thing" without having to worry too much about types.
Explicit static typing of numeric types is really great most of the time,
and certainly a good idea for larger projects, but probably everyone
em are quite satisfactory.
-- Lennart
On 6/19/07, Brent Yorgey <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've started developing a library to support a "Perl-style" numeric type
> that "does the right thing" without having to worry too much about
On 6/20/07, Henning Thielemann <[EMAIL PROTECTED]> wrote:
Do you have some examples, where such a data type is really superior to
strong typing? There are examples like computing the average, where a
natural number must be converted to a different type:
average xs = sum xs / fromIntegral (len
On 6/20/07, Henning Thielemann <[EMAIL PROTECTED]> wrote:
How about
1 % floor pi
?
Already two examples for the Wiki which I used to start the Wiki article:
http://www.haskell.org/haskellwiki/Generic_numeric_type
What about the function isSquare?
isSquare :: (Integral a) => a -> Bool
is
On 6/19/07, Brent Yorgey <[EMAIL PROTECTED]> wrote:
I've started developing a library to support a "Perl-style" numeric type
that "does the right thing" without having to worry too much about types...
So, I just completed my implementation and decided to tes
(I originally tried to send this on Jun 8, but it seems that due to various
issues it did not actually get sent over the list. Apologies if anyone gets
multiple copies.)
Hi all,
Following some recent discussions in #haskell, I've decided to try my
hand at a module to allow automation of QuickCh
> public class Pair {
> public A fst;
> public B snd;
> public Pair(A fst, B snd) {
> this.fst = fst;
> this.snd = snd;
> }
> }
OK, I don't even understand that syntax. Have they changed the Java
language spec or something?
Yes. As of version 5 (or 1.5, or whatever you want to
Is it proper/ok to defines them as :
fromIntegral :: (a::Integral) -> (b::Num)
and
round :: (a::RealFrac) -> (b::Integral) ?
No; Integral, Num and RealFrac are type classes, not types. Think of a type
class as a "set of types" which all support certain operations. For
example, anything in th
Is there a reason why the documentation for virtually every module in
Control.Monad simply begins with a line that says
"Inspired by some paper (http://www.ogi.edu/csee/~mpj/)"
It's probably because it was felt that the paper itself is better
documentation than anything that could be written
It's also nice to have some brief comments in the API docs to say what
the heck a particular module is even *for*, and provide enough info on
the stuff in that module that you can quickly dip into it when you can't
remember the name of something...
I certainly don't disagree with you! I was ju
The problem with your second implementation is that elements which occur
more than once will eventually be included, when the part of the list
remaining only has one copy. For example:
unique2 [1,1,2,4,1]
= unique2 [1,2,4,1]
= unique2 [2,4,1]
= 2 : unique2 [4,1]
= 2 : 4 : unique2 [1]
= 2 : 4 : 1
2) The list might be infinite, and your function should work if you make
only want to use the first part of it, so the following should return
[1,2,3,4,5] in a finite amount of time:
take 5 (unique [1..])
I don't think this is possible. Perhaps you misread the original problem
description? T
> I don't think this is possible. Perhaps you misread the original
problem
> description? The unique function is supposed to return a list of those
> elements which occur exactly once in the input list, which is impossible
to
> determine for an infinite input list (the only way to prove that a
On 7/11/07, Alexteslin <[EMAIL PROTECTED]> wrote:
Oh, I am lost now - for now anyway.
I am attempting to do next exercise in the book to define reverse function
using primitive recursion and pattern matching on lists. But getting
stack
because when i con in front of xs (xs:x) i get en error, w
To be more precise, Int represents a machine-sized integer value, so it is
limited in size but doing math with Int values translates directly into math
on the processor. Integer can store integer values of arbitrary size, which
is useful sometimes but is of course a lot slower, since the pieces o
> Nevertheless, length is a function you should rarely use.
>
Amen.
(I believe the Wiki mentions this concept somewhere... Maybe we should
rename it unsafeLength? No, OK, how about... um... slowLength?)
It isn't actually slow... how about
beSureYouReallyWantIntBeforeUsingThisLength? =)
__
Hi all,
I've written some code to generate set partitions:
import Control.Arrow
import Data.List
-- pSet' S generates the power set of S, with each subset paired
-- with its complement.
-- e.g. pSet' [1,2] = [([1,2],[]),([1],[2]),([2],[1]),([],[1,2])].
pSet' :: [a] -> [([a],[a])]
pSet'
On 7/23/07, Andrew Coppin <[EMAIL PROTECTED]> wrote:
From the guy who brought you "data in Haskell is like an undead quantum
cat", I present the following:
"If programming languages were like vehicles, C would be a Ferrari, C++
would be a Porshe, Java would be a BWM and Haskell would be a hover
On 7/23/07, DavidA <[EMAIL PROTECTED]> wrote:
Here's the approach I would try.
1. Use Data.List.group to group your multiset, eg [1,1,2] -> [[1,1],[2]]
2. Now apply your partitions function to each of the groups
[[1,1],[2]] -> [ [([1,1],[]), ([1],[1]), ([],[1,1])], [([2],[]), ([],[2])]
]
(Actual
On 7/24/07, Pekka Karjalainen <[EMAIL PROTECTED]> wrote:
On 7/24/07, Brent Yorgey <[EMAIL PROTECTED]> wrote:
> given a list L :: [a], I'm looking for all partitions P :: [[a]] where
(sort
> . concat $ P) == (sort L).
Here is quick attempt that requires Ord [a] and expect
On 7/25/07, Alexteslin <[EMAIL PROTECTED]> wrote:
Hi,
I am going through examples from the textbook and trying them out but some
don't work.
For example:
addNum :: Int -> (Int -> Int)
addNum n = addN
where
addN m = n+m
This error message i am getting:
ERROR - Cannot find "sh
> Notice that Scenario depends on a list of steps and Step has a dependence
> with scenario. I know that this is a kind of "bad smell" in Haskell, are
> there any pattern or language idiom to deal with cyclical dependences?
Just a little something to add, this is not a "bad smell" at all... i
On 8/9/07, Marc Weber <[EMAIL PROTECTED]> wrote:
>
> > I wrote a code, but seems to give "Time limit exceeded"!
> ??
> Your code writes
> 15 to stdout which is correct (with the example given on the page)..
> You have to explain what you mean by >>seems to give "Time limit
> exceeded"<<
>
I think
On 8/9/07, Chaddaï Fouché <[EMAIL PROTECTED]> wrote:
>
> I get "Wrong answer" with the following code for the same problem...
> Is there something strange in this code :
This problem description is not worded very well. You have to figure out
the matching that maximizes the sum of hotnesses; you
On 8/9/07, rodrigo.bonifacio <[EMAIL PROTECTED]> wrote:
>
> Hi all.
>
> I want to overload the operator "^" for working instead of the following
> "+++" operator:
>
> (+++) :: String -> [[String]] -> [[String]]
> x +++ y = [ x:e | e<-y ]
>
> How can I overload the "^" operator?
import Prelude hid
On 8/9/07, Chad Scherrer <[EMAIL PROTECTED]> wrote:
>
>
> extract :: [Int] -> [a] -> [a]
> extract = f 0
> where
> f _ _ [] = []
> f _ [] _ = []
> f k nss@(n:ns) (x:xs) = if n == k then x:f (k+1) ns xs
> else f (k+1) nss xs
>
> This behaves roughly as
> e
On 8/9/07, Chad Scherrer <[EMAIL PROTECTED]> wrote:
>
> extract :: [Int] -> [a] -> [a]
> extract = f 0
> where
> f _ _ [] = []
> f _ [] _ = []
> f k nss@(n:ns) (x:xs) = if n == k then x:f (k+1) ns xs
> else f (k+1) nss xs
Finally, even if no one else is
1 - 100 of 487 matches
Mail list logo