On Fri, 11 Jun 1999, Erik Meijer wrote:
Personally I find the convention of using `a', `b', and `c' for type
variables to be a poor one. I much prefer using `t' (if there's
only one) or `t1', `t2', ... (if there's more than one).
I find that for me this makes it much easier to
Jonathan King wrote:
transformListElems :: (elem - elem') - List elem - List elem'
transformListElems transform Nil = Nil
transformListElems transform (Cons elem elemRest) =
Cons (transform elem) (transformListElems transform elemRest)
Well, the second version does more than
Jonathan King writes:
So, the name of a type is always at least a full word, as are the names of
specific functions. But type variables are almost always single
characters, and distinct from the names of any type. Conventionally, they
are also usually "a", "b", and "c", although "m" is for
I disagree, small scripts spend most of the time doing I/O if I don't
understand how to do that I'm not able to even write the most simple
things. This is eg. true for my cat ...
I disagree. You need to know more about Functional Programming
(and also the Haskell type system and its IO
Jan Skibinski [EMAIL PROTECTED] wrote:
But there are some stylistic camps, such as Eiffel's, that
prefer names with underscores rather than Hungarian notation
- claiming exactly the same reason: better readability. :-)
I don't see that underscores serve readability in the same way as
So, the name of a type is always at least a full word, as are the names of
specific functions. But type variables are almost always single
characters, and distinct from the names of any type. Conventionally, they
are also usually "a", "b", and "c", although "m" is for monad.
Conventionally
On Fri, 11 Jun 1999, Craig Dickson wrote:
I don't see that underscores serve readability in the same way as Hungarian
notation purports to (unless the Eiffel people claim that underscores
somehow convey type information?), so I don't see a conflict here. One could
easily use both, e.g.
I think this kind of thing is valuable... Hungarian notation [1]
serves the same purpose in Windows C / C++ programming. It *is*
valuable having canonical variable names for most situations; it reduces
the
intellectual load on the (human) reader of the code... you don't have to
check
At 16:37 Uhr +0200 09.06.1999, Friedrich Dominicus wrote:
I think exercise with the purely functional, non-I/O core (and perhaps
interact like someone else suggested) teaches you the mode of
thinking in purely functional languages. That thinking can also
help you understand the way I/O
On 09-Jun-1999, Friedrich Dominicus [EMAIL PROTECTED] wrote:
What's a HOF?
HOF is an acronym for Higher-Order Function.
--
Fergus Henderson [EMAIL PROTECTED] | "I have always known that the pursuit
WWW: http://www.cs.mu.oz.au/~fjh | of excellence is a lethal habit"
PGP: finger [EMAIL
What is difficult is that by using some predefined function, one can
express very much in very small code. I believe Haskell is even more
expressive than most OO languages with comparable libraries
(perhaps except Smalltalk, as that has also a very compact syntax).
I havn't
On Wed, 9 Jun 1999, Friedrich Dominicus wrote:
[snip]
What's a HOF?
A Higher Order Function, the key to code reuse and abstraction.
that first splits something up to a list using splitFn
(or with the generalization I mentioned, to a monad), then maps a
function over that list (namely
]
Subject: Re: how to write a simple cat
At 16:37 Uhr +0200 09.06.1999, Friedrich Dominicus wrote:
I think exercise with the purely functional, non-I/O core (and perhaps
interact like someone else suggested) teaches you the mode of
thinking in purely functional languages
Well, the cat has been skinned and boned, but I think I see a
shread of meat or two that hasn't been picked over yet...
On Thu, 10 Jun 1999, Frank A. Christoph wrote:
[some attributions missing...I hope you know who you are]
[big snip, about the fact that Haskell programs can be quite brief]
Hello!
On Fri, Jun 04, 1999 at 12:18:31PM +0200, Friedrich Dominicus wrote:
[...]
splitFilterMap unSplitFn afterMap filterPredicate beforeMap splitFn =
unSplitFn . map afterMap . filter filterPredicate . map beforeMap . splitFn
[...]
sorry this looks morre terrible to me than all
Hello!
On Wed, Jun 02, 1999 at 01:29:12AM -0700, Simon Peyton-Jones wrote:
[...]
- Would people actually add stuff? I'm a bit skeptical, but it would
be great to have my skepticism proved unfounded.
I think, Friedrich and those who helped him could have posted their
questions and
Hannah Schroeter wrote:
Hello!
On Fri, Jun 04, 1999 at 12:29:45PM +0200, Friedrich Dominicus wrote:
[...]
What is difficult is that by using some predefined function, one can
express very much in very small code. I believe Haskell is even more
expressive than most OO languages
Hello!
On Fri, Jun 04, 1999 at 12:29:45PM +0200, Friedrich Dominicus wrote:
[...]
What is difficult is that by using some predefined function, one can
express very much in very small code. I believe Haskell is even more
expressive than most OO languages with comparable libraries
Hans Aberg [EMAIL PROTECTED] writes:
Exactly how is this connection between the lambda calculus and
category theory described? -- That is, one would expect to know that
if one has a category of some sort, it is equivalent to the lambda
calculus, or something like that.
There is a very
Lennart Augustsson wrote:
Friedrich Dominicus wrote:
That might be good advice but I/O is one of the most essential things
and I have to know how to use it proper for writing small skripts.
Actually, you can do a lot without learning about I/O. The function `interact'
converts a
Hello!
On Wed, Jun 02, 1999 at 08:12:04AM +0200, Friedrich Dominicus wrote:
[...]
this seems to to the thing I would like it to do. I now have to check if
the given fn is valid and raise an error if not so I do think I'll make
it;-)
No you don't have to check fn. readFile checks and throws
Then split it up like you'd do in an OO language. I think, FP also
is good for writing small functions that do one thing well, and then
composing them in various ways (as you see, composing functions (and
perhaps also values) in Haskell is possible in very many various ways :-) ).
In the
On Thu, 3 Jun 1999, Hans Aberg wrote:
A ``category with + and ^ '' is called cartesian closed aditive
category, cf MacLane, Category Theory for the Working Mathematician
Is this a suggestion or a theorem?
A definition.
-- m
At 14:18 +0200 1999/06/04, Mariano Suarez-Alvarez wrote:
A ``category with + and ^ '' is called cartesian closed aditive
category, cf MacLane, Category Theory for the Working Mathematician
Is this a suggestion or a theorem?
A definition.
I did not see the connection between the + and ^ of
Friedrich Dominicus wrote:
That might be good advice but I/O is one of the most essential things
and I have to know how to use it proper for writing small skripts.
Actually, you can do a lot without learning about I/O. The function `interact'
converts a `String-String' function into an IO
So after I read in a chunk form that file
into one large String, lines splits that line on a '\n' position. The
lines li are filtered and l is one line a String-List which is added to
fl all the filterd lines are then put back into on large String. Uff. Is
that nearly correct?
Yes,
Hello, Friedrich.
On Tue, Jun 01, 1999 at 04:04:42PM +0200, Friedrich Dominicus wrote:
[...]
longerThan :: String {- filename -} - Int {- length limit -} - IO ()
longerThan fn lenlim = do
content - readFile fn
let li = lines content
fl = filter (\l - length l lenlim)
At 20:08 +0200 1999/06/03, Mariano Suarez-Alvarez wrote:
A ``category with + and ^ '' is called cartesian closed aditive
category, cf MacLane, Category Theory for the Working Mathematician
Is this a suggestion or a theorem?
Hans Aberg
* Email: Hans Aberg mailto:[EMAIL
On Wed, 2 Jun 1999, Hans Aberg wrote:
But it can be a spin-off for thoughts: A category is essentially an object
with I and *, and a functor is a map preserving those. So what about the
two other operations, + and ^ ?.
A ``category with + and ^ '' is called cartesian closed aditive
category,
Do you want to drive me away from learning Haskell? Who the
hell can try
to write such functions? Is readabilty not a concern in Haskell?
I would have to agree, Sven does seem to be working hard to drive a
beginner away from Haskell. But he is illustrating an important
coding
I know, we all have something else to do than to take on extra
responsibilities. But if someone could donate an access to a
fast web server (mine is just too slow) then we could go
along Wiki-Wiki Web Server concepts
(http://c2.com:8080/WikiWikiWeb) and have
"Hans" == Hans Aberg [EMAIL PROTECTED] writes:
One reason flip(.) might be given a symbol similar to multiplication and
flip($) a symbol similar to exponentiation is that on the Church integer
functionals, these two operations are just the multiplication and
exponentiation
At 12:44 +0100 1999/06/02, Peter Hancock wrote:
One reason flip(.) might be given a symbol similar to multiplication and
flip($) a symbol similar to exponentiation is that on the Church integer
functionals, these two operations are just the multiplication and
exponentiation of
haskell.org is the obvious place. I'm sure John Peterson would be happy
to add stuff to the site.
Community-generated FAQ pages sound great, but
- Some (standard? readily-available?) technology is needed to allow
people to add stuff without intervention from the site organiser.
Hans Aberg wrote:
[...] Then together with the identity I, +, * and ^ can be written
out to be a primitive set for the lambda theory. That is, all lambda
expressions can be generated from these symbols.
Impressive! %-) Hmmm, I just thought about the possible directions
of this discussion if
At first, thanks to all of you about this nice insight into FP used
programmers. It was really a suprise to me to see that that what Sven
wrote seems to be easily understood. I would really like to see such
code-snippets to found on a central site what about www.haskell.org ?
I reread my book
Simon Peyton-Jones writes:
Community-generated FAQ pages sound great, but
- Some (standard? readily-available?) technology is needed to allow
people to add stuff without intervention from the site organiser.
The Wiki-Wiki-Web stuff indeed looks like a real possibility. I didn't
At 11:57 +0900 1999/06/02, Frank A. Christoph wrote:
I just wish a standard operator is chosen for a) flip (.) and b) flip
($) instead of having everyone make up their own. I don't really care
what it is. I truthfully like . for flip (.) and # for flip ($) but I
can easily change.
The
Hans Aberg wrote:
But it can be a spin-off for thoughts: A category is essentially an object
with I and *, and a functor is a map preserving those. So what about the
two other operations, + and ^ ?.
I somehow managed to delete Hans's earlier post in which he gives the
definitions for + and
At 16:46 +0200 1999/06/02, Sven Panne wrote:
[...] Then together with the identity I, +, * and ^ can be written
out to be a primitive set for the lambda theory. That is, all lambda
expressions can be generated from these symbols.
Impressive! %-) Hmmm, I just thought about the possible
Hannah Schroeter wrote:
Hello!
On Mon, May 31, 1999 at 06:01:31PM +0200, Friedrich Dominicus wrote:
Hannah Schroeter wrote:
Hello!
On Fri, May 28, 1999 at 08:00:27AM +0200, Friedrich Dominicus wrote:
I wrote before with my trouble understanding hugsIsEOF. But I don't have
Hello!
On Tue, Jun 01, 1999 at 06:58:32AM +0200, Friedrich Dominicus wrote:
[...]
I want to do the following, read a file line by line and finding out
which line is longer than x-chars. I want to print out which lines are
so long. I think that can just be done line-wise.
Thanks for you
Hannah Schroeter wrote:
[...] So, still no need to fuzz with file handles :-)
... and no need to fuzz with intermediate names, either. :-) If you
define an operator for reversed function composition
(.|) = flip (.)
and read it like a pipe in *nix, you get a one-liner:
longerThan fn
Hannah Schroeter wrote:
Hello!
On Tue, Jun 01, 1999 at 06:58:32AM +0200, Friedrich Dominicus wrote:
[...]
I want to do the following, read a file line by line and finding out
which line is longer than x-chars. I want to print out which lines are
so long. I think that can just be
It would be nice if the prelude defined more general functions like:
splitStr c s = left:case right of [] - []; otherwise - splitStr c (tail right)
where (left,right)=span (/=c) s
joinStr c l = case l of []- []; otherwise - foldl1 (\x y-x++c:y) l
The implementation of lines and unlines
Friedrich Dominicus wrote:
[...] How can I combine the output with a line-number can I put that
into the filter? Or do I have to found another solution?
Don't fear! Mr. One-Liner comes to the rescue:;-)
longerThan fn lenlim = readFile fn = lines .| filter (length .| (lenlim)) .| zip
Keith Wansbrough wrote:
Sven Panne wrote:
Don't fear! Mr. One-Liner comes to the rescue:;-)
longerThan fn lenlim = readFile fn = lines .| filter (length .| (lenlim))
.| zip [1..] .| map (\(n,l) - shows n ") " ++ l) .| unlines .| putStr
Friedrich wrote:
Do you want to
Date: Tue, 01 Jun 1999 17:32:22 +0200
From: Sven Panne [EMAIL PROTECTED]
Don't fear! Mr. One-Liner comes to the rescue:;-)
longerThan fn lenlim = readFile fn = lines .| filter (length .| (lenlim)) .|
zip [1..] .| map (\(n,l) - shows n ") " ++ l) .| unlines .| putStr
Are you sure
Keith Wansbrough wrote:
Sven Panne wrote:
Don't fear! Mr. One-Liner comes to the rescue:;-)
longerThan fn lenlim = readFile fn = lines .| filter (length .| (lenlim))
.| zip [1..] .| map (\(n,l) - shows n ") " ++ l) .| unlines .| putStr
Friedrich wrote:
Do you want to
On Tue, 1 Jun 1999, Sven Panne wrote:
Friedrich Dominicus wrote:
[...] How can I combine the output with a line-number can I put that
into the filter? Or do I have to found another solution?
Don't fear! Mr. One-Liner comes to the rescue:;-)
How about initiating Haskell
Sven Panne wrote:
Don't fear! Mr. One-Liner comes to the rescue:;-)
longerThan fn lenlim = readFile fn = lines .| filter (length .| (lenlim)) .|
zip [1..] .| map (\(n,l) - shows n ") " ++ l) .| unlines .| putStr
Friedrich wrote:
Do you want to drive me away from learning
Hannah Schroeter wrote:
Hello!
On Fri, May 28, 1999 at 08:00:27AM +0200, Friedrich Dominicus wrote:
I wrote before with my trouble understanding hugsIsEOF. But I don't have
found a clean way just to write a cat. Can s.o give me a hand?
import System(getArgs)
file2stdout :: String {-
Hello!
On Mon, May 31, 1999 at 06:01:31PM +0200, Friedrich Dominicus wrote:
Hannah Schroeter wrote:
Hello!
On Fri, May 28, 1999 at 08:00:27AM +0200, Friedrich Dominicus wrote:
I wrote before with my trouble understanding hugsIsEOF. But I don't have
found a clean way just to write a
On Fri, May 28, 1999 at 04:00:27PM EST, Friedrich Dominicus wrote:
I wrote before with my trouble understanding hugsIsEOF. But I don't have
found a clean way just to write a cat. Can s.o give me a hand?
Hi,
You shouldn't need to use hugsIsEOF. Here's one possible
implementation of a
module Main ( main ) where
import IO
import System
main :: IO ()
main = do args - getArgs
s - case args of
[]- getContents
[inF] - readFile inF
_ - fail "Sorry, only 0 or 1 args implemented"
putStr s
--KW 8-)
--
:
55 matches
Mail list logo