[clean-list] Re: some questions concerning CLR2.1, page 40f

clean-list.mail.zooloo at xoxy.net clean-list.mail.zooloo at xoxy.net
Mon Dec 12 01:03:25 MET 2005


Hi,


studying the Clean Language Report 2.1, page 40 f., I stumble across some questions that I can't resolve by myself.
Alas, that's nothing uncommon in my Clean studies (both in the Clean Book and the CLR), but four issues at mere two
pages is more than usual. I think if I further continued to confine my mailings to a particularly hard problem every
couple of weeks, not just me would miss something:
some more feedback might be appropriate anyway, even if in the form of possibly dumb questions.


An important initial motivation of mine to give Clean a try was my (preliminary) impression that it's a clever language
to program in and allows to write fast, elegant, referentially transparent code with ease. Now, to be honest, if something
will possibly throw me off Clean some day, it won't be uniqueness typing (even though I find it harder to fully understand
and to deal with than monads - I have started learning Haskell and Clean in parallel), nor the somewhat restricted set of
available libraries and interfaces, but:

the comprehensibility of documentation.



Here is what has cost me hours today (sorry, but I don't try to hide my frustration):


(1)

At page 40, the syntax of array updates is defined as follows:

    ArrayUpdate = { ArrayExpr & [{ArrayIndex {Selection} = GraphExpr}-list] [\\ {Qualifier}-list]}
                   | {[ArrayExpr &] GraphExpr \\ {Qualifier}-list}

    Selection = .FieldName | .ArrayIndex

    ArrayExpr = GraphExpr


I cannot succeed to get an array element selected by a field name in any way. How to do this?




(2)
"A unique array of any type created by an overloaded function cannot be converted to a non-unique array."

Since "by an overloaded function" is explicitely mentioned here, what about unique arrays created by non-overloaded
functions?




(3)
"One can use an array comprehension or a list comprehension (see 4.2.1) to list these elements compactly in the same
spirit as with an list comprehension.
Array comprehensions can be used in combination with the update operator."

List comprehensions in arrays can be used in combination with the update operator as well, can't they? (The example
suggest so.) Note however that, to someone who doesn't *know* the stuff described there yet, it's quite fatiguing
to deal with such ambiguities. The wording is at least confusing, and "fluent learning" breaks at such points.




(4)

Page 41 states:

"Array comprehensions used without update operator automatically generate a whole new array. The size of this new array
will be equal to the size of the first array or list generator from which elements are drawn. Drawn elements that are
rejected by a corresponding guard result in an undefined array element on the corresponding position."


How is this supposed to be understood?



The program

Start = size {xx \\ xx<-:{-1.0,2.0} | xx < 0.0}

- oops? *sigh* do I really have to specify the type of _every_ _little_ _array_ I create?! why can't I just write e. g.
{#-1.0,2.0}, as with lists? well, -


Start = size y
where
 y :: .{#Real}
 y = {xx \\ xx<-:x | xx < 0.0}
 where
  x :: .{#Real}
  x = {-1.0,2.0}


yields 1, rather than 2.




Thanks in advance for any help or explanation.


zooloo









-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/197 - Release Date: 09.12.2005

-------------- next part --------------
Spam detection software, running on the system "multi.science.ru.nl", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
postmaster at science.ru.nl for details.

Content preview:  Hi, studying the Clean Language Report 2.1, page 40 f.,
  I stumble across some questions that I can't resolve by myself. Alas,
  that's nothing uncommon in my Clean studies (both in the Clean Book and
  the CLR), but four issues at mere two pages is more than usual. I think
  if I further continued to confine my mailings to a particularly hard
  problem every couple of weeks, not just me would miss something: some
  more feedback might be appropriate anyway, even if in the form of
  possibly dumb questions. [...] 

Content analysis details:   (5.7 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 0.3 NO_REAL_NAME           From: does not include a real name
 1.6 BAYES_50               BODY: Bayesian spam probability is 40 to 60%
                            [score: 0.5003]
 3.8 FORGED_MUA_OUTLOOK     Forged mail pretending to be from MS Outlook




More information about the clean-list mailing list