Sure, but the C compiler doesn't write its code for human eyes to read. The programs we write in J are (usually) intended for both computers (i.e. the J interpeter) and people (e.g. ourselves, our code maintainers, people we're bragging to, etc).
-Dan ----- Original Message --------------- Subject: Re: [Jprogramming] Code clarity From: Björn Helgason <gos...@gmail.com> Date: Mon, 13 Jan 2014 18:57:27 +0000 To: Programming forum <programm...@jsoftware.com> 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