Certainly. The following code is written is ATS1:
https://github.com/githwxi/ATS-Anairiats/blob/master/libats/ngc/SATS/slist.sats slseg(l1, l2) is a singly-linked list segment from l1 to l2. So a circular one is just a case where l1 = l2. If you want a doubly-linked one, please see the following; https://github.com/githwxi/ATS-Anairiats/blob/master/libats/ngc/SATS/dlist.sats The caveat is that writing this kind of code often requires a lot of effort that may not be easily justified in practice. Another approach (which I would take) is to use reference-counted nodes; it makes the resulting code a bit slower but can drastically simplify the implementation effort. On Saturday, September 21, 2019 at 2:56:39 PM UTC-4, Vanessa McHale wrote: > > Hi all, > > Is it possible to write memory-safe circular linked list in ATS? > > Cheers, > Vanessa > > > -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/8b93b42a-5711-4c0b-8473-5439e22dd401%40googlegroups.com.