On 2006-09-11, Aaron Denney <[EMAIL PROTECTED]> wrote:
>> See "What About the Natural Numbers" - "Colin Runciman" - it's a good read :)
>
> I will when I get the chance.
Finally found a copy. It is a good read. I mostly agree with him.
The biggest exception is about the need for highly optimized
On 2006-09-11, Henning Thielemann <[EMAIL PROTECTED]> wrote:
>
> On Sun, 10 Sep 2006, Aaron Denney wrote:
>
>> >> Of course, there's always a typeclass, where we could add all sorts of
>> >> other encodings of the Peano axioms, such as binary trees,, but I don't
>> >> see that that buys us much if
On 2006-09-11, Simon Peyton-Jones <[EMAIL PROTECTED]> wrote:
>| Well, it seems a shame that we don't have postfix operators already.
>
> Actually, the up-coming GHC 6.6 does allow this.
Awesome.
--
Aaron Denney
-><-
___
Haskell-Cafe mailing list
Haske
On 2006-09-10, Neil Mitchell <[EMAIL PROTECTED]> wrote:
> Hi,
>
>> I think in practice this wouldn't really be an issue. When you're
>> using natural numbers, you tend to be in a situation where you're
>> either numbering things statically, and not doing any calculations
>> with them, or you're usi
On Sun, 10 Sep 2006, Aaron Denney wrote:
> >> Of course, there's always a typeclass, where we could add all sorts of
> >> other encodings of the Peano axioms, such as binary trees,, but I don't
> >> see that that buys us much if we don't also get access to operations
> >> beyond them, such as (an
| Well, it seems a shame that we don't have postfix operators already.
| I guess that means I am arguing we should introduce a unary postfix
| operator, and not even have sugar for factorial, as it conflicts with
| array access.
|
| We *almost* do:
| Hugs.Base> let (!) 0 = 1; (!) x = x*((!) (x-1))
See also: torsors
http://math.ucr.edu/home/baez/torsors.html
Jim
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hi,
I think in practice this wouldn't really be an issue. When you're
using natural numbers, you tend to be in a situation where you're
either numbering things statically, and not doing any calculations
with them, or you're using them as a monoid, whereby things only
increase.
take? primes? fi
On 10/09/06, Aaron Denney <[EMAIL PROTECTED]> wrote:
I still don't like having a plus without a minus.
I think in practice this wouldn't really be an issue. When you're
using natural numbers, you tend to be in a situation where you're
either numbering things statically, and not doing any calcul
On 2006-09-09, Jón Fairbairn <[EMAIL PROTECTED]> wrote:
> Aaron Denney <[EMAIL PROTECTED]> writes:
>> Meh. Naturals are reasonably useful sometimes, but not often enough, in
>> my opinion. Any sort of numeric hierarchy designed to deal with them
>> would be totally broken from my point of view -
Jón Fairbairn wrote:
"Brian Hulley" <[EMAIL PROTECTED]> writes:
I imagine that almost every editor at least does lexical
fontification, and if so, then I don't think there could be
much confusion in practice between these uses of '-'.
I think that unnecessarily disadvantages people with poorer
"Brian Hulley" <[EMAIL PROTECTED]> writes:
> Jón Fairbairn wrote:
> > [1] “-” is a varsym. The logical way of achieving what you
> > suggest (ie -1 -2... as constructors for Integer) would be
> > to make it introduce a consym the way “:” does, but then it
> > couldn't be an infix operator anymore.
Aaron Denney <[EMAIL PROTECTED]> writes:
> On 2006-09-08, Jón Fairbairn <[EMAIL PROTECTED]> wrote:
> > Why shouldn't Naturals be more primitive than Integers?
>
> Certainly they're more primitive. Too primitive to have reasonable
> algebraic properties.
Hmph. Naturals obey (a+b)+c == a+(b+c),
Aaron Denney <[EMAIL PROTECTED]> writes:
> Jón Fairbairn <[EMAIL PROTECTED]> wrote:
> > I think the present design is wrong because we don't have a
> > type for naturals.
>
> Meh. Naturals are reasonably useful sometimes, but not often enough, in
> my opinion. Any sort of numeric hierarchy des
Aaron Denney <[EMAIL PROTECTED]> writes:
> We already have this great syntax, parsing semanticsi for precedence,
> and so forth for declaring infix operators. Couldn't we add to that
> slightly by declaring postfix operators as well? Actually, declaring a
> unary operator infix yielding a postfi
On 2006-09-08, Brian Hulley <[EMAIL PROTECTED]> wrote:
> Leaving aside the question of negative literals for the moment, what's so
> special about unary minus that it warrants a special syntax? For example in
> mathematics we have x! to represent (factorial x), which is also an
> important funct
On 2006-09-08, Jón Fairbairn <[EMAIL PROTECTED]> wrote:
> "Brian Hulley" <[EMAIL PROTECTED]> writes:
>> In the context of programming, I don't see the problem of
>> just thinking of the integers as a primitive built-in data
>> type which contains some range of positive and negative
>> integers whi
"Cale Gibbard" <[EMAIL PROTECTED]> writes:
> Another thing to note is that all the natural literals are not, as one
> might initially think, plain values, but actually represent the
> embedding of that natural number into the ring (instance of Num), by
> way of 0 and 1.
Excellent point, and good
On Sat, Sep 09, 2006 at 12:57:56AM -0400, Cale Gibbard wrote:
> Num itself needs to be split, but we can't do it sanely without
> something like class aliases.
I think that a finer grain numeric hierarchy, while retaining Num, etc,
is feasible without changing the language: unlike the case of mona
On 09/09/06, Cale Gibbard <[EMAIL PROTECTED]> wrote:
When I first ran into the problem with (-) and
sections, I was slightly annoyed with having to write (+ (-1))
Let's not forget that there is the library function 'subtract' for
this purpose. What you wrote could be written as (subtract 1), wh
On 08/09/06, Brian Hulley <[EMAIL PROTECTED]> wrote:
Jón Fairbairn wrote:
> "Brian Hulley" <[EMAIL PROTECTED]> writes:
>> Cale Gibbard wrote:
>>> Anyway, the point of all this is that 0,1,2... are not
>>> really literals at all. They're nullary operators which
>>> give particular elements of any
Jón Fairbairn wrote:
"Brian Hulley" <[EMAIL PROTECTED]> writes:
Cale Gibbard wrote:
Anyway, the point of all this is that 0,1,2... are not
really literals at all. They're nullary operators which
give particular elements of any given instance of
Num. Perhaps at some level in the compiler after
p
"Brian Hulley" <[EMAIL PROTECTED]> writes:
> Leaving aside the question of negative literals for the
> moment, what's so special about unary minus that it warrants
> a special syntax? For example in mathematics we have x! to
> represent (factorial x), which is also an important
> function, yet no
"Cale Gibbard" <[EMAIL PROTECTED]> writes:
> Another thing to note is that all the natural literals are not, as one
> might initially think, plain values, but actually represent the
> embedding of that natural number into the ring (instance of Num), by
> way of 0 and 1.
I wasn't sure where to add
On Thu, Aug 17, 2006 at 11:18:59AM -0400, Stefan Monnier wrote:
> > I'd have thought it would have been simpler to just make the rule that -2
> > (no spaces between '-' and '2') would be a single lexeme,
>
> But then x-2 won't mean "subtract 2 from x" but "call x with arg -2".
but now at least a
Stefan Monnier <[EMAIL PROTECTED]> writes:
> > I'd have thought it would have been simpler to just make the rule that -2
> > (no spaces between '-' and '2') would be a single lexeme,
>
> But then x-2 won't mean "subtract 2 from x" but "call x with arg -2".
Well, since the normal typographical c
> I'd have thought it would have been simpler to just make the rule that -2
> (no spaces between '-' and '2') would be a single lexeme,
But then x-2 won't mean "subtract 2 from x" but "call x with arg -2".
Stefan
___
Haskell-Cafe mailing list
map (\x -> x - 2) [1..5]
or
map (flip (-) 2) [1..5]
HTH Christian
Tamas K Papp schrieb:
> The code in the subject generates an error. I understand why this is
> (- is treated as part of the number), but I don't know how to solve
> it, ie how to tell Haskell that - is a function/binary operator
28 matches
Mail list logo