Finding Strings within Strings in ATS

35 views
Skip to first unread message

d4v3y_5c0n3s

unread,
Feb 25, 2021, 8:44:24 AM2/25/21
to ats-lang-users
    I was searching through the prelude looking for a way to find a formatted string within another string in ATS, but there doesn't seem to be a built-in way to do this.  Before I make something myself, I just wanted to see what opinions there are on the best way to perform this operation in ATS.
    Do you think I should use the C standard library through ATS' ability to call inline C code?  Should I just loop through a strnptr and manually check the chars?  Personally, I want to try using linear streams here to take advantage of their low-memory overhead (and because I've fallen straight into the "once you have a hammer everything looks like a nail" trap with linear streams.)  But, I want to hear what others think, so please let me know which solution you think is best.
    As a side note, should we add more string manipulation capabilities to the prelude?  I don't know what Hongwei's stance on this is, but if he thinks it would be a good idea I'd be willing to contribute these functions to the prelude.

gmhwxi

unread,
Feb 27, 2021, 11:19:07 AM2/27/21
to ats-lang-users

I myself have been using the PCRE library:


There is also the SDSTRING library available.

You are welcome to implement a library of string manipulation functions. And I am happy to

As for building an ecosystem for ATS3, I am thinking about a way for contributed packages to
be hosted on-line. Not much progress is made at this stage, though.

--Hongwei

Elijah Stone

unread,
Feb 27, 2021, 6:04:13 PM2/27/21
to ats-lang-users
On Sat, 27 Feb 2021, gmhwxi wrote:
> As for building an ecosystem for ATS3, I am thinking about a way for
> contributed packages to be hosted on-line. Not much progress is made at
> this stage, though.

Have you seen
https://github.com/vmchale/atspkg/blob/master/ats-pkg/README.md ?

gmhwxi

unread,
Feb 28, 2021, 11:35:29 AM2/28/21
to ats-lang-users
Thanks for the link. I will take a look.

d4v3y_5c0n3s

unread,
Mar 1, 2021, 9:11:13 PM3/1/21
to ats-lang-users
Thank you for the suggestions.  I decided to sidestep my need to _ for now.  While atscntrb-hx-libpcre seems like it would suit my needs, I'd rather not require people to install too many external libraries.  Is ATS3 suitable for writing libraries for currently?  Because if I were to implement string processing functions it would make the most since to do it for ATS3.

gmhwxi

unread,
Mar 4, 2021, 11:35:57 AM3/4/21
to ats-lang-users
Your question got me thinking :)

I feel that ATS3 is not yet suitable right now.

I am focusing on implementing a typechecker for linear and dependent types.
After that, I suppose I can polish it a bit and then make a release.

--Hongwei

d4v3y_5c0n3s

unread,
Mar 5, 2021, 1:21:59 PM3/5/21
to ats-lang-users
Cool!  I can't wait for the first release of ATS3, good luck and thanks!
Reply all
Reply to author
Forward
0 new messages