Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Unboxed float tuples
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
Daniel Bünzli  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 16:02
Newsgroups: fa.caml
From: Daniel Bünzli <daniel.buen...@erratique.ch>
Date: Sun, 08 Nov 2009 16:02:00 UTC
Subject: [Caml-list] Unboxed float tuples
Tuples and records are represented the same way. However when it comes
to records with only floats fields we get a special unboxed
representation.

Why don't we get that for tuples of floats only ?

Using tuples (vs records) to handles points and vectors is
syntactically more lightweight (IMHO). More important it makes it
easier to share that kind of data
between independent modules without introducing new dependencies.
However I don't want to sacrifice the unboxed representation for that.

Is it worth to ask for a feature request ? I guess many people would
be against changing the runtime representation.

Best,

Daniel

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jon Harrop  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 16:45
Newsgroups: fa.caml
From: Jon Harrop <j...@ffconsultancy.com>
Date: Sun, 08 Nov 2009 16:45:19 UTC
Local: Sun 8 Nov 2009 16:45
Subject: Re: [Caml-list] Unboxed float tuples
On Sunday 08 November 2009 16:01:48 Daniel Bünzli wrote:

> Using tuples (vs records) to handles points and vectors is
> syntactically more lightweight (IMHO).

If you want to handle structs and vectors then you probably want structs
(value types) and not boxed representations like tuples and records anyway.

--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Jambon  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 17:29
Newsgroups: fa.caml
From: Martin Jambon <martin.jam...@ens-lyon.org>
Date: Sun, 08 Nov 2009 17:29:52 UTC
Local: Sun 8 Nov 2009 17:29
Subject: Re: [Caml-list] Unboxed float tuples

Daniel Bünzli wrote:
> Tuples and records are represented the same way. However when it comes
> to records with only floats fields we get a special unboxed
> representation.

> Why don't we get that for tuples of floats only ?

Because polymorphic functions like fst would break (or would require extra
runtime checking).

Note that ('a * 'b) is pretty much the same as:
type ('a, 'b) tuple = { a : 'a; b : 'b }

# Obj.tag (Obj.repr { a = 1.0; b = 1.0 });;
- : int = 0
# Obj.tag (Obj.repr (1.0, 1.0));;
- : int = 0

whereas:

# Obj.tag (Obj.repr { Complex.re = 1.0; im = 1.0 });;
- : int = 254

Martin

--
http://mjambon.com/

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brian Hurt  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 19:39
Newsgroups: fa.caml
From: Brian Hurt <bh...@spnz.org>
Date: Sun, 08 Nov 2009 19:39:25 UTC
Local: Sun 8 Nov 2009 19:39
Subject: Re: [Caml-list] Unboxed float tuples

On Mon, 9 Nov 2009, Daniel Bünzli wrote:
> Tuples and records are represented the same way. However when it comes
> to records with only floats fields we get a special unboxed
> representation.

> Why don't we get that for tuples of floats only ?

Because tuples are generic data types.  Access to records and arrays are
special cased- in the record case, because the compiler knows the type of
the record, in the array case because array access is via C code which
handles the special case.  But the compiler needs to be able to compile
code with generic tuple accesses, like:

let third_of_four (_, _, x, _) -> x;;

Fixing this would require a major rearchitecting and rewrite of not only
the compiler, but also the garbage collector, the run time, and all the C
bindings that have been written.

Brian

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Jones  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 20:10
Newsgroups: fa.caml
From: Richard Jones <r...@annexia.org>
Date: Sun, 08 Nov 2009 20:10:05 UTC
Local: Sun 8 Nov 2009 20:10
Subject: Re: [Caml-list] Unboxed float tuples

On Mon, Nov 09, 2009 at 12:01:48AM +0800, Daniel Bünzli wrote:
> Tuples and records are represented the same way. However when it comes
> to records with only floats fields we get a special unboxed
> representation.

> Why don't we get that for tuples of floats only ?

> Using tuples (vs records) to handles points and vectors is
> syntactically more lightweight (IMHO). More important it makes it
> easier to share that kind of data
> between independent modules without introducing new dependencies.
> However I don't want to sacrifice the unboxed representation for that.

I guess others have pointed out why this isn't so easy.

How about a syntax extension instead to turn a vector (| a, b, c |)
into { v0 = a; v1 = b; v2 = c }, and a standard type to solve the
module communication problem?  I'm not sure if camlp4 will let you
define bracket lexemes like that.

Rich.

--
Richard Jones
Red Hat

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jon Harrop  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 20:35
Newsgroups: fa.caml
From: Jon Harrop <j...@ffconsultancy.com>
Date: Sun, 08 Nov 2009 20:35:12 UTC
Local: Sun 8 Nov 2009 20:35
Subject: Re: [Caml-list] Unboxed float tuples
On Sunday 08 November 2009 19:39:03 Brian Hurt wrote:

> Fixing this would require a major rearchitecting and rewrite of not only
> the compiler, but also the garbage collector, the run time, and all the C
> bindings that have been written.

If you're willing to endure a whole program optimization pass then you can
avoid having to touch the GC and run-time by monomorphizing the code, e.g.
converting all tuples into monomorphic record types.

--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christophe Raffalli  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 20:59
Newsgroups: fa.caml
From: Christophe Raffalli <christophe.raffa...@univ-savoie.fr>
Date: Sun, 08 Nov 2009 20:59:13 UTC
Local: Sun 8 Nov 2009 20:59
Subject: Re: [Caml-list] Unboxed float tuples

>> t to sacrifice the unboxed representation for that.

> I guess others have pointed out why this isn't so easy.

> How about a syntax extension instead to turn a vector (| a, b, c |)
> into { v0 = a; v1 = b; v2 = c }, and a standard type to solve the
> module communication problem?  I'm not sure if camlp4 will let you
> define bracket lexemes like that.

I use (^ ^) and {^ ^} as bracket for my bindlib library.

The only defect is that you have to add spaces :

^)^))) should be written ^) ^) ))

You can look at the code of bindlib for more info ...

Cheers,
Christophe

  signature.asc
< 1K Download

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lukasz Stafiniak  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 21:25
Newsgroups: fa.caml
From: Lukasz Stafiniak <lukst...@gmail.com>
Date: Sun, 08 Nov 2009 21:25:58 UTC
Local: Sun 8 Nov 2009 21:25
Subject: Re: [Caml-list] Unboxed float tuples
On Sun, Nov 8, 2009 at 9:58 PM, Christophe Raffalli

<christophe.raffa...@univ-savoie.fr> wrote:

>> How about a syntax extension instead to turn a vector (| a, b, c |)
>> into { v0 = a; v1 = b; v2 = c }, and a standard type to solve the
>> module communication problem?  I'm not sure if camlp4 will let you
>> define bracket lexemes like that.

> I use (^ ^) and {^ ^} as bracket for my bindlib library.

I've been using {| |} -- a mesh of [| |] and { }

Cheers

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google