Re: [racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
I hope to be a trend setter.  Haven't really introduced myself but I find
racket a great toolset for getting 

Re: [racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
I agree on the importance of an efficient algorithm.  I do feel knowing
some of the internals of how language or development environment stores and
access values can be part of determining the nature of what is the most
efficient algorithm.  Sometimes flaws in an environment can lead to a
counter intuitive solution being the shortest distance from point A to B.
I could relay a tale of SELECT statements in Unidata for that one.

On Thu, Oct 27, 2016 at 2:57 PM, David Storrs <david.sto...@gmail.com>
wrote:

> You know, it's a very pleasant surprise to me how many messages I've
> recently seen on this list that began "I'm just getting started with
> Racket and"  Great to see that the Racket community is growing.
>
> On Thu, Oct 27, 2016 at 2:42 PM, Jos Koot <jos.k...@gmail.com> wrote:
> > Hi
> >
> > Lisp (and Racket) programmers know the value, Fortran (and assembler)
> programmers the cost.
> > Nowadays the PLTeam is working on effeciency too, I think.
> > But: the most important factor for efficient programming is to select
> efficient algorithms.
> > Two very simple, but notorious examples where you can go wrong in
> efficiency with the algorithm
> > are Fibonacci numbers and binomial coefficients.
> >
> > Nowadays we have lots of primary memory, but long ago, with machines
> with limited primary memory,
> > there was a time that for some computations it was faster to recompute
> than to store to and retrieve from disk.
> > Much depends on the architecture of the computer, which in the old days
> was documented very well,
> > so well that you could predict how data were flowing through the
> processors (even with virtual memory).
> > Nowaday manufactures of computers give less information.
> > For a good estimation of the efficiency of a program
> > you have to know which busses are used, their numbers of bits and their
> frequencies
> > and how well these busses connect to each other.
> > Well, a little bit of nostalgia.
> >
> > MHO, Jos
> >
> > -Original Message-
> > From: racket-users@googlegroups.com [mailto:racket-users@
> googlegroups.com] On Behalf Of Ken MacKenzie
> > Sent: jueves, 27 de octubre de 2016 19:28
> > To: Racket Users
> > Cc: deviloc...@gmail.com
> > Subject: Re: [racket-users] Structs vs Lists
> >
> > Thank you for the information.  Good to know.  Performance isn't the
> first thing I am thinking about, but as I am tinkering and
> > getting running with Racket I like to kind of dig into the underlying
> structure to know the cost of certain operations.
> >
> > Ken
> >
> >> For accessing an arbitrary member, yes. A Racket vector is like, say, a
> C array: it's a contiguous chunk of memory, and you can
> > get at any member of it in constant time.
> >>
> >>
> >> For other purposes? Depends on the purpose. A struct is superior to a
> list for struct-like operations. A list is superior to a
> > struct for list-like operations.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Structs vs Lists

2016-10-27 Thread David Storrs
You know, it's a very pleasant surprise to me how many messages I've
recently seen on this list that began "I'm just getting started with
Racket and"  Great to see that the Racket community is growing.

On Thu, Oct 27, 2016 at 2:42 PM, Jos Koot <jos.k...@gmail.com> wrote:
> Hi
>
> Lisp (and Racket) programmers know the value, Fortran (and assembler) 
> programmers the cost.
> Nowadays the PLTeam is working on effeciency too, I think.
> But: the most important factor for efficient programming is to select 
> efficient algorithms.
> Two very simple, but notorious examples where you can go wrong in efficiency 
> with the algorithm
> are Fibonacci numbers and binomial coefficients.
>
> Nowadays we have lots of primary memory, but long ago, with machines with 
> limited primary memory,
> there was a time that for some computations it was faster to recompute than 
> to store to and retrieve from disk.
> Much depends on the architecture of the computer, which in the old days was 
> documented very well,
> so well that you could predict how data were flowing through the processors 
> (even with virtual memory).
> Nowaday manufactures of computers give less information.
> For a good estimation of the efficiency of a program
> you have to know which busses are used, their numbers of bits and their 
> frequencies
> and how well these busses connect to each other.
> Well, a little bit of nostalgia.
>
> MHO, Jos
>
> -Original Message-
> From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
> Behalf Of Ken MacKenzie
> Sent: jueves, 27 de octubre de 2016 19:28
> To: Racket Users
> Cc: deviloc...@gmail.com
> Subject: Re: [racket-users] Structs vs Lists
>
> Thank you for the information.  Good to know.  Performance isn't the first 
> thing I am thinking about, but as I am tinkering and
> getting running with Racket I like to kind of dig into the underlying 
> structure to know the cost of certain operations.
>
> Ken
>
>> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
>> array: it's a contiguous chunk of memory, and you can
> get at any member of it in constant time.
>>
>>
>> For other purposes? Depends on the purpose. A struct is superior to a list 
>> for struct-like operations. A list is superior to a
> struct for list-like operations.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: [racket-users] Structs vs Lists

2016-10-27 Thread Jos Koot
Hi

Lisp (and Racket) programmers know the value, Fortran (and assembler) 
programmers the cost.
Nowadays the PLTeam is working on effeciency too, I think.
But: the most important factor for efficient programming is to select efficient 
algorithms.
Two very simple, but notorious examples where you can go wrong in efficiency 
with the algorithm
are Fibonacci numbers and binomial coefficients.

Nowadays we have lots of primary memory, but long ago, with machines with 
limited primary memory,
there was a time that for some computations it was faster to recompute than to 
store to and retrieve from disk.
Much depends on the architecture of the computer, which in the old days was 
documented very well,
so well that you could predict how data were flowing through the processors 
(even with virtual memory).
Nowaday manufactures of computers give less information.
For a good estimation of the efficiency of a program
you have to know which busses are used, their numbers of bits and their 
frequencies
and how well these busses connect to each other.
Well, a little bit of nostalgia.

MHO, Jos

-Original Message-
From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Ken MacKenzie
Sent: jueves, 27 de octubre de 2016 19:28
To: Racket Users
Cc: deviloc...@gmail.com
Subject: Re: [racket-users] Structs vs Lists

Thank you for the information.  Good to know.  Performance isn't the first 
thing I am thinking about, but as I am tinkering and
getting running with Racket I like to kind of dig into the underlying structure 
to know the cost of certain operations.

Ken

> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
> array: it's a contiguous chunk of memory, and you can
get at any member of it in constant time.
> 
> 
> For other purposes? Depends on the purpose. A struct is superior to a list 
> for struct-like operations. A list is superior to a
struct for list-like operations.
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
Thank you for the information.  Good to know.  Performance isn't the first 
thing I am thinking about, but as I am tinkering and getting running with 
Racket I like to kind of dig into the underlying structure to know the cost of 
certain operations.

Ken

> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
> array: it's a contiguous chunk of memory, and you can get at any member of it 
> in constant time.
> 
> 
> For other purposes? Depends on the purpose. A struct is superior to a list 
> for struct-like operations. A list is superior to a struct for list-like 
> operations.
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Structs vs Lists

2016-10-27 Thread Jon Zeppieri
On Thu, Oct 27, 2016 at 1:09 PM, Ken MacKenzie  wrote:

> Thank you that makes sense.  Vectors are fixed length so in theory could I
> also say a Vector is possibly more performant than an equivalent list?
>
> Ken
>

For accessing an arbitrary member, yes. A Racket vector is like, say, a C
array: it's a contiguous chunk of memory, and you can get at any member of
it in constant time.

For other purposes? Depends on the purpose. A struct is superior to a list
for struct-like operations. A list is superior to a struct for list-like
operations.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
Thank you that makes sense.  Vectors are fixed length so in theory could I also 
say a Vector is possibly more performant than an equivalent list?

Ken

On Thursday, October 27, 2016 at 12:58:06 PM UTC-4, Jon Zeppieri wrote:
> On Thu, Oct 27, 2016 at 12:16 PM, Ken MacKenzie  wrote:
> This is a question more about the footprint of each.  Deep down is a Struct 
> really just syntactic sugar over a list.  
> 
> 
> Not in Racket (or in most Lisps these days).
> 
> 
>  As in most things in Lisp from my understanding are all just lists, it is 
> the basic building block of all data.  Is a struct also just a list and the 
> element names enumerations of the fields by position.
> 
> 
> 
> In terms of its representation in memory, a Racket struct is more like a 
> vector than a list.
>  
> 
> 
> Basically I am trying to figure out, without writing a benchmark test, if 
> there is any processing overhead in using a struct instead of a list with 
> enumerated field names.
> 
> 
> 
> It should generally be more efficient to access an arbitrary struct field 
> than an arbitrary list member.
>  
> 
> 
> Ken
> 
> 
> 
> --
> 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users...@googlegroups.com.
> 
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Structs vs Lists

2016-10-27 Thread Jon Zeppieri
On Thu, Oct 27, 2016 at 12:16 PM, Ken MacKenzie 
wrote:

> This is a question more about the footprint of each.  Deep down is a
> Struct really just syntactic sugar over a list.


Not in Racket (or in most Lisps these days).



> As in most things in Lisp from my understanding are all just lists, it is
> the basic building block of all data.  Is a struct also just a list and the
> element names enumerations of the fields by position.
>

In terms of its representation in memory, a Racket struct is more like a
vector than a list.


>
> Basically I am trying to figure out, without writing a benchmark test, if
> there is any processing overhead in using a struct instead of a list with
> enumerated field names.
>

It should generally be more efficient to access an arbitrary struct field
than an arbitrary list member.


>
> Ken
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
This is a question more about the footprint of each.  Deep down is a Struct 
really just syntactic sugar over a list.  As in most things in Lisp from my 
understanding are all just lists, it is the basic building block of all data.  
Is a struct also just a list and the element names enumerations of the fields 
by position.

Basically I am trying to figure out, without writing a benchmark test, if there 
is any processing overhead in using a struct instead of a list with enumerated 
field names.

Ken

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.