I often write something clear and commented. Then try to make it look smart -sort of looking compiled - and stop understanding it.
Ok .... maybe not often... On 13 Jan 2014 19:31, "km" <k...@math.uh.edu> wrote: > An important consideration is, "clarity for who"? I want the code to be > clear to me when I come back to it later. For that reason I usually code > explicitly, calling explicit helper verbs, although many of the lines are > "tacit in spirit". Suggestive names help. > > --Kip Murray > > Sent from my iPad > > > On Jan 13, 2014, at 12:57 PM, Björn Helgason <gos...@gmail.com> wrote: > > > > If you try to read compiled executable code from C it would not be very > > readable. > >> On 13.1.2014 18:45, "Dan Bron" <j...@bron.us> wrote: > >> > >> We often say the APL family of languages allow us to use language as a > tool > >> of thought. How does this play out in practice? Do we approach > reading J > >> programs differently from those written in other languages? If so, how? > >> > >> These questions occurred to me today while I was knocking together an > >> implementation of a RosettaCode task on reading configuration files. > The > >> task is to parse file formatted like the following: > >> > >> # This is the fullname parameter > >> FULLNAME Foo Barber > >> > >> # This is a favourite fruit > >> FAVOURITEFRUIT banana > >> > >> # This is a boolean that should be set > >> NEEDSPEELING > >> > >> # This boolean is commented out > >> ; SEEDSREMOVED > >> > >> Fuller example at [1]. After reading the intro, I copy/pasted the > example > >> into a J noun and proceeded to write this: > >> > >> deb L:0@:(({.~ ; [: < [: ;^:(1=#) ',' cut (}.~>:)) i.&1@:e.&' > >> =')&>@(#~ > >> a:&~: > ';#'e.~{.&>)@:(dlb&.>)@:(LF&cut) > >> > >> Which is a verb which takes the configuration text as input and > produces a > >> table of name-value pairs as output. My first thought was "wow, I was > able > >> to knock that together in literally less than a minute, through simple > >> incremental iterations in the REPL: J is AWESOME". > >> > >> But then, thinking about posting it, I realized "this is awful, no one's > >> going to be able to read it like this, and it's going to take more work > to > >> make it readable than it took to make it actually work". > >> > >> So that got me thinking about what exactly we mean by J as a notation. > And > >> I wondered: how could we use the language to express our thoughts more > >> clearly, and how does that differ from how we write J when we just want > to > >> get something done? And is this a different or more difficult problem > for > >> J than other languages? > >> > >> So, how would you write an configuration file parser in J, if clarity > were > >> an important concern? I'm interested in not only the actual program, > but > >> the reasoning behind the decisions you make. > >> > >> -Dan > >> > >> [1] RosettaCode task to read a configuration file: > >> http://rosettacode.org/wiki/Read_a_configuration_file > >> > >> > >> ---------------------------------------------------------------------- > >> For information about J forums see http://www.jsoftware.com/forums.htm > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm