[Grace-core] SETL question

James Noble kjx at ecs.vuw.ac.nz
Mon Apr 1 20:43:22 PDT 2013


> This post highlights the fact that we need to do some serious library design, and that we probably all have different ideas on how things should look.

yes and yes.
I am drafting something on inheritance - I think we've actually resolved everything
we actually need to resolve for the next version of the spec, almost en passant as
it were - and this should be the next focus. Libraries & environments.

> Note that SETL is a DSL for set manipulation, and Lisp is a DSL for list manipulation, so I would expect that set programs might be shorter n SETL and list programs shorter in LISP.

yep.

> Grace is an OO language.  So we should rejoice in using OO notation and idioms.

indeed!

> It may have been a mistake to use . for method request, but we did it.   So we should be HAPPY to write
> 
>    (2..10).collect{x -> x ^ 2}.into(aSet) or
>    (2..10).collect{x -> x ^ 2}
> 
> (depending on whether collect answers a stream or a collection) rather than trying to create a different top-level method name for every operation on every different kind of object.

sure.  my motivation for top-level methods was just that they're easy to work in minigrace,
and to try and follow the Alloy style - Alloy of course is a DSL for a relational algebra / calculus

> As for naming, it seems to me that allSatisfy{aPredicate} should answer a boolean, while collectAllSatisfying{aPredicate} should answer a stream (or collection).   Contrarily, noneSatisfy{aPredicate} should also answer a boolean.    These enumeration messages should work on streams (lazy collections) as well as eager collections.

yes right!

> But the meta-quesiton is: what's the design process?

this is something good to talk about tomorrow

James


More information about the Grace-core mailing list