Code Comments
Programming Forum and web based access to our favorite programming groups.Björn Helgason wrote: > Frank Buss wrote: > > > > > +/'5'=":i.100 > 20 > > sum=:+/ > > what=:'5' > > equal=:= > > format=:": > > numbers=:i.100 > > sum what equal format numbers > 20 > This is supposed to tell me something? First of all what in heavens name is =:? Some languages use = for assignmen t, some use :=, but what is =:? OK, I'll jump to the conclusion (based on the structure of your sequence of whatever they are, lines, statements, assertions, declarations, expressions, utterances, you come up with more possibilities) that =: means "is defined to be" similar to ::= in BNF. sum=:+/ This is familiar from APL (presumably the APL content) what=:'5' sum what seems to say that the thing to be summed is 5 equal=:= equal is defined to be =, can't argue with that format=:": format is defined to be ": This explains a lot numbers=:i.100 Ditto. Hard to decide which of the last two lines is more illuminating. sum what equal format numbers 20 So you summed 4 5's Where did the 4 come from? Sorry for the somewhat sharp style of this post, but in my opinion a newsgro up posting should be designed to illuminate and instruct. The linguae francae of this news group are English for prose and APL for programming. If you are g oing to explain to APL'ers what +/'5'=":i.100 means that might be useful, but do it in English and/or APL or define your notation in those terms so that it is n ot a message only for insiders from some other world.
Post Follow-up to this messageIn article <%aC9e.40226$yV3.36249@clgrps12>, "James J. Weinkam" <jjw@cs.sfu.ca> writes: >... >First of all what in heavens name is =:? Some languages use = for assignme nt, >some use :=, but what is =:? >... >Sorry for the somewhat sharp style of this post, but in my opinion a newsgr oup >posting should be designed to illuminate and instruct.... I seldom post J to comp.lang.apl, but the above deserves some response. Hope the following description is illuminating & instructive (NB. comp.lang.lisp removed from groups). J gives meaning to C C. and C: for many ASCII characters C e.g. # 'number of items in' (e.g. number of items in a list) A. permutation: e.g. 4 A. 0 1 2 gives 2 0 1 (4th perm. of 0 1 2) =: means 'is_defined_to_be' NB. commences an inline comment NB.-------------------- start of J session -------------------- NB. original expression (spaced out for readability) +/ '5' = ": i. 100 20 NB. give English names to some components of the above J sentence numbers=: i. 100 NB. first 100 integers (starting from 0) format=: ": NB. ": means format (i.e. give text representation) equals=: = NB. produces 1 for TRUE, 0 for FALSE sum=: +/ NB. sum the items in a list sum '5' equals format numbers NB. i.e. how many 5s are there in 0-99? 20 NB. 2nd example: mean is_defined_to_be sum_of divided_by number_of mean=: +/ % # mean %: i. 100 NB. mean_of square_roots_of 0,1...99 6.61463 NB. 3rd example: note use of arbitrary-length integers (....x) 162115607033169106185260x A. 'tony blair maps our fate' labour party manifesto NB.--------------------- end of J session --------------------- -- J.E.H.Shaw [Ewart Shaw] strgh@uk.ac.warwick TEL: +44 2476 523069 Department of Statistics, University of Warwick, Coventry CV4 7AL, UK http://www.warwick.ac.uk/statsdept http://www.ewartshaw.co.uk 3 ((4&({*.(=+/))++/=3:)@([:,/0&,^:(i.3)@|:"2^:2))&.>@]^:(i.@[) <#:3 6 2
Post Follow-up to this messagestrgh@sherwood.csv.warwick.ac.uk wrote: > In article <%aC9e.40226$yV3.36249@clgrps12>, > "James J. Weinkam" <jjw@cs.sfu.ca> writes: > > > > > I seldom post J to comp.lang.apl, but the above deserves some response. > Hope the following description is illuminating & instructive > (NB. comp.lang.lisp removed from groups). > ... I wasn't so much asking for an expalnation of that particular fragment as as king that if J (or any other language other than APL) is posted here that it be explained in such a way that APLers can understand it without having to obta in manuals and spend hours studying them. Your post is a good example of how to do that. I only hope that others who see fit to post J examples here follow your lead.
Post Follow-up to this messageIn article <%aC9e.40226$yV3.36249@clgrps12>, "James J. Weinkam" <jjw@cs.sfu.ca> writes: >... >First of all what in heavens name is =:? Some languages use = for assignme nt, >some use :=, but what is =:? >... >Sorry for the somewhat sharp style of this post, but in my opinion a newsgr oup >posting should be designed to illuminate and instruct.... I seldom post J to comp.lang.apl, but the above deserves some response. Hope the following description is illuminating & instructive (NB. comp.lang.lisp removed from groups). J gives meaning to C C. and C: for many ASCII characters C e.g. # 'number of items in' (e.g. number of items in a list) A. permutation: e.g. 4 A. 0 1 2 gives 2 0 1 (4th perm. of 0 1 2) =: means 'is_defined_to_be' NB. commences an inline comment NB.-------------------- start of J session -------------------- NB. original expression (spaced out for readability) +/ '5' = ": i. 100 20 NB. give English names to some components of the above J sentence numbers=: i. 100 NB. first 100 integers (starting from 0) format=: ": NB. ": means format (i.e. give text representation) equals=: = NB. produces 1 for TRUE, 0 for FALSE sum=: +/ NB. sum the items in a list sum '5' equals format numbers NB. i.e. how many 5s are there in 0-99? 20 NB. 2nd example: mean is_defined_to_be sum_of divided_by number_of mean=: +/ % # mean %: i. 100 NB. mean_of square_roots_of 0,1...99 6.61463 NB. 3rd example: note use of arbitrary-length integers (....x) 162115607033169106185260x A. 'tony blair maps our fate' labour party manifesto NB.--------------------- end of J session --------------------- -- J.E.H.Shaw [Ewart Shaw] strgh@uk.ac.warwick TEL: +44 2476 523069 Department of Statistics, University of Warwick, Coventry CV4 7AL, UK http://www.warwick.ac.uk/statsdept http://www.ewartshaw.co.uk 3 ((4&({*.(=+/))++/=3:)@([:,/0&,^:(i.3)@|:"2^:2))&.>@]^:(i.@[) <#:3 6 2
Post Follow-up to this messagestrgh@sherwood.csv.warwick.ac.uk wrote: > In article <%aC9e.40226$yV3.36249@clgrps12>, > "James J. Weinkam" <jjw@cs.sfu.ca> writes: > > > > > I seldom post J to comp.lang.apl, but the above deserves some response. > Hope the following description is illuminating & instructive > (NB. comp.lang.lisp removed from groups). > ... I wasn't so much asking for an expalnation of that particular fragment as as king that if J (or any other language other than APL) is posted here that it be explained in such a way that APLers can understand it without having to obta in manuals and spend hours studying them. Your post is a good example of how to do that. I only hope that others who see fit to post J examples here follow your lead.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.