Maurício [EMAIL PROTECTED] writes:
Why isn't this one [valid code]?
module Main where
main = do {
let a = 3;
return ();
};
My guess is that the compiler is confused about whether you mean
do let a = 3
return ()
or (your intended):
do let a = 3
Marc Weber [EMAIL PROTECTED] writes:
I tried downloading, eclipse and the latest EcplipseFP zip file.
I couldn't use the standard installer (Help- Add Features ..) because
it didn't find anything..
Strange, that worked for me.
From my quick look, Eclipse looks like a workable candidate.
Peter [EMAIL PROTECTED] writes:
So, How am I supposed to get the value of an IO Monad, such as IO
String, without returning an IO Monad?
Short answer: you don't. IO is a one way street.
Build your application top down in the IO monad (starting with
'main'), and bottom up with pure code,
IBRAHIM MOSHAYA [EMAIL PROTECTED] writes:
I need to write a function to return a given number
Homework assignment?
Perhaps if you get stuck, you can post your best current effort, and
people will be able to nudge you in the right direction?
-k
--
If I haven't seen further, it is by standing
Sebastian Sylvan [EMAIL PROTECTED] writes:
I think you need to run the Fasta benchmark with N=25 to
generate the input file for this benchmark...
I made the file available at http://www.ii.uib.no/~ketil/knuc.input
-k
--
If I haven't seen further, it is by standing in the footprints of
Brian Hulley [EMAIL PROTECTED] writes:
You can't be serious. This would cause far more problems than the
current rule.
Why? Surely typing one tab is better than having to hit the spacebar 4
(or 8) times?
What you type depends on your editor. I hit tab, and the editor
inserts an appropriate
Christian Maeder [EMAIL PROTECTED] writes:
That should correspond to your taste as well, although someone
(ie. S.M.) proposed to disallow the dot as operator in haskell'.
From http://hackage.haskell.org/trac/haskell-prime/wiki/CompositionAsDot:
| We lose . as composition. Mostly this doesn't
zell_ffhut [EMAIL PROTECTED] writes:
Just wondering if anyone can help me with a Haskell problem im having.
How would I get the value of, lets say, the 9th object in [4179355,
567412] ?
You mean the ninth character in the concatenation of the list of
strings? Concatenate the strings, and
Neil Mitchell [EMAIL PROTECTED] writes:
And a related question is: Which packages are searchable by Hoogle?
The best answer to that is some. I intentionally excluded OpenGL and
other graphics ones because they have a large interface and yet are
not used by most people using Haskell.
I'm not
Tom Hawkins tomahawk...@gmail.com writes:
Second, I would like to know what exactly is bad about a Haskell
job in investment banking as a lot of good programmers work in this
industry.
It's disproportionate. 95% of the job offerings in functional
programming are with investment firms. I
Henning Thielemann schlepp...@henning-thielemann.de writes:
about functional programming jobs in investment banking ...
I don't think this is bad: having talented people recruited to work
on functional programming will improve the technology for all of us.
I'm not sure I follow this opinion
Simon Peyton-Jones simo...@microsoft.com writes:
In contrast, in a pure functional language there are no reads and
writes, so all the pure part has zero overhead. Only when you do
readTVar' and 'writeTVar' do you pay the overhead; these are a tiny
fraction of all memory accesses.
I'm
Johan Tibell johan.tib...@gmail.com writes:
Here's a rule of thumb: If you have binary data, use Data.ByteString. If you
have text, use Data.Text.
If you have a large amount of mostly ASCII text, use ByteString, since
Data.Text uses twice the storage. Also, ByteString might make more
sense if
Kevin Jardine kevinjard...@gmail.com writes:
Almost every modern programming language has one or at most two
standard representations for strings.
That includes PHP, Python, Ruby, Perl and many others. The lack of a
standard text representation in Haskell has created a crazy patchwork
of
Benedikt Huber benj...@gmx.net writes:
Despite of all this, I think the performance of the text
package is very promising, and hope it will improve further!
I agree, Data.Text is great. Unfortunately, its internal use of UTF-16
makes it inefficient for many purposes.
A large fraction -
Johan Tibell johan.tib...@gmail.com writes:
It's not clear to me that using UTF-16 internally does make Data.Text
noticeably slower.
I haven't benchmarked it, but I'm fairly sure that, if you try to fit a
3Gbyte file (the Human genome, say¹), into a computer with 4Gbytes of
RAM, UTF-16 will
Ivan Lazar Miljenovic ivan.miljeno...@gmail.com writes:
Seeing as how the genome just uses 4 base letters,
Yes, the bulk of the data is not really text at all, but each sequence
(it's fragmented due to the molecular division into chromosomes, and
due to incompleteness) also has a textual
Michael Snoyman mich...@snoyman.com writes:
As far as space usage, you are correct that CJK data will take up more
memory in UTF-8 than UTF-16.
With the danger of sounding ... alphabetist? as well as belaboring a
point I agree is irrelevant (the storage format):
I'd point out that it seems
Yitzchak Gale g...@sefer.org writes:
I don't think the genome is typical text.
I think the typical *large* collection of text is text-encoded data, and
not, for lack of a better word, literature. Genomics data is just an
example.
-k
--
If I haven't seen further, it is by standing in the
Colin Paul Adams co...@colina.demon.co.uk writes:
Char is not an encoding, right?
Ivan No, but in GHC at least it corresponds to a Unicode codepoint.
I don't think this is right, or shouldn't be right, anyway.. Surely it
stands for a character. Unicode codepoints include non-characters
Felipe Lessa felipe.le...@gmail.com writes:
[-snip- I've already spent too much time on the other stuff :-]
And what do you think about creating a real SeqData data type
with two bases per byte? In terms of processing speed I guess
there will be a small penalty, but if you need to have large
John Millikin jmilli...@gmail.com writes:
The reason many Japanese and Chinese users reject UTF-8 isn't due to
space constraints (UTF-8 and UTF-16 are roughly equal), it's because
they reject Unicode itself.
Probably because they don't think it's complicated enough¹?
Shift-JIS and the
Albert Y. C. Lai tre...@vex.net writes:
Looks like the free web counter was sold to an advertiser as few years ago.
I've seen this happen before, and it's just a strategy - first provide
some cross-site neat function, wait around for a while, then replace it
with some ad-serving crap.
Take
Alex Rozenshteyn rpglove...@gmail.com writes:
I understand that
fib50 = slowFib 50
will take a while to run the first time but be instant each subsequent call;
does this count as memoization?
I didn't see anybody else answering this in so many words, but I'd say
no, since you only name one
Matthias Kilian k...@outback.escape.de writes:
http://www.vimeo.com/15462768
And is there any way to just *download* the video? For people not
using adobe flash?
+1. I'd like to watch video offline on my phone, so Flash isn't really
a good option. It doesn't work on my computer either,
Max Bolingbroke batterseapo...@hotmail.com writes:
[1] http://hackage.haskell.org/trac/haskell-prime/ticket/41
I tried to find anything about lambda-if in there, but failed (Trac and
I aren't on very friendly terms, so it's probably my fault). Is there
more information about the rationale and
Donn Cave d...@avvanta.com writes:
I think you're not the first to ask. Just out of curiosity, or is
there a use for these variations?
Just that they seem to be natural generalizations. If it's just the
single form of paramtrizing the condition, I think it's better served by
a regular
Hemanth Kapila saihema...@gmail.com writes:
Just out of curiosity, may I know a use case of such huge arrays?
Bloom filters?
At such sizes, I thought, the array would not have the expected array
properties (constant access time) due to thrashing.
Yes, but this is true for any array size,
Hemanth Kapila saihema...@gmail.com writes:
Let us say, we are using a bit-array of size 2^43 (that is, a byte array of
size 2^40) to store a bloom filter. And let us further assume that we are
interested in a false-positive probability of 0.01
Since we are just making up numbers, let us
Christian Sternagel c.sterna...@gmail.com writes:
recently I was wondering about the two words order and ordering
I would use ordering to mean the relation or function that orders
(ranks) elements, and I'd use order to refer the actual progression.
So by applying an ordering, you get elements
Jacek Generowicz jacek.generow...@cern.ch writes:
Let's say I need an Int - String. Both
(fnA2 :: Banana - String) . (fnA1:: Int - Banana)
and
(fnB2 :: Onion - String) . (fnB1 :: Int - Onion)
will do. So please allow me to store (fnA1, fnA2) and (fnB1, fnB2) in
the same place.
Jacek Generowicz jacek.generow...@cern.ch writes:
def memoize(fn):
cache = {}
def memoized_fn(*args):
if args not in cache:
cache[args] = fn(*args)
return cache[args]
return memoized_fn
Here's a simplified memoizer for Haskell:
memoize :: (Integral t)
I needed GHC on a new machine, and went to download a binary tarball.
First, I go to http://haskell.org/ghc/download_ghc_6_12_3.html,
which kindly suggests to get the Haskell Platform instead.
Then, at http://hackage.haskell.org/platform/linux.html, I'm told that I
first need GHC, and pointed
Bernie Pope florbit...@gmail.com writes:
You can use side effects to observe the order of evaluation, by
wrapping observed expressions (thunks) with some IO computation inside
unsafePerformIO.
Not what OP asks for, but I've used a variant of this as a rather
hackish to provide progress
Don Stewart d...@galois.com writes:
First, I go to http://haskell.org/ghc/download_ghc_6_12_3.html,
which kindly suggests to get the Haskell Platform instead.
Then, at http://hackage.haskell.org/platform/linux.html, I'm told that I
first need GHC, and pointed back to the GHC download page.
Don Stewart d...@galois.com writes:
Linux users don't have easy binary installers, usually.
Speaking about which - this is made a lot more difficult than it need be
due to the way libc doesn't work with statically linked executables.
Basically, it seems to manually load hardwired dynamic
Brandon S Allbery KF8NH allb...@ece.cmu.edu writes:
Linux users don't have easy binary installers, usually. What can we do
about this bootstrapping problem?
I thought the answer to that was supposed to be bug your distribution to
package the Platform.
In my case, it's more like bug the IT
Don Stewart d...@galois.com writes:
Good start, if only the advanced were replaced with something more
characteristic, like lazy, or statically typed. Which, BTW, both do not
lazy and statically typed don't mean much to other people. They are
buzz words that mean nothing to many people.
But
Malcolm Wallace malcolm.wall...@me.com writes:
might value HWN as a quick-summary catchup of community news. Can you
resume posting HWN there as well please?
s/as well/instead/g
I'm always getting two copies of everything in haskell@, since
everything is cross-posted to -cafe. Are there
Daniel Fischer daniel.is.fisc...@web.de writes:
I have long been subscribed to -cafe but not to hask...@.
Regarding why, I wasn't interested in what haskell@ was supposed to be for,
while I was interested in what -cafe is for.
The Wiki documents these lists as:
hask...@haskell.org
Peter Hercek pher...@gmail.com writes:
I am. In part because I don't want to get two copies of everything,
but in part because I'm lazy.
This is my case too. As for as the amount of messages, who cares.
Right. So the question is, what is (or should be) the contents of the
messages that are
Antoine Latter aslat...@gmail.com writes:
I have posted to this list for over 3 years now and until lately it was an
enlightening experience. The responses to my questions have usually been
helpful and friendly.
Right - in most cases, the Haskell community is fanatically non-hostile.
At least
Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com writes:
Have you tried passing -optl-static to ghc (which causes -static to be
passed to ld)?
It used to be: -optl-static -optl-pthread
But it doesn't seem to work anymore on my install.
% ./a.out
a.out:
Conor McBride co...@strictlypositive.org writes:
...seemed like a good plan. I got lots of scary warnings like
(.text+0x51d8): warning: Using 'setprotoent' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
I guess the message
Daniel Fischer daniel.is.fisc...@web.de writes:
On Saturday 30 October 2010 03:42:27, Ivan Lazar Miljenovic wrote:
On 30 October 2010 12:22, Lauri Alanko l...@iki.fi wrote:
On Thu, Oct 28, 2010 at 01:55:12PM -0700, Don Stewart wrote:
The number of subscribers to the Haskell Reddit, for
Andrew Coppin andrewcop...@btinternet.com writes:
On a somewhat tangental note: It seems increadible to me that Haskell
was invented in 1990, and Miranda way back in 1985. At the same time,
Commodore Business Machines released the iconic Commodore 64 in 1982,
It is amazing - although as you
Hi,
On experimenting with concurrency, I got somewhat surprising result. I
have a program ('flower') that reads an input file and generates one or
more output files. As the different output files are independent, I
construct one IO action for each output requested on the command line,
and just
Richard O'Keefe o...@cs.otago.ac.nz writes:
Automatically? Probably not.
Like biologist can determine the distance between two genotypes, and
determine a hierarchy between species from that.
I'm going to say the same as Richard, only differently. For computer
languages, we can't observe
Luke Palmer lrpal...@gmail.com writes:
To us, scripting meant short, potent code that rolled off your
fingers and into the computers mind, compelling it to do your job with
reverence to the super power you truly are.
Just when I thought, oh, there are two definitions for scripting
language,
John Smith volderm...@hotmail.com writes:
Type-directed name resolution, as originally proposed for Haskell',
has now been proposed for GHC. Obvious benefits of this are
Does that mean all the questions have been resolved? Can this be shown
to interact sanely with type classes and GADTs,
Neil Brown nc...@kent.ac.uk writes:
I wonder if special syntax is actually needed for this.
+1
I think there are two issues here: 1) resolving ambiguities using
types, and 2) inventing a new syntax¹ for it. It's not clear that
these are at all dependent on each other.
How much of the
Richard O'Keefe o...@cs.otago.ac.nz writes:
it is often desirable to have the same field names
for many records in the same module.
I'm not sure that it is desirable to have many records in the
same module in the first place.
One possibility might be to allow mulitple module definitions in
Dan Doel dan.d...@gmail.com writes:
You'd lose the whole notion of 'the category of haskell types and functions'
goodbye, too. Does f . id = f? Not if the former serializes as f . id.
..and you are able to tell the difference. Am I wrong in thinking that
this could be made to work if
C. McCann c...@uptoisomorphism.net writes:
This was my first thought as well! However, reading to/from a file
would of course be in IO, at which point you'd be free to read the
file back in through normal means to get at the representation. So in
that respect, this is equivalent to (a - b) -
David Fox dds...@gmail.com writes:
I would hesitate to call it a terrible decision unless I had a good
idea of what the ratio of Java programmers to Haskell programmers was
out in the world. Just sayin...
I'm not sure the ratio is very interesting, presumably they only need
one or at most a
Andrew Coppin andrewcop...@btinternet.com writes:
Now here's an interesting thought. Haskell has algebraic data
types. Algebraic because they are sum types of product types (or,
equivilently, product types of sum types). Now I don't actually know
what those terms mean,
The quick rule to
Edward Z. Yang ezy...@mit.edu writes:
Arguably the correct thing to do is to use GHC's hooks for
programatically specifying runtime options; unfortunately, because
this has to run /before/ any Haskell code starts, it's a bit
unwieldly
Maybe what's needed is a way to allow certain RTS options
Joachim Breitner m...@joachim-breitner.de writes:
I would not recommend using --global on Debian/Ubuntu-systems, as it
might interfere with packages installed by Debian.
But 'cabal install --global' installs in /usr/local/, does it not?
And official packages (i.e. debs) put stuff in /usr, so
Thanks for the clarification, the SICP article was something I feel I
should have known, but did not.
It seems to me that while there are *three* ways to install stuff: apt-get
install, cabal install --global, and cabal install --user, there are
just *two* ways things get installed, globally and
Florian Lengyel florian.leng...@gmail.com writes:
Why is there even any consideration of some committee if someone wants to
mirror the Hackage site? Why not mirror the site?
+1
Alright, Mr. Wiseguy, she said, if you're so clever, you tell us
what colour it should be.
We can either let
Dan Knapp dan...@gmail.com writes:
I agree that signed packages are a good idea. We should move with all
haste to implement them. But I'm not sure we want to hold up
everything else while we wait for that.
IMO, mirroring is orthogonal to that, too.
That's also my take on a peer-peer
Brandon S Allbery KF8NH allb...@ece.cmu.edu writes:
IMO, mirroring is orthogonal to that, too.
Only if you consider security a minor or non-issue.
What I mean is that you can mirror a repository regardless of whether
packages are signed or not.
I'm tempted to say anyone who believes that
Darrin Chandler dwchand...@stilyagin.com writes:
It's not obvious to me that adding a mirror makes the infrastructure
more more insecure. Any particular concerns? (I hope I qualify as
naïve here :-)
If you run a mirror people will come to you for software to run on their
machines. I see a
Vincent Hanquez t...@snarc.org writes:
You have to start somewhere with security.
Yes. And you should start with assessing how much cost and
inconvenience you are willing to suffer for the improvement in
security you gain. In this case, my assertion is that the marginal
worsening of security
Andrew Coppin andrewcop...@btinternet.com writes:
A change to a gene does not make you to have a extra bone. It can
make you to have your hand slighltly longer. or shorter.
Actually I suspect it does - or at least can do. It's just a rather
rare event.
Bodily development is regulated by a
Mitar mmi...@gmail.com writes:
Neither Haskell nor any conventional language has [evolved to evolve]
True.
Well - thinking about it, there's no fundamental difference between
genetic algorithms - where you have a genome in the form of a set of
parameters and genetic programming - where the
Tony Morris tonymor...@gmail.com writes:
I teach haskell quite a lot. I recommend using .ghci files in projects.
Today I received complaints about the fact that ghci will reject .ghci
if it is group-writeable.
Huh? That's pretty weird.
I am wondering if these complaints have legitimate
Vincent Hanquez t...@snarc.org writes:
You might have misunderstood what I was talking about. I'm proposing
signing on the hackage server on reception of the package,
Okay, fair enough. You can't *enforce* this, of course, since I might
work without general internet access but a local mirror,
In order to simulate nature, you need to have the mutation and selection
process itself be part of the programs (and not the interpreter).
How about you have a world consisiting of some memory, bombard this
world with cosmic radiation, and add some enzymatic activity in the
form of an
Michael Lesniak mlesn...@uni-kassel.de writes:
Hence the interpreter can itself be modified?
Well - the interpreter in nature is chemistry. Living organisms are
just chemistry programs.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
Simon Marlow marlo...@gmail.com writes:
ulimit is a good way to catch an infinite loop. But it's not a good
way to tell GHC how much memory you want to use - if GHC knows the
memory limit, then it can make much more intelligent decisions about
how to manage memory.
I'm interpreting this
Daniel Fischer daniel.is.fisc...@googlemail.com writes:
Or: it breaks with a bug introduced in 3.4.6 which hasn't yet been fixed.
This is an important point, I think: API breakages are not always
intentional. Except for base, I generally don't specify upper bounds
(well, maybe this is laziness
John D. Ramsdell ramsde...@gmail.com writes:
In absence of any explicit limits, I think a sensible default is to set
maximum total memory use to something like 80%-90% of physical RAM.
This would be a poor choice on Linux systems. As I've argued
previously in this thread, the best choice is
Mathijs Kwik bluescreen...@gmail.com writes:
It's indeed hard to really explain what I feel is missing.
I think the basics are well covered, with lots of introductory and
tutorial material available. The advanced stuff is very abstract and
general, and the difficult part is developing an
Karel Gardas karel.gar...@centrum.cz writes:
http://www.reddit.com/r/haskell/comments/encrv/whats_happened_to_haskellorg_did_someone_forget/c19guw1
Quoth dons:
| The domain name was seized by Network Solutions (it wasn't due to
| expire until this time next year). The confusion seems to be
Andrew Coppin andrewcop...@btinternet.com writes:
but you should look into the pkill
command, which allows you to kill processes (including sending signals
other than SIGTERM) by name. It's installed by default on Ubuntu.
Or 'killall'. Which has (had) the interesting namesake on Solaris
Antoine Latter aslat...@gmail.com writes:
openTempFile
:: FilePath
- String
- IO (FilePath, Handle)
My main discomfort with this is not the result type, but that the first
argument appears different from the rest. I much prefer having the ::
be attached to the identifier. FWIW.
-k
Serge Le Huitouze serge.lehuito...@gmail.com writes:
So, do you have any methodology for such use cases?
QuickCheck has the == operator, which lets you add a precondition. So
you could limit the testing of your property to values that satisfy the
precondition.
An alternative is to use newtype
Blake Rain blake.r...@gmail.com writes:
Here is the one in C:
void multiplyM4 (float m1[4][4], float m2[4][4], float m3[4][4]) {
m1[0][0] = m2[0][0] * m3[0][0] + m2[0][1] * m3[1][0] + m2[0][2] * m3[2][0] +
m2[0][3] * m3[3][0];
m1[0][1] = m2[0][0] * m3[0][1] + m2[0][1] * m3[1][1] + m2[0][2]
Henning Thielemann lemm...@henning-thielemann.de writes:
class PERSON a b where
p1 :: a
name :: a - b
A multi-parameter typeclass is a relation over types...
instance PERSON Int String where
p1 = 1
name p1 = john
^--note that this is just an unused paramter,
it is
Patrick Browne patrick.bro...@dit.ie writes:
I think the problem is there is just one constant p1 in the class and
there needs to be multiple constants in the implementation (one for each
person). It seems difficult to specify this using type classes So, some
data declaration as you suggest
Victor Nazarov asviraspossi...@gmail.com writes:
This tradition of global and /usr/local for ./configure scripts is ok,
but for a convenient package manager it's not necessarily ideal.
Well, the system package manager uses /usr. But for locally compiled
software, I don't see any good
Rahul Kapoor r...@trie.org writes:
*Main toEnum 2
ghci does not know what type of enum you want to create from the number 2.
Try: toEnum 2 :: DayOfWeek
That said, I would expect toEnum 2 to give an error like: 'Ambiguous
type variable `a''. So I am not sure why your error message says:
Thomas Hartman tphya...@gmail.com writes:
That's slick, but is there some way to use interact twice in the same program?
No :-)
t10 =
let f = unlines . takeWhile (not . blank) . lines
in do putStrLn first time
interact f
putStrLn second time
interact f
Nico Rolle nro...@web.de writes:
A function is recieving a lambda expression like this:
(\ x y - x y)
or like this
(\ x y z a - (x y) (z a)
And the type of that function is..?
my problem is now i know i have a list filled with the parameters for
the lambda expression. but how can i
Anton van Straaten an...@appsolutions.com writes:
Exactly. I'm worried about, e.g. needing to use something as simple as
a stream of [...]
Haskell lets you easily create infinite lists, which is a powerful
and useful feature.
This has bit me on several occasions, and I think streaming over
wren ng thornton w...@freegeek.org writes:
FWIW, the JVM also fails to release memory resources back to the
OS. Given all the problems I've seen that one cause for long-running
processes, I'm definitely in support of correcting any behavior like
this in the GHC RTS.
I'm curious what real
Nikhil Patil patil.nik...@gmail.com writes:
I am curious to know if there is a function in Haskell to find if a certain
value has already been evaluated. The function I need would have the type:
(?!) :: a - Bool
Well, obviously you can't do this, it would violate referential
transparency.
Not of the same gravity as mtl, but I was a bit surprised to see that
PackedString was included, in spite of it being marked as deprecated
on Hackage.
Presumably, this is because some other library depends on this, but I
think platform-blessing a deprecated library is a strange thing to
do. If
Duncan Coutts duncan.cou...@worc.ox.ac.uk writes:
The PVP says:
1. If any entity was removed, or the types of any entities
or the definitions of datatypes or classes were changed,
or instances were added or removed, then the new A.B
张旭 stircrazyn...@hotmail.com writes:
Hi, I am really new to haskell. I am reading A gentle instruction
to haskell now. And I just cannot understand the chapter below. Is
there anybody who can gives me some hints about why the pattern
matching for client is so early? How does the pattern
Duncan Coutts duncan.cou...@worc.ox.ac.uk writes:
FWIW, I've used Data.Binary extensively and have found it a joy to
work with. I've used it to serialize/deserialize ethernet packets in
real time for a VPN implementation and have never had a problem. It's
quite fast and robust.
Is that code
michael rice nowg...@yahoo.com writes:
The following code is from Section 8.4.2, pgs. 111-112 (PDF paging) of YAHT.
It compiles fine, but upon trying it I get the following error message.
It seems to be trying to 'Show' the Computation class but I'm not sure where
to put the 'Deriving'.
My
Jason Dagit da...@codersbase.com writes:
Be wary of timing things in GHCi. By default there are no optimizations in
ghci so you could find that one implementation is much worse than the other
but the situation might be completely different when optimizations are
enabled. I'm pretty sure if
Bartosz Wójcik bar...@sudety.it writes:
myConcat' :: (Integral a) = Integer - [a] - [Integer]
:
myConcat' acc (x:xs) = case x `mod` 16 of
:
10 - fail $ show acc
11 - fail $ show acc
14 - fail $ show acc
Günther Schmidt gue.schm...@web.de writes:
I need a data structure as in my example without the [] being possible
to be empty.
Well, a list can by definition be empty, so this is clearly
impossible. The best you can do is to hide the constructors and have
smart constructor functions that
Martijn van Steenbergen mart...@van.steenbergen.nl writes:
inTwain = foldr (\x (ls, rs) - if length ls == length rs then (x:ls, rs)
else (x:(init ls), (last ls):rs)) ([], [])
But this uses length and init and last all of which are recursive
functions. I consider that cheating: only foldr
Martijn van Steenbergen mart...@van.steenbergen.nl writes:
inTwain as = let (x,y,_) = foldr (\a (r,s,t) - case (t) of
{b:(b':bs) - (r,a:s,bs); _ - (a:r,s,t)}) ([],[],as) as in (x,y)
This one is very interesting.
Yes, neat.
I'm not too happy with the whole list as part of the initial
MH mha...@gmail.com writes:
data Container a = Many a(Container a)
but here is what I don't understand (fyi, I am a beginner) how can you
construct this container? I can do
let a = Many somestring - and I will get back a function but I can not do
let a = Many 'a' somestring - because the
ptrash ptr...@web.de writes:
I want to make something like a counter. I have written a recursive method
which for example runs x times and counts how many times it runs, and also
count some other thinks. Add the end I want a statistic about certain thinks
returned by the method.
Keep in mind
401 - 500 of 923 matches
Mail list logo