Metapost through context incorrect `hex` function output

Hi, I have found that the metapost `hex` function outputs a strange result when run through `context`. I'm not quite sure what is leading to this output, maybe `hex` is redefined in `metafun`? To reproduce, place the following in test.mp: ``` show hex "8d"; ``` Then run `mpost`, which results in the correct value: ``` mpost -numbersystem=double test.mp ...
141
Running the following in context results in the following instead:
context test.mp ...
56
For some more details on tool versions:
ConTeXt: ConTeXt ver: 2025.04.28 14:29 LMTX fmt: 2025.5.7 int:
english/english
Metafun: metafun xl 2025-5-9 11:26
Metapost: version 2.02 (TeX Live 2023) (kpathsea version 6.3.5)
For some reason I couldn't manage to load `metafun` in `mpost` directly
to test it outside of ConTeXt, getting:
! I can't open file `metafun.mpii'. l.6 input metafun.mpii ``` Thanks in advance, Yann -- Yann Herklotz

On 5/9/2025 11:30 AM, Yann Herklotz wrote:
Hi,
I have found that the metapost `hex` function outputs a strange result when run through `context`. I'm not quite sure what is leading to this output, maybe `hex` is redefined in `metafun`?
just not implemented ... i pushed an update so you can check the binary from the build farm
To reproduce, place the following in test.mp:
``` show hex "8d"; ```
Then run `mpost`, which results in the correct value:
``` mpost -numbersystem=double test.mp ...
141
Running the following in context results in the following instead:
context test.mp ...
56
For some more details on tool versions: ConTeXt: ConTeXt ver: 2025.04.28 14:29 LMTX fmt: 2025.5.7 int: english/english Metafun: metafun xl 2025-5-9 11:26 Metapost: version 2.02 (TeX Live 2023) (kpathsea version 6.3.5) For some reason I couldn't manage to load `metafun` in `mpost` directly to test it outside of ConTeXt, getting:
! I can't open file `metafun.mpii'. l.6 input metafun.mpii ```
Thanks in advance, Yann
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

just not implemented ... i pushed an update so you can check the binary from the build farm
Oh thanks! I wasn't aware that there was a separate implementation in LMTX. All the best, Yann On 12/05/2025 00:09, Hans Hagen via ntg-context wrote:
On 5/9/2025 11:30 AM, Yann Herklotz wrote:
Hi,
I have found that the metapost `hex` function outputs a strange result when run through `context`. I'm not quite sure what is leading to this output, maybe `hex` is redefined in `metafun`?
just not implemented ... i pushed an update so you can check the binary from the build farm
To reproduce, place the following in test.mp:
``` show hex "8d"; ```
Then run `mpost`, which results in the correct value:
``` mpost -numbersystem=double test.mp ... >> 141 ```
Running the following in context results in the following instead:
``` context test.mp ... >> 56 ```
For some more details on tool versions:
ConTeXt: ConTeXt ver: 2025.04.28 14:29 LMTX fmt: 2025.5.7 int: english/english Metafun: metafun xl 2025-5-9 11:26 Metapost: version 2.02 (TeX Live 2023) (kpathsea version 6.3.5)
For some reason I couldn't manage to load `metafun` in `mpost` directly to test it outside of ConTeXt, getting:
``` ! I can't open file `metafun.mpii'. l.6 input metafun.mpii ```
Thanks in advance, Yann
-- Yann Herklotz

On 5/20/2025 10:22 AM, Yann Herklotz wrote:
just not implemented ... i pushed an update so you can check the binary from the build farm
Oh thanks! I wasn't aware that there was a separate implementation in LMTX.
Side note: the source code has been reorganized, cleaned up a bit, and additional primitives and features have been added so for lmtx one can also have a look at the luametafun manual (in addition to metafun). The basics are to be the same of course (like this hex, although that one actually can be implemented more powerful with some lua help). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

Ah thanks for the pointer, I did not know about the luametafun manual, that looks like a great resource. Thanks, Yann On 20/05/2025 10:30, Hans Hagen wrote:
On 5/20/2025 10:22 AM, Yann Herklotz wrote:
> just not implemented ... i pushed an update so you can check the binary from the build farm
Oh thanks! I wasn't aware that there was a separate implementation in LMTX.
Side note: the source code has been reorganized, cleaned up a bit, and additional primitives and features have been added so for lmtx one can also have a look at the luametafun manual (in addition to metafun). The basics are to be the same of course (like this hex, although that one actually can be implemented more powerful with some lua help).
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
-- Yann Herklotz
participants (3)
-
Hans Hagen
-
Hans Hagen
-
Yann Herklotz