|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 - 3 | Next > |
|
|
Re: Doubting HaskellOn 04/03/2008, Luke Palmer <lrpalmer@...> wrote:
> On Tue, Mar 4, 2008 at 4:16 AM, Ketil Malde <ketil@...> wrote: > > Paul Johnson <paul@...> writes: > > > > > I'm surprised you found the significant whitespace difficult. > > > > I wonder if this has something to do with the editor one uses? I use > > Emacs, and just keep hitting TAB, cycling through possible alignments, > > until things align sensibly. I haven't really tried, but I can > > imagine lining things up manually would be more painful, especially > > if mixing tabs and spaces. > > > Especially if mixing tabs and spaces indeed. Haskell does the Python > thing of assuming that a tab is 8 spaces, which IMO is a mistake. The > sensible thing to do if you have a whitespace-sensitive language that > accepts both spaces in tabs is to make them incomparable to each > other; i.e. I honestly think that tab characters occurring anywhere but in a comment should be considered a lexical error and rejected by the compiler outright. More problems are caused by trying to continue with only tabs, or some mixture of tabs and spaces than just getting one's editor to expand tabs automatically. - Cale _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Doubting Haskell> Especially if mixing tabs and spaces indeed. Haskell does the Python
> thing of assuming that a tab is 8 spaces, which IMO is a mistake. The FWIW, most people in python land think the same thing, and the -t flag makes mixed tabs and spaces a warning or error. At the least, -Wall could report mixed usage. At the most, make it an error. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Doubting HaskellAbout the line length needed for Haskell programs, there was a discussion about this some time ago, that could be regarded as a tutorial for reducing indentation: http://haskell.org/pipermail/haskell-cafe/2007-July/028787.html As for the idle core you mention: I keep one core fully occupied with a program that searches for a cure against cancer, see: http://www.computeagainstcancer.org/ The example you gave for the use of "map" can be simplified: map func (take (10 [0..])) -- should actually be: map func (take 10 [0..]) -> map func [0..9] Regards, Henk-Jan van Tuyl -- http://functor.bamikanarie.com http://Van.Tuyl.eu/ -- On Tue, 04 Mar 2008 07:29:24 +0100, Alan Carter <alangcarter@...> wrote: > Many thanks for the explanations when I was first experimenting with > Haskell. I managed to finish translating a C++ wxWidgets program into > Haskell wxHaskell, and am certainly impressed. > > I've written up some reflections on my newbie experience together with > both versions, which might be helpful to people interested in > popularizing Haskell, at: > > http://the-programmers-stone.com/2008/03/04/a-first-haskell-experience/ > > Regards, > > Alan > -- -- Met vriendelijke groet, Henk-Jan van Tuyl -- http://functor.bamikanarie.com http://Van.Tuyl.eu/ -- _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Doubting Haskell2008/3/4, Alan Carter <alangcarter@...>:
> I've written up some reflections on my newbie experience together with > both versions, which might be helpful to people interested in > popularizing Haskell, at: > > http://the-programmers-stone.com/2008/03/04/a-first-haskell-experience/ This is truly interesting, any learning experience is enlightening, we truly do need to lower this barrier of admittance of which you speak. On another subject, there are still point in your code that could be clearer or done with less cruft : maxOfHistogram stats = snd (foldl (\(cA, vA) (cB, vB) -> if (vA > vB) then (cA, vA) else (cB, vB)) (0, 0) stats) can become : maxofHistogram stats = foldl' max 0 (map snd stats) ("foldl' max 0" could be replaced by "maximum" but there wouldn't be a default 0 anymore) more importantly, you can replace this kind of code : vA <- varCreate [] vB <- varCreate [] -- ... vL <- varCreate [] vM <- varCreate [] vN <- varCreate [] vO <- varCreate [] by : [vA, vB, vC, vD, vE, vF, vG, vH, vI, vJ, vK, vL, vM, vN, vO] <- replicateM 15 (varCreate []) (true also for the "dA <- textEntry statusFrame [text := "0", alignment := AlignRight]" sequence) I'm not sure that functions like getdTotal couldn't be improved, I wonder if a small Map for the elements of d wouldn't make the code much better and offer other opportunities for abstractions. As it is, enumeration like : [[label "Total Entries", widget (getdTotal d)] ,[label "Valid Entries", widget (getdValid d)] -- ... ,[label "MDMA", widget (getdMdma d)] ,[label "Caffeine", widget (getdCaffeine d)]] could be slightly reduced by : let bindLabelAndWidget (lbl,getter) = [label lbl, widget (getter d)] in map bindLabelAndWidget [("Total Entries", getdTotal), ("Valid Entries", getdValid) ,(...)] And little thing like : mapM_ (\f -> do repaint f) knownFrames becoming : mapM_ repaint knownFrames I also do concur that a flag or a warning to signal mixed tabulations and space would be a _very_ good idea ! -- Jedaï _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Doubting Haskellchaddai.fouche:
> 2008/3/4, Alan Carter <alangcarter@...>: > > I've written up some reflections on my newbie experience together with > > both versions, which might be helpful to people interested in > > popularizing Haskell, at: > > > > http://the-programmers-stone.com/2008/03/04/a-first-haskell-experience/ > > > I also do concur that a flag or a warning to signal mixed tabulations > and space would be a _very_ good idea ! > Such a flag already exists: -fwarn-tabs As in: $ ghc -fwarn-tabs A.hs -no-recomp A.hs:3:0: Tab character -- Don _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Doubting HaskellThanks for an interesting write-up. And not bad for a first Haskell program. :)
There's still a number of things you could do to limit the boiler plate code, though. On Tue, Mar 4, 2008 at 6:29 AM, Alan Carter <alangcarter@...> wrote: Many thanks for the explanations when I was first experimenting with _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
|
|
Re: Doubting HaskellConcerning the Haskell program that does some statistics and displays
some graphs, I must say that if that were the task I had to solve I would not use either C++ or Haskell, but R, the open source S lookalike. The best way to be productive as a programmer is to not write code if you can steal it. R looks like an imperative language, but it is "value-oriented" in the same way that SETL is, so is by some criteria a functional language of sorts. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@... http://www.haskell.org/mailman/listinfo/haskell-cafe |
| < Prev | 1 - 2 - 3 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |