View Single Post
Old 02-26-2016, 05:06 PM   #27309
DMcCunney
New York Editor
DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.DMcCunney ought to be getting tired of karma fortunes by now.
 
DMcCunney's Avatar
 
Posts: 6,384
Karma: 16540415
Join Date: Aug 2007
Device: PalmTX, Pocket eDGe, Alcatel Fierce 4, RCA Viking Pro 10, Nexus 7
Quote:
Originally Posted by Katsunami View Post
Shiiit.... I've looked it up, and that language is actually worse than regular expressions.
APL is intended to perform matrix operations. The guy in question writes financial applications, and was writing code to support bond traders at Morgan Stanley at one point. APL is just made for stuff like that.

A nice bit about K is that it dispenses with the special APL character set used to describe the operations it supports. (The old joke in the "Shoot yourself in the foot" classification of programming languages is in APL you shoot yourself in the foot, then spend the next couple of days figuring out how to do it in fewer characters. )

Quote:
I can believe that guy, however. I've more than once seen people trying to do stuff using if-statements for things such as validation, replacement, and such. With some work, it is often faster and even easier to use regular expressions, and with a lot less code as well.
Regular expressions are wild cards on steroids and are extraordinary powerful, but can easily become complex enough the developer ceases to understand them. I've seen at least one app intended to parse and validate REs and help you understand what they are doing and confirm that they are doing what you want.

Quote:
For example, I have an embedded web application, which actually runs on top of PHP. As it has no database, it uses a file called "app.conf.php". The settings are like this:

define("SETTING", "value");

Instead of reading the file line by line into an array of strings, finding the setting, replace the value and then writing back the entire file (which is the way I've seen such things done most often), I just use a command line call to 'sed', and replace the value using a regular expression. (And yes, a take into account that someone could have modified the file, and the setting is now stored as define ("setting" , "VaLuE") )

Thus, I effectively replace (almost) an entire function with one line of code.
Which is what you want, as long as you (and anyone else who has to look at it) understand that one line of code.

Quote:
I can imagine that APL can do the same.
Likely.

For another take that is arguably more powerful than regular expressions, see SNOBOL4 patterns.
______
Dennis

Last edited by DMcCunney; 02-26-2016 at 05:10 PM.
DMcCunney is offline   Reply With Quote