Posting here must have had a catalytic effect, as I figured it out already, using:

1
2
let resp = Array.create 1034 0uy in
By on 7/16/2007 12:07 PM ()

Posting here must have had a catalytic effect, as I figured it out already, using:

1
2
let resp = Array.create 1034 0uy in
By on 7/16/2007 12:07 PM ()

Hi Tamerlin

1
let response :byte array= Array.create 1024 0uy;;

Hope this helps.

Can

By on 7/16/2007 12:04 PM ()

I just realised you don't need to infer the type. Thanks to type inference.

1
let response = Array.create 1024 0uy
By on 7/16/2007 12:07 PM ()

Hello,
depending on the way you want to initialize elements of the array, you can use one of the following three functions:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 

// Initialize an array with the default value (zero or 'null')
// Note, you may need to use type annotations, because 
// it may be difficult for the compiler to figure out the type
let ar = (Array.zero_create 1024 : int[])

// Initialize an array with a constant value (1 in this case)
let ar = Array.create 1024 1

// Initialize an array using a function that generates
// a value for every element - in this sample we build an array
// with values [| 0; 2; 4; 6; 8; ...; 2046 |]
let ar = Array.init 1024 (fun n -> n*2)
By on 7/16/2007 12:02 PM ()

Good timing! Thanks for the help, even though I figured it out while you were posting the response, apparently :)

I appreciate the effort nonetheless.

By on 7/16/2007 12:08 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper