Re: [Haskell-cafe] Haskell - string to list isusses, and more

2009-06-14 Thread Toby Miller
Here's what I came up with.  I especially like the 2nd version, even  
though it's longer, as it seems very declarative.


caps1 s = all (\x - isUpper (head x)) (words s)

caps2 s = all startsWithUpper (words s) where
startsWithUpper w = isUpper (head w)


I'm also fairly new to Haskell, so I would appreciate feedback from  
the more experienced.


Thanks.


On Jun 14, 2009, at 11:19 AM, Gjuro Chensen wrote:



Hello everyone!

Im a Haskell newbie, and Ive have few unanswered questions. For  
someone more
experienced (at least I think so) its a very simple task, but I just  
cant
get a grip on it and its pretty frustrating. It wouldn't be that bad  
if I

haven't browse thru bunch of pages and tutorials and still nothing...
The problem is: take a string, and if every words starts with  
uppercase

letter then print yes, else no.
Forum Text Bold - yes
Frog image File - no

Ive had my share of approaches to this, but I just cant make it work.
Standard one seemed the most simple:

search :: String - String
search [] = []


and then use words (splits string on space) to split the string so I  
could
get a list and go through it recursively. But how to apply words to  
entered

string in this form?

To find the first letter I came up with: first = take 1 (head x). And
compare it with elem or ASCII values to determine if its upper case.

Any help, advice or suggestion is appreciated.

Thanks in advance!

--
View this message in context: 
http://www.nabble.com/Haskell---string-to-list-isusses%2C-and-more-tp24022673p24022673.html
Sent from the Haskell - Haskell-Cafe mailing list archive at  
Nabble.com.


___
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] How to know the build dependencies?

2009-06-14 Thread Toby Miller


On Jun 14, 2009, at 6:05 AM, Deniz Dogan wrote:


2009/6/14 Gwern Branwen gwe...@gmail.com:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On Sat, Jun 13, 2009 at 10:22 PM, Magicloud Magiclouds wrote:

Hi,
 I am learning to use cabal for my code.
 Just when I start, I met a question, is there an easy way to find
out what packages my code depends?

Thanks.


Not really. The easiest way is to just build your code and add every
package Cabal complains about being hid into your build-depends.
(Usually this won't take more than a minute or 3 if you're toggling
between a terminal and an editor.)

- --
gwern


Someone really ought to write a tool for this...





Visualising the Haskell Universe « Control.Monad.Writer___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe