Daniel Carrera <[EMAIL PROTECTED]> wrote in article <[EMAIL PROTECTED]> in
gmane.comp.lang.haskell.cafe:
> [EMAIL PROTECTED] wrote:
> > you may use a tuple?
> Hhhmm... I just tried it. It looks like Hugs doesn't like tuples with
> more than 5 elements. :-(
You can nest tuples. And that might be
Quoth Daniel Carrera <[EMAIL PROTECTED]>:
...
| In your opinion, do you think Haskell is appropriate for someone with
| zero math background? I can't imagine how I'd explain something like
| currying to someone who doesn't know math.
Then she may have to learn it from someone else, but there are
Cale Gibbard wrote:
Just out of curiosity, what platform are you on? There seem to be
builds of GHC available for most common ones.
Solaris :-(
I hate Solaris. No, I didn't choose it; this is what the school
provides. But if all goes well, I'll have my very own Ubuntu Linux box
within a month or
> No look, I don't have /any/ .hi files. I don't know what a .hi file is.
> I don't have GHC either, I've never managed to make it compile. I just
> got my very first Haskell compiler (literally 10min ago).
>
> Cheers,
> Daniel.
Just out of curiosity, what platform are you on? There seem to be
bu
Glynn Clements wrote:
For lists, no. For arrays, in the general case, again no. For your
specific case, you can use an array whose indices have type Word8 (8
bit unsigned integer), i.e.
import Data.Word
import Data.Array
type ByteMap = Array Word8 Word8
For an RC4 implementa
David Menendez wrote:
I haven't used NHC so I can't guarantee this will work, but try doing
something like this:
$ nhc98 -c RC4.hs
$ nhc98 -c prng.hs
$ nhc98 RC4.o prng.o -o prng
Yay! It does. And I just put it in a makefile:
---
COMPILER=nhc98
RC4.o:
$(COMPILER) -c RC4.hs
p
Daniel Carrera writes:
> David Menendez wrote:
>
> > You mentioned later that you don't have any *.hi files, so I'm
> > guessing you didn't compile RC4.hs before you compiled prng.hs.
>
> Correct. I didn't know I had to :-)
Yeah, that's one of the major differences between using an interpreter
Daniel Carrera wrote:
> Right now I'm using type declarations like:
>
> f :: Int -> [Int]
>
> So f returns a list of Ints.
>
> Is there a way to tell Haskell that a list or array must have exactly
> (say) 256 elements? I'd love to have Haskell make sure that the array I
> build is the correc
At 12:04 PM -0700 2005/5/7, Jacob Nelson wrote:
GCC knows how big an array is:
jake$ cat > arrsizetest.c
#include
int main()
{
int a[50];
printf("sizeof a == %d\n",sizeof(a));
return 0;
}
jake$ gcc arrsizetest.c
jake$ ./a.out
sizeof a == 200
jacob
gcc knows the size of an a
Hamilton Richards <[EMAIL PROTECTED]> writes:
> That's not the case in C, C++, Java, or Ada. In C and C++, for
> example, given two arrays
>
> int X[50];
> int Y[100];
>
> and a function declared as
>
> void P( int a[] )
>
> then these calls
>
> P( X )
> P( Y )
>
> ar
At 9:36 AM -0700 2005/5/7, Fergus Henderson wrote:
On 07-May-2005, Hamilton Richards <[EMAIL PROTECTED]> wrote:
As far as I know,
the last programming language that included arrays' sizes in their
types was Standard Pascal,
There have been many such languages since Standard Pascal.
For example C
On 20050507T212832+0200, Marcin 'Qrczak' Kowalczyk wrote:
> > ISO 9899:1999 (C99) section 6.7.5.2:3 says that its type is "array of
> > int", not "array of 50 ints":
>
> Ok, so in C terminology "type" is different from most statically typed
> languages in this respect. The dimension is used togeth
David Menendez wrote:
*.hi files are analogous to C's *.h files, except that the compiler
generates them.
Thanks, I learned something new today.
You mentioned later that you don't have any *.hi files, so I'm guessing
you didn't compile RC4.hs before you compiled prng.hs.
Correct. I didn't know I ha
On 20050507T153105-0400, David Roundy wrote:
> In a multi-dimensional array, all the dimensions but the first (or last?)
> are fixed in size. Unfortunately, these are fixed at compile time, so
> there's no way to write a function that can act upon multidimensional
> arrays of arbitrary size. So w
David Roundy <[EMAIL PROTECTED]> writes:
> No, int (*p)[50] is a multidimensional array, one of the most useless
> concepts in C, and is equivalent to int p[50][] (or is it p[][50]...
> I always get my matrix subscripts messed up).
No, it's not equivalent to either. Array type are not the same as
Incidentally, if you aren't already familiar with "make" or some other
build system, I strongly recommend looking into one. Even for a
project
with only two files, having a build system keep track of compilation
dependencies makes things a lot less tedious.
In random addition to this... hmake wil
On May 7, 2005, at 8:31 PM, David Roundy wrote:
On Sat, May 07, 2005 at 08:20:15PM +0100, Thomas Davie wrote:
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
The size is taken into account when such array type is an element of
another array, and by sizeof.
int (*p)[50]; /* p may legall
On 20050507T151723-0400, Daniel Carrera wrote:
> Antti-Juhani Kaijanaho wrote:
>
> >Your mistake is the "start talking about groups as you do in every day
> >English" part.
>
> The point I'm trying to make is that you can't necessarily predict that
> a programming language will abscribe special
Daniel Carrera writes:
> Hello,
>
> After days of effort, I finally managed to compile and install a
> Haskell compiler. The one I have is NHC98.
>
> So now, with my new toy, I am eager to compile my very first Haskell
> program (I've been using 'runhugs' so far). But I'm having problems:
>
>
On Sat, May 07, 2005 at 08:20:15PM +0100, Thomas Davie wrote:
> On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
> >The size is taken into account when such array type is an element of
> >another array, and by sizeof.
> >
> >int (*p)[50]; /* p may legally point only to arrays of 50 ints
[EMAIL PROTECTED] wrote:
you may use a tuple?
Hhhmm... I just tried it. It looks like Hugs doesn't like tuples with
more than 5 elements. :-(
Oh well. I'll go for array.
Cheers,
Daniel.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.h
On Sat, 7 May 2005, Abraham Egnor wrote:
So does ghc:
...
That doesn't mean the size is part of the *type*.
Sure. I'm just pointing out that
int a[50];
is not *quite* the same as
int *a = (int *)malloc(50 * sizeof(int));
jacob
___
Haskell-Cafe mail
Antti-Juhani Kaijanaho <[EMAIL PROTECTED]> writes:
>> No, it introduces a variable of type "array of 50 ints", which can be
>> converted to "pointer to int".
>
> ISO 9899:1999 (C99) section 6.7.5.2:3 says that its type is "array of
> int", not "array of 50 ints":
Ok, so in C terminology "type" is
On May 7, 2005, at 8:07 PM, Marcin 'Qrczak' Kowalczyk wrote:
Thomas Davie <[EMAIL PROTECTED]> writes:
I'm not familiar with your C++ example (not being familiar with C++),
but I think that it's a bit of a stretch of the imagination to say
that C "introduces a variable of type "array of 50 ints"",
On 7 May, Daniel Carrera wrote:
> Hello,
>
> Right now I'm using type declarations like:
>
> f :: Int -> [Int]
>
> So f returns a list of Ints.
>
> Is there a way to tell Haskell that a list or array must have exactly
> (say) 256 elements? I'd love to have Haskell make sure that the array I
Antti-Juhani Kaijanaho wrote:
Your mistake is the "start talking about groups as you do in every day
English" part.
The point I'm trying to make is that you can't necessarily predict that
a programming language will abscribe special meaning to standard known
words like "group" or "list". I can ve
On 5/7/05, Jacob Nelson <[EMAIL PROTECTED]> wrote:
>
> GCC knows how big an array is:
>
> jake$ cat > arrsizetest.c
> #include
>
> int main()
> {
> int a[50];
> printf("sizeof a == %d\n",sizeof(a));
> return 0;
> }
> jake$ gcc arrsizetest.c
> jake$ ./a.out
> sizeof a
On 20050507T120430-0400, Daniel Carrera wrote:
> I think it's because there's no real reason for someone to think that
> the words "list" and "array" might not be synonims. I certainly don't
> seen a linguistic distinction. Either term refers to an ordered
> collection of items.
I don't even kn
Thomas Davie <[EMAIL PROTECTED]> writes:
> I'm not familiar with your C++ example (not being familiar with C++),
> but I think that it's a bit of a stretch of the imagination to say
> that C "introduces a variable of type "array of 50 ints"", the fact
> that this is now an array of 50 integers is
GCC knows how big an array is:
jake$ cat > arrsizetest.c
#include
int main()
{
int a[50];
printf("sizeof a == %d\n",sizeof(a));
return 0;
}
jake$ gcc arrsizetest.c
jake$ ./a.out
sizeof a == 200
jacob
On Sat, 7 May 2005, Thomas Davie wrote:
No, it introduces a variable of ty
On 20050507T203246+0200, Marcin 'Qrczak' Kowalczyk wrote:
> > In C and C++, the declaration int n[50]; introduces an array variable
> > with size 50 having the type "array of int". The size is *not* part of
> > the type.
>
> No, it introduces a variable of type "array of 50 ints", which can be
>
No, it introduces a variable of type "array of 50 ints", which can be
converted to "pointer to int".
It matters when you make a pointer of such arrays, an array of such
arrays, or sizeof such array. In C++ the size can be matched by
template parameter, and you can have separate overloadings for
sep
Marcin 'Qrczak' Kowalczyk wrote:
$ nhc98 prng.hs -o prng
I/O error (user-defined), call to function `userError':
In file ./RC4.hi:
1:1-1:6 Found _module_ but expected a interface
GHC and NHC confuse each other with prng.hi files they produce and
examine, in incompatible formats.
You can delete th
Daniel Carrera <[EMAIL PROTECTED]> writes:
> $ nhc98 prng.hs -o prng
> I/O error (user-defined), call to function `userError':
>In file ./RC4.hi:
> 1:1-1:6 Found _module_ but expected a interface
GHC and NHC confuse each other with prng.hi files they produce and
examine, in incompatible forma
Hello,
After days of effort, I finally managed to compile and install a Haskell
compiler. The one I have is NHC98.
So now, with my new toy, I am eager to compile my very first Haskell
program (I've been using 'runhugs' so far). But I'm having problems:
---
$ nhc98 prng.hs -o prng
I/O error
Sebastian Sylvan <[EMAIL PROTECTED]> writes:
> A "list" is, for me, more of a "logical" entity (as opposed to
> structural). It's a sequence of "stuff" not a particular way to
> store it (singly-linked, doubly-linked, arraylists etc.).
I call it "sequence".
A list is usually a concrete type in a
Antti-Juhani Kaijanaho <[EMAIL PROTECTED]> writes:
>> > As far as I know, the last programming language that included
>> > arrays' sizes in their types was Standard Pascal,
>>
>> There have been many such languages since Standard Pascal. For
>> example C, C++, C#, Java, Ada, VHDL, and NU-Prolog.
On 5/7/05, Daniel Carrera <[EMAIL PROTECTED]> wrote:
>
> Stefan Monnier wrote:
> >>I have a lady friend who wants to learn how to program. She's a technical
> >>person, but has no math background to speak of. I can't decide whether to
> >>start with a clear-syntax imperative language (Ruby) or a f
On 5/7/05, Daniel Carrera <[EMAIL PROTECTED]> wrote:
at there is, but this wasn't evident atll to /me/ from the names.
>
> I must also confess that after hearing your explanation I still don't
> understand the linguistic distinction.
Basically, when I see the word "array" I think of a field of c
On 20050507T093613-0700, Fergus Henderson wrote:
> On 07-May-2005, Hamilton Richards <[EMAIL PROTECTED]> wrote:
> > As far as I know, the last programming language that included
> > arrays' sizes in their types was Standard Pascal,
>
> There have been many such languages since Standard Pascal. Fo
On Sat, May 07, 2005 at 12:40:55PM -0400, Daniel Carrera wrote:
> In your opinion, do you think Haskell is appropriate for someone with
> zero math background? I can't imagine how I'd explain something like
> currying to someone who doesn't know math.
I'd think it'd be pretty easy for a non-math
Daniel Carrera <[EMAIL PROTECTED]> writes:
> Is there a way to tell Haskell that a list or array must have exactly (say)
> 256 elements? I'd love to have Haskell make sure that the array I build is
> the correct size.
Yes, you can build lists with a maximum size.
The simplest approach I've seen i
Stefan Monnier wrote:
I have a lady friend who wants to learn how to program. She's a technical
person, but has no math background to speak of. I can't decide whether to
start with a clear-syntax imperative language (Ruby) or a functional
language (Haskell). I confess I've been leaning towards Ruby
Sebastian Sylvan wrote:
Anyway. There is a difference, and I think the names reflect that pretty well.
I'm glad you think that. Sadly, not everyone else does.
My take is: sure I can accept that there's a difference once I'm told
that there is, but this wasn't evident atll to /me/ from the names.
On 07-May-2005, Hamilton Richards <[EMAIL PROTECTED]> wrote:
> As far as I know,
> the last programming language that included arrays' sizes in their
> types was Standard Pascal,
There have been many such languages since Standard Pascal.
For example C, C++, C#, Java, Ada, VHDL, and NU-Prolog.
>
> I have a lady friend who wants to learn how to program. She's a technical
> person, but has no math background to speak of. I can't decide whether to
> start with a clear-syntax imperative language (Ruby) or a functional
> language (Haskell). I confess I've been leaning towards Ruby.
In my limit
On 5/7/05, Daniel Carrera <[EMAIL PROTECTED]> wrote:
> Hamilton Richards wrote:
>
> > Well, for starters, lists and arrays are two entirely different topics.
> > I've noticed that Haskell newbies sometimes confuse them --possibly the
> > use of [] in list types and enumerations triggers an unconsc
Max Vasin wrote:
So, you need list of length 256 and then just use it as state of your PRNG.
If you want to check list size you have to do it at runtime:
f lst | length lst == 256 -> doWork
| otherwise -> fail "length lst must be 256"
Okay, thanks.
Cheers,
Daniel.
Daniel Carrera <[EMAIL PROTECTED]> writes:
> Max Vasin wrote:
>
>> But why do you need that? Where do need to make an assumption about the size
>> of the list?
>
> I'm implementing the RC4 algorithm, which requires a state array with
> 256 elements containing the bytes from 0 to 255. As the algor
Hamilton Richards wrote:
Well, for starters, lists and arrays are two entirely different topics.
I've noticed that Haskell newbies sometimes confuse them --possibly the
use of [] in list types and enumerations triggers an unconscious
association with [] used in conventional languages for array i
At 9:24 AM -0400 2005/5/7, Daniel Carrera wrote:
Hello,
Right now I'm using type declarations like:
f :: Int -> [Int]
So f returns a list of Ints.
Is there a way to tell Haskell that a list or array must have
exactly (say) 256 elements? I'd love to have Haskell make sure that
the array I build is
Max Vasin wrote:
But why do you need that? Where do need to make an assumption about the size
of the list?
I'm implementing the RC4 algorithm, which requires a state array with
256 elements containing the bytes from 0 to 255. As the algorithm
progresses, the elements of the array get shuffled ar
Daniel Carrera <[EMAIL PROTECTED]> writes:
> Hello,
>
> Right now I'm using type declarations like:
>
> f :: Int -> [Int]
>
> So f returns a list of Ints.
>
> Is there a way to tell Haskell that a list or array must have exactly
> (say) 256 elements? I'd love to have Haskell make sure that the arr
Hello,
Right now I'm using type declarations like:
f :: Int -> [Int]
So f returns a list of Ints.
Is there a way to tell Haskell that a list or array must have exactly
(say) 256 elements? I'd love to have Haskell make sure that the array I
build is the correct size.
Cheers,
Daniel.
_
54 matches
Mail list logo