Re: [q-lang-users] where
Brought to you by:
agraef
From: Albert G. <Dr....@t-...> - 2006-10-09 20:18:44
|
Rob Hubbard wrote: > Perhaps the "where" (and even "if" for a common conditional) keywords > could be used for the "letting" clauses (assuming the grammar doesn't > then become ambiguous, and assuming the language can be extended > consistently in this way). Yes, this could be done. Looks a bit weird, though: strip C S where N = #S-1 = strip C $ sub S 0 (N-1) if (S!N = C); = strip C $ sub S 1 N if (S!0 = C); = S otherwise; Maybe we can invent a syntax that better mimics the way that mathematicians actually write these things? Also, you might then want to nest those shared definitions. E.g., have another shared variable which is only defined for the second and third equation. I don't see how this can be done in a free-format language without introducing some form of bulky begin ... end brackets. Of course there's an existing solution to this, namely Haskell's guarded equation syntax, but that also looks fairly messy IMHO. Oh well, I guess I'll have to take another look at Miranda to see if Turner already solved that problem. -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr....@t-..., ag...@mu... WWW: http://www.musikinformatik.uni-mainz.de/ag |