[isabelle-dev] code abbreviation for mapping over a fixed range
Florian Haftmann
florian.haftmann at informatik.tu-muenchen.de
Thu Nov 12 10:09:16 CET 2015
> The new definition actually causes *more* allocation than the original
> one, except for very short lists, because every call of @ copies its
> first argument. Note that the code equation for [_..<_] is
>
> lemma upt_rec[code]: "[i..<j] = (if i<j then i#[Suc i..<j] else [])"
>
> which has no calls to @ at all; a corresponding code equation for
> a fused "map_upt f i j = map f [i..<j]" would be
>
> "map_upt f i j = if i < j then f i # map_upt f (Suc i) j else []"
>
> which could be used to define map_range:
>
> "map_range f n = map_upt f 0 n"
OK, I'll revert this.
Thanks for having an eye on that.
Florian
--
PGP available:
http://home.informatik.tu-muenchen.de/haftmann/pgp/florian_haftmann_at_informatik_tu_muenchen_de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <https://mailman46.in.tum.de/pipermail/isabelle-dev/attachments/20151112/c217cda5/attachment.sig>
More information about the isabelle-dev
mailing list