-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A macro for algebraic data types (ADTs) #58
Comments
I don't know if there's a better syntax though, feel free to discuss, :) One potential, conforming to hy's type annotation. (defadt Shape
[Point #^float x
[y 0]]
[Circle #^float x
#^float y
#^float r]
[Rectangle #^float x
y
#^float w
#^float h]
[Whatever x y z a]) |
Please don't use the issues list as a stream-of-consciousness. Think through what you want to say, experimenting as necessary, and then say it. (I wrote this comment in reply to a lot of other comments that are now deleted.) |
Well, I don't know what exactly should this macro look like because in genral lisps' don't have ADT. Therefore I don't know what the syntax should look like. I post the last one to ask people's opinion on it. They do look a bit noisy, I'm going to clean it up a bit. Sorry about that. EDIT: And potentially something here should be send to hy as an issue since I'm not sure if macros in hy is working properly again. |
I just stumble across ADT in python, and it translate into this in hy. Which is kinda ugly.
Here I present a macro, so it's looks a bit better:
macro implementation
But noted that not all properties is supported, because in my perspective we should keep adt simple.
The text was updated successfully, but these errors were encountered: