Just updating an older project.
j’ ’ strings - are these now no longer needed ?- emoji just seem to work in normal strings now.
Trying out core, is there a similar Array.range(1,12) function?
Doing something like
Array(12).fill().map((_, i) => i+1);
Just gives me variant constructor errors.
Also an equivalent to Array.rangeBy(to, from, step)?
What would Js.Math.random_int(1, 12) be now, just removing the Js. prefix doesn’t work?
Looks like I can just remove Js.Global prefixes now too. Which is great.
Also do we still have to use useEffect0() etc… now ? (useEffect() seems to work).
string_to_int() would it be preferable to use Int.toString() now?
let range: int => array<int> = %raw(`(i) => [...Array(i).keys()]`)
Thanks. The function Belt.Array.ShuffleInPlace() is a really useful one too I couldn’t see that in the Int Module are there any plans to add it?
Why would it be in
Int? It’s in
Ah sorry I missed in was in Array. To be honest I wasn’t clear on the boundary but I suppose Int.range() takes ints and returns an array. (so a module can convert from it’s type to another type?)
The last one I can’t find is where Js.Math.random__int() is now?
Int.range returns an
Float.range returns an
array<float>. I wouldn’t say it converts anything.
let randomInt = (min, max) =>
Float.toInt(Math.random() *. float(max - min)) + min