A demo of Union/Find algorithm in ATS

24 views
Skip to first unread message

Steinway Wu

unread,
Sep 9, 2016, 5:36:35 PM9/9/16
to ats_...@discoursemail.com, ats-lang-users
Hi, 

I was reading a chapter about type inference and constraint solving in ML. It mentioned a quick Union/Find algorithm for testing equivalent classes. I translate the code into ATS, and pasted here at [glot.io: Union/Find](https://glot.io/snippets/eiaoq3icf1)

Just for fun.

-- 
Steinway Wu
Sent with Airmail

gmhwxi

unread,
Sep 9, 2016, 7:07:55 PM9/9/16
to ats-lang-users, ats_...@discoursemail.com

I suggest:

fun{} addr_of{a:t@ype} (pt a): ptr

Casting a pointer(64bit) to an integer(32bit) is a bit dangerous.

Steinway Wu

unread,
Sep 9, 2016, 11:25:45 PM9/9/16
to ats-lang-users, ats_...@discoursemail.com
Updated, thanks!
Reply all
Reply to author
Forward
0 new messages