Re: [stack] Notation for typed arrays in Cat
Stevan Apter <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
i find quine's argument in _set theory and its logic_ for reversing domain -> range
to match our use of y=f x persuasive. in a sense, we're first interested in the
result, and then in the argument needed to produce it.
Y <- X
appeals to me, and in fact i use that ordering consistently in my own coding
practice. if you adopt that convention, then postfix makes more sense: you read
left-to-right and evaluate right-to-left.
----- Original Message -----
From: "Christopher Diggins" <[email protected]>
To: "concatenative" <[email protected]>; <[email protected]>
Sent: Friday, April 04, 2008 10:26 AM
Subject: [stack] Notation for typed arrays in Cat
>I am again playing with the idea of how to introduce typed arrays in to Cat.
>
> The following is the notation that I prefer, but I am concerned about
> the confusion of ['a] meaning a list of 'a in types, and [a] meaning a
> quotation in the code:
>
> uncons : (['a] -> ['a] 'a)
> cons : (['a] 'a -> ['a])
> empty : (['a] -> ['a] bool)
> count : (['a] -> ['a] int)
>
> Another syntax I am seriously considering is:
>
> uncons : ('a* -> 'a* 'a)
> cons : ('a* 'a -> 'a*)
> empty : ('a* -> 'a* bool)
> count : ('a* -> 'a* int)
>
> And yet another contender is:
>
> uncons : (list('a) -> list('a) 'a)
> cons : (list('a) 'a -> list('a))
> empty : (list('a) -> list('a) bool)
> count : (list('a) -> list('a) int)
>
> This last one is interesting because it opens the door to the
> possibility of full-blown meta-programming at the type-level. There
> are hints of how the type-system could be used as a programming
> language. Of course if I could also keep it postfix:
>
> uncons : ('a list -> 'a list 'a)
> cons : ('a list 'a -> 'a list)
> empty : ('a list -> 'a list bool)
> count : ('a list -> 'a list int)
>
> This might be more consistent, but for some reason I feel more
> comfortable with the prefix notation. It delineates the world of types
> from the world of values more clearly for me.
>
> Any thoughts or opinions on the subject would be appreciated.
>
> - Christopher
>