Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 6024 days ago | link | parent

Looks good, although probably needs more examples, maybe some actual use cases.

On the implementation side... I notice you use (apply list 'do ...). I suspect you can probably make it a very big `(do ...) form, although you may have felt that it was getting bit complicated I guess ^^;.



1 point by absz 6024 days ago | link

For use cases: see Haskell code? :P I wrote this because I really liked them in other languages and in EOPL, and thought they might come in handy. If I come across somewhere in my Arc code where I use them (I haven't written too much new Arc recently) I'll report out.

I also wrote most of this a while ago (I think I started in March), and my coding has improved quite a bit since then, so the implementation could probably get cleaned up... :)

-----

2 points by almkglor 6024 days ago | link

> For use cases: see Haskell code? :P

LOL. The 'maybe type looks awfully familiar... ^^

> If I come across somewhere in my Arc code where I use them (I haven't written too much new Arc recently) I'll report out.

Please do ^^. As an aside, it may be possible to transform the AST data structures in arc2c to tagged unions; we could transform the (if (alam ast) ... (alit ast) ...) to tcase forms. Care to try? It strikes me as a possible demonstration of your code, and may be useful to shake out bugs.

-----

1 point by absz 6024 days ago | link

I like maybe :) Also, it's simple and good for testing (e.g. it has a zero-ary type).

The arc2c thing sounds sensible---I have to fix a bug in tagged-union.arc first (you can't currently have a constructor with the same name as the datatype), but then I'll try to work on it.

-----

2 points by almkglor 6024 days ago | link

Well, in this case the data type would be ast, and the constructors would be lam, lit, quote, etc.

-----

2 points by absz 6024 days ago | link

Right---there was something similar in EOPL, and I have something similar in a toy Lisp interpreter (in Haskell) I'm working on.

-----