Hi Folks,

The recent discussion of un-initialized list element referencing reminded me of a typo in the draft of the 2nd edition of Alan Corre's "Icon Programming for Humanists".

On page 43, in example code of procedure printout()

   # Arrange info in columns and figure letter total
     write(right(n,2),right(1[n],12))

the example intends to reference an element of a list identified by letter 'l' , as in l[n] .

But, square brackets also reference positions within strings.

The examples below of implicit type conversion may be diverting; if not, please forgive this enthusiastic spam for Icon, Unicon, and "Icon Programming for the Humanities".

   procedure main()
      # '1' below represents the digit one, not the letter 'l'.

      if 1[1] = 1 then            # numerical comparison
         write("1[1] = 1")

      if 1[1] == 1 then           # lexical comparison
         write("1[1] == 1")

      if 1[1] === "1" then        # value and type comparison
         write("1[1] === \"1\"")
   end

produces:

   1[1] = 1
   1[1] == 1
   1[1] === "1"

Regards, Alan B Saichek

Dear friends,

A draft of the 2nd edition of Alan Corre's Icon Programming for
Humanists is available for public comment;
a link is on the Jeffery Systems page, under Books at unicon.org. We
would appreciate corrections.

Alan has generously contributed to the new edition of his book, and
even more generously agreed that it should
be made available in free electronic form.

Cheers,
Clint

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to