Zulip Chat Archive
Stream: lean4 dev
Topic: Documentation of Array runtime Behaviour
Kiran (Jul 26 2025 at 00:37):
Is there any documentation of the runtime representation of scalar arrays? I assume Array Float etc. is a sarray? or is it a vanilla array and can I get the value using lean_unbox(lean_array_cptr(args_raw)[i])?
Kiran (Jul 26 2025 at 01:51):
okay, after playing around a bit, I think I've figured out the behaviour. In an array, scalar values less than 64 bytes are stored inline and can be accessed via unbox, scalar values equal to 64 bytes are accessible through lean_ctor_obj_cptr
Kiran (Jul 26 2025 at 01:52):
mhhm but not float32 it seems
Robin Arnez (Jul 26 2025 at 13:04):
Values are stored just boxed (i.e. lean_object*) inside of Arrays, just like in Prod, etc.
Robin Arnez (Jul 26 2025 at 13:05):
https://lean-lang.org/doc/reference/latest//find/?domain=Verso.Genre.Manual.section&name=ffi-types should contain information about this, although it doesn't mention Float32
Henrik Böving (Jul 26 2025 at 13:28):
Float32 is a historically very recent addition that wasn't played with much so I'm not too surprised about this
Last updated: Dec 20 2025 at 21:32 UTC