dfinity / ic-repl

Apache License 2.0
70 stars 10 forks source link

fixed length vec support #76

Closed bianyuanop closed 1 year ago

bianyuanop commented 1 year ago

Hi,

I'm working on a vector database on internet computer, which needs to have a f32 vec with length 768 as input.

Is there any way I can declare fixed length vec in ic-repl?

chenyan-dfinity commented 1 year ago

You can use vec { 0.1; 0.1; 0.1; ... ; 0.1}, but since your vector is long, we can try some tricks.

let b = blob "puts in 768 characters here...";
(b : vec float32)

or

let b = file("a.txt");  // a.txt contains 768 bytes
function f(x) { let _ = 0.1 };
b.map(f)
bianyuanop commented 1 year ago

Thanks!