Clint Moore | 16 Sep 23:59 2012

(no subject)

gmane.comp.lang.haskell.general
Attachment (smime.p7s): application/pkcs7-signature, 3701 bytes
_______________________________________________
Haskell mailing list
Haskell <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell
Ashley Yakeley | 27 May 23:18 2001

Re: (no subject)

At 2001-05-26 00:47, Rab Lee wrote:

>hi, i'm having a bit more touble, can anyone help me
>or give me any hints on how to do this :
>"x 2 3 4" = ("x", [2, 3, 4])

Generally we don't solve homework for people. Unless they're studying 
under Prof. Karczmarczuk, of course.

--

-- 
Ashley Yakeley, Seattle WA

Jerzy Karczmarczuk | 28 May 10:21 2001
Picon

Homeworks and art of flying.

Ashley Yakeley answers the query of Rab Lee:
> 
> >hi, i'm having a bit more touble, can anyone help me
> >or give me any hints on how to do this :
> >"x 2 3 4" = ("x", [2, 3, 4])
> 
> Generally we don't solve homework for people. Unless they're studying
> under Prof. Karczmarczuk, of course.
> 
> --
> Ashley Yakeley, Seattle WA

Now, now, this is cruel and ati-pedagogical. I changed my mind, we should
all be friends, and help each other. Here is the ideal solution, very
fast, and protected against viral contamination

homework "x 2 3 4" = ("x", [2, 3, 4])
homework _ = error "You can't"

Note the cleverness and universalness of the solution. 

Jerzy Karczmarczuk
Caen, France

PS. A deep philosophical quotation seems appropriate here. Here is one from
   Douglas Adams:

   Flying is an art, or rather a knack.
   The knack consists in throwing oneself to ground, and miss.

(Continue reading)

Simon Peyton-Jones | 28 May 10:31 2001
Picon

RE: (no subject)

This looks like a good thread to move to haskell-cafe <at> haskell.org

	http://haskell.org/mailinglist.html

Simon

| -----Original Message-----
| From: Rab Lee [mailto:leelati <at> yahoo.com] 
| Sent: 26 May 2001 08:48
| To: haskell <at> haskell.org
| Subject: (no subject)
| 
| 
| hi, i'm having a bit more touble, can anyone help me
| or give me any hints on how to do this :
| "x 2 3 4" = ("x", [2, 3, 4])
| 
| __________________________________________________
| Do You Yahoo!?
| Yahoo! Auctions - buy the things you want at great prices 
http://auctions.yahoo.com/

_______________________________________________
Haskell mailing list
Haskell <at> haskell.org http://www.haskell.org/mailman/listinfo/haskell

Simon Peyton-Jones | 18 Jan 07:44 2002
Picon

RE: (no subject)

Perfectly sensible suggestion, but too late for the H98 Report,
I'm afraid.  It's time to freeze it.

Simon

| -----Original Message-----
| From: D.Wakeling <at> exeter.ac.uk [mailto:D.Wakeling <at> exeter.ac.uk] 
| Sent: 08 January 2002 10:02
| To: haskell <at> haskell.org
| Subject: (no subject)
| 
| 
| 
| Hello,
| 
| Is there any reason why the "gap" in a string literal is defined as
| 
| 	gap -> \whitechar {whitechar}\
| 
| (in Section 2.6 of the report), rather than 
| 
|         gap -> \whitespace\
| 
| ? The second, more liberal, definition of "gap" seems more 
| natural. Moreover, it would allow comments in the gaps, which 
| I would find useful. For example,
| 
|         classHeader :: String
|         classHeader = "\xca\xfe\xba\xbe\     -- magic number
|                       \\x00\x03\             -- minor version
(Continue reading)

David Feuer | 25 Jan 08:27 2002

(no subject)

Martin Said:

> Those two constructs are not the same

> Compare

> newtype T1 = C1 Bool
>  data    T2 = C2 !Bool

> the difference is that the constructor C1 does not 
exist, so only the following values exist for T1:

> C1 True  (which is the represented as True)
> C1 False (which is the represented as False)
> C1 _|_   (which is represented as non-termination or 
error)

> however, for T2, another value exist, namely _|_.
> So, pattern matching on (T2 x) may fail it the value is 
> _|_. You are
> right that semantically newtype is the same as always 
matching lazily on the constructor.

The report says clearly that for a newtype like T1,
C1 _|_ = _|_
This is the same as for T2 and C2.
As for as I can tell, the only difference in the Report 
between a newtype and a tuple type with a completely 
strict constructor is in the rules for pattern matching.  
So I am trying to find someone who can explain the reason 
(Continue reading)

Martin Norbäck | 25 Jan 09:12 2002
Picon
Picon

Re:

fre 2002-01-25 klockan 08.27 skrev David Feuer:
> Martin Said:
> 
> > Those two constructs are not the same
> 
> > Compare
> 
> > newtype T1 = C1 Bool
> >  data    T2 = C2 !Bool

> The report says clearly that for a newtype like T1,
> C1 _|_ = _|_
> This is the same as for T2 and C2.

No.

C1 _|_ is the same as _|_ representation-wise (not type-wise).
C2 _|_ is C2 _|_.

