[m-users.] Cartesian product of two sets of things.

Volker Wysk post at volker-wysk.de
Mon Oct 9 23:00:24 AEDT 2023


Hi

Mercury doesn't provide for a data type for blobs. Using a bitmap instead
can be a workaround. See the thread "Passing blobs over the foreign language
interface", of 2023-02-11, which I've started here in the list.

But I've found a library for a Mercury blob data type. It's part of Ondrej
Bojar’s Mercury Anarchy Archive. See here:

http://volker-wysk.de/mercury/resources.html#ondrej-bojars-mercury-anarchy-archive-manarchive

It's in packages/lib_tools/src/blob.m. It's just 325 lines long.

This might be useful for you, as a library or as a source of inspiration.

Cheers,
Volker

Am Montag, dem 09.10.2023 um 11:54 +0100 schrieb Sean Charles
(emacstheviking):
> I know I did but that's me being me!
> So far, Mercury has only impressed me with how pleasant writing a game can
> be.
> 
> I was reading the source code for the array module, trying to get some
> ideas on how I might implement a module that could allocate a fixed block
> of memory for N slots of a du type and then provide an interface to it so
> I can walk that block using just pointer arithmetic, and then, given a
> pointer, which would be declared as a mercury type too, provide some
> update methods to either write a single field or, given a fully populated
> du instance, copy all the fields in one go.

I don't completely get what you're up to. By "du" you mean "discriminated
union"?

> From what I've seen I think it wouldn't be that hard, it would bevery
> interesting for me to do and I'd learn a lot.
> 
> In the future I'd like to try using Mercury as the means to write code for
> the Godot game engine system too:
> https://godotengine.org/article/introducing-gd-extensions/
> 
> As usual, day jobs and other stuff are time bandits.
> 
> 
> > On 9 Oct 2023, at 11:45, Volker Wysk <post at volker-wysk.de> wrote:
> > 
> > You're welcome. 
> > 
> > I'm not sure how efficient this is, though. You wanted to have maximum
> > efficiency before, for your game...
> > 
> > Cheers,
> > Volker
> > 
> > Am Montag, dem 09.10.2023 um 11:34 +0100 schrieb Sean Charles
> > (emacstheviking):
> > > Nice, I'm stealing that! I will adapt it, and of course your name will
> > > be carved in pixels in the ether in a comment in a game that nobody
> > > will ever see!
> > > 
> > > Thanks Volker.
> > > 
> > > :)
> > > 
> > > 
> > > > On 9 Oct 2023, at 10:08, Volker Wysk <post at volker-wysk.de> wrote:
> > > > 
> > > > Am Montag, dem 09.10.2023 um 11:04 +0200 schrieb Volker Wysk:
> > > > > :- pred cart_prod(set(T)::in, set(U)::in, set(pair(T, U))::out) is
> > > > > det.
> > > > 
> > > > Oops, that should be:
> > > > 
> > > > :- pred cart_prod(set(T)::in, set(U)::in, list(pair(T, U))::out) is
> > > > det.
> > > > 
> > > > Volker
> > > > _______________________________________________
> > > > users mailing list
> > > > users at lists.mercurylang.org
> > > > https://lists.mercurylang.org/listinfo/users
> > > 
> > 
> > _______________________________________________
> > users mailing list
> > users at lists.mercurylang.org
> > https://lists.mercurylang.org/listinfo/users
> 



More information about the users mailing list