Sorry to Duncan, I hit reply which just sent my reply to your own
email address not to the mailing list. Second time I've made that
mistake. Hopefully this one will reach the list instead.
I can't even check out the darcs version from the repository because
that gives me an error (on
G'day all.
Quoting raghu vardhan [EMAIL PROTECTED]:
So, any algorithm that sorts is no good (think of n as huge, and k small).
The essence of all the answers that you've received is that it doesn't
matter if k is small, sorting is still the most elegant answer in Haskell.
The reason is that
Dave Feustel [EMAIL PROTECTED] writes:
A serious omission in Haskell tutorials is a collection of examples of how to
write Haskell solutions for problems that would use arrays in any imperative
language.
I see that arrays can be defined in Haskell, but I don't see their use as
[sorry for the double, ajb]
Since there seemed to be a disconnect between the expectation and
the previous answers, I thought an alternative suggestion might help
out. This sort of thing (haha) usually isn't my cup o' tea, so please
point out any blunders.
RM, is this more like what you had in
On Thu, 2007-04-12 at 16:02 +1000, Ruben Zilibowitz wrote:
I can't even check out the darcs version from the repository because
that gives me an error (on applying patch 107/256 from memory). So I
am using the tarball for c2hs-0.14.5. Here is the problem:
Ah, the problem with case
kynn wrote:
(I don't need elegant
factorial or Fibonacci functions in my everyday work.)
I think you do. Most of your utility programs probably fit into the
simple frame of
main = interact $ unlines . map f . lines
for suitable f. Of course, f is hardly ever the factorial function, but
it
Ok I managed to check out a version from darcs. Now this is happening:
./Setup.hs build
Preprocessing executables for c2hs-0.14.6...
Setup.hs: c2hs/c/CLexer.x: no alex preprocessor available
The installation instructions don't mention that I need the alex
package. I guess I can just install it
raghu vardhan [EMAIL PROTECTED]:
So, any algorithm that sorts is no good (think of n as huge, and k small).
With lazy evaluation, it is!
http://article.gmane.org/gmane.comp.lang.haskell.general/15010
[EMAIL PROTECTED] wrote:
The essence of all the answers that you've received is that it
On Thu, 2007-04-12 at 18:55 +1000, Ruben Zilibowitz wrote:
Ok I managed to check out a version from darcs. Now this is happening:
./Setup.hs build
Preprocessing executables for c2hs-0.14.6...
Setup.hs: c2hs/c/CLexer.x: no alex preprocessor available
The installation instructions don't
I was translating some perl code to haskell as a learning exercise and
wound up with the following. (below) Simple code that accepts some
string arguments, and prints a string -- so, of type String - String
- String - String - IO ().
I like to be concise, but I get the feeling something went
Neil Mitchell wrote:
Let's hold off on this for now. I don't think Haddock warrants a full
Trac of
its own just yet, the overheads of managing a Trac are pretty high
compared to
editing the text file called TODO in the root of the Haddock
source tree
:-)
What do you think of the Google
Folks,
The ghc/compiler/typecheck directory holds a rather large body of
code and quick browsing through did not produce any insight.
How do you implement type checking in haskell?
Assume I have an Expr type with a constructor per type and functions
can take lists of expressions. Do I
Ok, thanks. I finally managed to build it.
Ruben
On 12/04/2007, at 8:30 PM, Duncan Coutts wrote:
On Thu, 2007-04-12 at 18:55 +1000, Ruben Zilibowitz wrote:
Ok I managed to check out a version from darcs. Now this is
happening:
./Setup.hs build
Preprocessing executables for c2hs-0.14.6...
Joel,
How do you implement type checking in haskell?
You might want to check out Typing Haskell in Haskell [1] by Mark
P. Jones.
Cheers,
Stefan
[1] Jones, Mark P. Typing Haskell in Haskell. In Erik Meijer, editor,
Proceedings of the 1999 Haskell Workshop, Friday October 9th, 1999,
On Apr 12, 2007, at 1:07 PM, Stefan Holdermans wrote:
You might want to check out Typing Haskell in Haskell [1] by Mark
P. Jones.
Must be _the_ paper as Don suggested it as well.
I also looked at my copy of Andrew Appel's compilers in ML book and
realized that I should be going about it
I feel I should set aside a Friday of every week just to read the
Haskell papers :-).
After skimming through Typing Haskell in Haskell I have a couple of
questions...
Are type constructors (TyCon) applicable to Haskell only? Mine is a
Pascal-like language.
How would I type Pascal
On Apr 12, 2007, at 14:37 , Joel Reymont wrote:
I feel I should set aside a Friday of every week just to read the
Haskell papers :-).
After skimming through Typing Haskell in Haskell I have a couple
of questions...
Are type constructors (TyCon) applicable to Haskell only? Mine is a
Hi Joel,
You may like to check out my mini-interpreter called (cheekily) baskell:
http://www.cs.mu.oz.au/~bjpop/code.html
It has type inference, and it is pretty straightforward. I wrote it for
teaching purposes.
First, I pass over the AST and generate a set of typing constraints. They
are
On 11/04/2007, at 7:52 pm, Chris Witte wrote:
I made this change but I still get the error
unknown symbol `_gettimeofday'
I'm using mingw 5.1.3 which as far as i can tell should use the
3.11 runtime.
Ensure that HAVE_GETTIMEOFDAY is defined in mk/config.h.
Also, I discovered that changes to
Hi. I can't find that post. Could you point it to me please?
Thanks!
kj
riccardo cagnasso wrote:
The post on dons' blog about the cpu scaler is a great example on how
haskell can easily used in the day-to-day hacking!
2007/4/11, brad clawsie [EMAIL PROTECTED]:
i find that don's
Hallo,
On 4/12/07, kynn [EMAIL PROTECTED] wrote:
Hi. I can't find that post. Could you point it to me please?
It's in here:
http://cgi.cse.unsw.edu.au/~dons/blog/2007/03/10#programmable-semicolons
--
-alex
http://www.ventonegro.org/
___
On Thu, Apr 12, 2007 at 01:04:13PM +0100, Joel Reymont wrote:
Folks,
The ghc/compiler/typecheck directory holds a rather large body of
code and quick browsing through did not produce any insight.
How do you implement type checking in haskell?
Assume I have an Expr type with a
On Thu, 12 Apr 2007, raghu vardhan wrote:
What's the best way to implement the following function in haskell:
Given a list and an integer k as input return the indices of the least k
elements in the list. The code should be elegant and also, more importantly,
must not make more than the
Thanks Stefan!
On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote:
Your problem, as I understand it, is even simpler than most since
there are no higher order functions and no arguments.
I do have functions and arguments but I don't have HOF.
(That said, it would probably be better to fuse
On 4/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
To get the indices, use the Schwartzian transform:
sortWith :: (Ord b) = (a - b) - [a] - [a]
sortWith f = mergeRuns . runs
where
runs = map (:[])
mergeRuns [] = []
mergeRuns [xs] = xs
mergeRuns xss = mergeRuns (mergeRun
On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote:
Also, GHC runs typechecking *before* desugaring, apparently
thinking error messages
are more important than programmer sanity :)
What would be the benefit of running type checking after desugaring?
--
http://wagerlabs.com/
Kurt Hutchinson wrote:
On 4/12/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
To get the indices, use the Schwartzian transform:
sortWith :: (Ord b) = (a - b) - [a] - [a]
sortWith f = mergeRuns . runs
where
runs = map (:[])
mergeRuns [] = []
mergeRuns [xs] = xs
On 4/12/07, Joel Reymont [EMAIL PROTECTED] wrote:
What would be the benefit of running type checking after desugaring?
After desugaring, the program is written in a much more simple
language (GHC Core). Type checking a desugared program is much easier
because the type checker has to deal with
I believe there is a library which lets you do do perl style REGEX matching
maybe you should check that out
On 4/12/07, Thomas Hartman [EMAIL PROTECTED] wrote:
I was translating some perl code to haskell as a learning exercise and
wound up with the following. (below) Simple code that accepts
Hi,
I've built and installed c2hs on my Mac OS X system now. I read
through the research paper on c2hs available on the website for c2hs
and decided I would need to try it out to learn it. But it gives me
errors which I am having trouble trying to understand. Here are the
error messages:
On Wed, 11 Apr 2007, Ryan Dickie wrote:
I also hate matlab to death. Is there any possibility of using haskell as a
replacement using ghci? Mostly i care about linalg when it comes to using
matlab.
Doing numerical linear algebra with Haskell is already possible:
The link pretty much answers my question, though you probably require a
little bit more book keeping to get the indices out. Compared to the
iterative version or the matlab version, this definitely is more elegant,
but also is trickier.
apfelmus wrote:
raghu vardhan [EMAIL PROTECTED]:
So,
\begin{code}
kmin :: Ord a = Int - [a] - [Int]
kmin k x = map snd $ Set.toList $ foldl' insertIfSmall (Set.fromList h) t
where
(h, t) = splitAt k $ zip x [0..]
insertIfSmall :: Ord a = Set.Set a - a - Set.Set a
insertIfSmall s e
| e mx= Set.insert e s'
| otherwise = s
where
(mx, s')
\begin{code}
kmin :: Ord a = Int - [a] - [Int]
kmin k x = map snd $ Set.toList $ foldl' insertIfSmall (Set.fromList h) t
where
(h, t) = splitAt k $ zip x [0..]
insertIfSmall :: Ord a = Set.Set a - a - Set.Set a
insertIfSmall s e
| e mx= Set.insert e s'
| otherwise = s
where
(mx, s')
How does
expr = b a*
translate back into the grammar? Assuming that I had b, c, d...
expr = b | c | d | many (do { symbol :; expr; symbol :;
expr })
Like this?
Thanks, Joel
On Apr 11, 2007, at 8:56 PM, Lennart Augustsson wrote:
I presume your grammar has other clauses for expr,
Does the answer change if the data source isn't a list, already in memory,
but a stream? That is, will the sort end up pulling the entire stream into
memory, when we only need k elements from the entire stream.
Interestingly, this is almost exactly the same as one of my standard
interview
You need a sequence of b, and then a*. So
expr = do
p - b | c | d
q - many (...)
return ...
On Apr 12, 2007, at 20:04 , Joel Reymont wrote:
How does
expr = b a*
translate back into the grammar? Assuming that I had b, c, d...
expr = b | c | d | many (do { symbol :; expr;
It's so much easier to write the type checker because it's only a few
constructs left in the language. But from a user's perspective it's
a really bad idea.
-- Lennart
On Apr 12, 2007, at 15:25 , Joel Reymont wrote:
On Apr 12, 2007, at 3:00 PM, Stefan O'Rear wrote:
Also, GHC
On Fri, 2007-04-13 at 02:37 +1000, Ruben Zilibowitz wrote:
Hi,
I've built and installed c2hs on my Mac OS X system now. I read
through the research paper on c2hs available on the website for c2hs
and decided I would need to try it out to learn it. But it gives me
errors which I am
Awesome that works!
Thanks for your help.
Well that works for the ghc-6.7.20070402 tar ball but if I try and
pull down the darcs head it fails to make with
make[1]: Entering directory `/c/cwitte/source/ghc/libraries'
rm -f -f stamp/configure.library.*.base
cd base setup/Setup configure \
G'day all.
Quoting Kurt Hutchinson [EMAIL PROTECTED]:
For my own edification, what is the benefit of this sortWith over sortBy?
None. I wanted to write my own sort, illustrating how the lazy
evaluation thing works, and I didn't want a name clash with an
existing library function.
Cheers,
Jan-Willem Maessen:
Interestingly, in this particular case what we obtain is isomorphic
to constructing and reversing a list.
Jan-Willem's observation also hints at some interesting performance
characteristics of difference lists. It's well known that difference
lists give O(1) concatenation,
Ah, but which k elements? You won't know until you've drained your
entire stream!
Dan
Steve Downey wrote:
Does the answer change if the data source isn't a list, already in
memory, but a stream? That is, will the sort end up pulling the entire
stream into memory, when we only need k elements
I'm pleased to announce that the xmonad window manager now
has a mailing list set up:
http://www.haskell.org/mailman/listinfo/xmonad
For those who don't know, xmonad is a tiling window manager written in
Haskell. You can find more about it at:
http://xmonad.org
and Lennart
Dan Weston [EMAIL PROTECTED] writes:
Ah, but which k elements? You won't know until you've drained your
entire stream!
True, but you still don't need to keep the whole stream in memory at
once, just the k-least-so-far as you work your way through the stream -
once you've read a part of the
Both Yitzchak's and my suggestions should run in constant space--some
strictness annotation or switching to foldl' might be necessary.
On 4/12/07, Mark T.B. Carroll [EMAIL PROTECTED] wrote:
Dan Weston [EMAIL PROTECTED] writes:
Ah, but which k elements? You won't know until you've drained your
G'day all.
Quoting apfelmus [EMAIL PROTECTED]:
You mean O(k * log n + n) of course.
Erm, yes. You can do it in an imperative language by building a heap
in O(n) time followed by removing k elements, in O(k log n) time.
Cheers,
Andrew Bromage
___
On 13/04/2007, at 11:03 am, Chris Witte wrote:
Well that works for the ghc-6.7.20070402 tar ball but if I try and
pull down the darcs head it fails to make with
...
I wonder what has changed between then and now to cause this.
Not sure about that one, I was building ghc-6.6. Darcs should be
I've finished a good sized Haskell project which I now must expose as a
library (along with a lot of C code) to my fellow engineers. I had
originally devoped my code on Windows XP and managed to learn how to wrap my
Haskell code in a DLL and create an MSVC linkable library stub for the DLL.
On Thu, 2007-04-12 at 21:48 -0700, SevenThunders wrote:
I guess I am surprised that on linux, with all of it's amazing software
development tools, that Haskell export libraries would be this tricky to
develop.
I guess it's because most of the existing Haskell hackers are going the
other
50 matches
Mail list logo