If you imagine the computer's memory, when you store the value (C1 True)
you just store (True). When you store the value (C2 True) you store (C2
True).

So you can't choose whether to match strictly or lazily on C1, because
you don't match on C1, because C1 is never stored in memory. It's simply
a typing trick.

That's why it's more efficient to use newtype than data. You don't need
to handle the constructor because the type-checker removes all traces of
it.
(Continue reading)

John Hughes | 25 Jan 14:20 2002
Picon
Picon

Re: (no subject)

	> Those two constructs are not the same

	> Compare

	> newtype T1 = C1 Bool
	>  data    T2 = C2 !Bool

	As for as I can tell, the only difference in the Report 
	between a newtype and a tuple type with a completely 
	strict constructor is in the rules for pattern matching.  
	So I am trying to find someone who can explain the reason 
	for the difference in the rules!

Right.

	case x of C2 b -> ...

forces x, of course: matching on a datatype is always strict, and a strictness
annotation on a component certainly shouldn't change that.

	case x of b -> ...

does NOT force x: binding something to a variable is lazy.

        case x of C1 b -> ...

does not force x either: the point of newtype is JUST to introduce a new type
isomorphic to, but different from, the old, and therefore the presence or
absence of the newtype constructor should have no effect at all on the
evaluation of the program. Otherwise you couldn't refactor a program to
(Continue reading)

Konst Sushenko | 7 Feb 21:38 2002
Picon

RE: (no subject)

One way to do it would be to look at the prelude's elem function.
Otherwise, just scan each list until you find a match.

> -----Original Message-----
> From: Phil Haymen [mailto:phaymen <at> yahoo.com] 
> Sent: Thursday, February 07, 2002 12:18 PM
> To: haskell <at> haskell.org
> Subject: (no subject)
> 
> 
> hi,how do I define a function to test whether a number
> is an element of a list of lists of numbers.
> 
> elem :: Int -> [[Int]] -> Bool
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
> _______________________________________________
> Haskell mailing list
> Haskell <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
> 

bracaman | 7 Feb 21:53 2002
Picon

Re: (no subject)

If you can use elem :: Eq a => a -> [a] -> Bool  function, you can do:

f x l= or (map (elem x) l

On Thursday 07 February 2002 20:17, you wrote:
> hi,how do I define a function to test whether a number
> is an element of a list of lists of numbers.
>
> elem :: Int -> [[Int]] -> Bool
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
> _______________________________________________
> Haskell mailing list
> Haskell <at> haskell.org
> http://www.haskell.org/mailman/listinfo/haskell

Zhanyong Wan | 7 Feb 22:08 2002
Picon

Re: (no subject)

bracaman wrote:

> If you can use elem :: Eq a => a -> [a] -> Bool  function, you can do:
>
> f x l= or (map (elem x) l
>
> On Thursday 07 February 2002 20:17, you wrote:
> > hi,how do I define a function to test whether a number
> > is an element of a list of lists of numbers.
> >
> > elem :: Int -> [[Int]] -> Bool

I prefer

f x l = x `elem` concat l

- Zhanyong Wan

b.i.mills | 6 Mar 02:57 2003
Picon
Picon

(no subject)

To <haskell <at> haskell.org>
Subject: Re: int to float problem
In-Reply-To: <200303031210.AA617087468 <at> snip.net>

Yo,

> Haskell Integers are not a proper subset of Haskell Floats or
> Doubles.  Haskell does not support real numbers.

I'd just like to add ...

Real numbers are not implementable on a digital computer. This
is not a "practical" matter of resources, or a design decision
in by the language designer, but the fact that any data type 
each of whose elements are represented in a finite number of 
bytes can't have more than a countable number of data elements. 
Integers, and Rationals can be represented. Even the so-called 
computable-real-numbers, (still countable) don't work as well 
as you would want, since things such as "is this number bigger 
than that one" can't always be computed.

Add to this the fact that the generic float type does not 
satisfy algebraic constraints such as associativity, and so 
can't, from the axiomatic point of view, be considered to be 
a representation of rational numbers (let alone reals).

Basically, from the algebraic perspective, the float type is
a messy fudge, and does not fit in nicely with any of the 
"pure" types. In general the containment 

(Continue reading)

Alfonso | 22 Jun 14:00 2004
Picon

(no subject)

Hello dear haskellers:

 

My name is Alfonso Meléndez I work in Computer Science in  a ColombianUniversity.

Right now, I am developing an application for discrete mathematics and I need to comunicate Java with Haskell,

more precisely  I use Java for the interface of the application and from here  I need to call several  Haskell Functions.

In Haskell.org  there are two libraries  ( JavaBridge and JNI) that communicate Haskell with Java (but not viceversa).

 

Is there and easy and direct way to do this job?

 

Thank you!!!

 

 

 

Alfonso  Meléndez

Dirección de Proyectos

Facultad de Ingeniería de Sistemas

Escuela Col de Ingeniería

Tels: 676266,6763888, Ext: 224,  371

Cel:  (315) 8938216

 

This e-mail message has been scanned for Viruses and Content and cleared by NetIQ MailMarshal
_______________________________________________
Haskell mailing list
Haskell <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Gmane