Re: init




Jon Harrop wrote:
toby wrote:
boxcenter = centerpt + halfwidth/2.0 (* would also work *)

D'oh! With some extra work you could do that in OCaml or C++ as well. OCaml
would require different operators for different types (or slower, dynamic
typing).

Have a look at Blitz++ and Boost...

In lisp I would do:-
(map 'vector #'(lambda (cp) (+ cp (/ halfwidth 2))) centerpoint)

Which does the same as the perl Logan Shaw posted.
Can't you just do the same in OCaml?

It may be a little slower, but the speed of initializing a 3 value
array should not matter, unless the array is being initialized in some
place it shouldn't be.

.



Relevant Pages

  • Re: any function to handle this kind of counting?
    ... the OP would find APL equally as opaque as OCaml. ... rebuilding the dynamic data structure as you go is gonna be ... > So a brute force array-based implementation computes 40 times more ... Or size the array using two passes. ...
    (comp.programming)
  • Re: OCAML versus Scheme versus Clean
    ... compiler inline array references. ... now the OCAML code is ... only three times slower than the Bigloo code. ... porting the program and the compiler to ...
    (comp.lang.functional)
  • Re: About alternatives to Matlab
    ... I had thought that all of the array operations were allocating new arrays at ... arrays that Ocaml would not need. ... You can get the brevity of the Python approach in C. ... getting slicing into his language but the use of slicing in this Python ...
    (comp.lang.python)
  • Re: Ocaml versus Scheme
    ... However this does not change the result, which is OCAML is between ten ... the Array library is slightly faster than the Bigarray library. ... Here is how I compile the Scheme program: ...
    (comp.lang.scheme)
  • Re: OCAML versus Scheme versus Clean
    ... I received many suggestions to improve my OCAML program. ... compiler inline array references. ... now the OCAML code is ... for i= 0 to r-1 do ...
    (comp.lang.functional)