SciComp SLV Calibrator

Forum Navigation:

magazine

FORUMS > Programming and Software Forum < refresh >
Topic Title: APL, J, and K
Created On Tue Oct 30, 07 05:33 AM
Topic View:

View thread in raw text format


Corey
Member

Posts: 35
Joined: Mar 2007

Tue Oct 30, 07 05:33 AM
User is offline

From what I have read, APL used to be fairly common among financial engineers when the industry was first budding, but I haven't heard anything about them recently. I did have a friend apply to a financial software development firm in New York whose application page had trivia questions based in K, but I can't remember who it was.

I was thinking about learning J, as it seems like an excellent way to expand my mind to a higher level of thinking as a programmer -- but it is difficult to find the motivation without any real practical use.

I was wondering if any of you fellows happened to know, and more importantly, use, any of these languages.

If I had to dedicate more time learning either J or Erlang, which would you recommend? I already have a strong fundamental understanding of functional programming through SML, so the functional aspect of Erlang won't exactly add a new paradigm to my tool box -- and I have experience with distributed systems in other languages -- so I wonder if Erlang will just be an effective tool ... or a mind opening experience?

Thanks for reading my ramblings ...
 
Reply
   
Quote
   
Top
   
Bottom
     



rwinston
Member

Posts: 52
Joined: Feb 2007

Wed Oct 31, 07 11:18 AM
User is offline

I dont know anything about J, but I have looked a little bit at Erlang, and from a practical viewpoint, that is the better option. It depends on what your objectives are though - if it is for a "mind opening experience", then I would probably recommend Haskell - at least, that's how it has been for me.
 
Reply
   
Quote
   
Top
   
Bottom
     



eredhuin
Senior Member

Posts: 262
Joined: Jul 2002

Wed Oct 31, 07 01:56 PM
User is offline

Some actuaries still use APL these days. It's a niche language, like COBOL, relegated to legacy apps. Never heard of J or K until you mentioned them.

I've been programming 20+ years. Beware language flame wars; they are boring and pointless. A guy who passionately denigrates X in favor of Y is a guy who only has a hammer in his toolbox.

If you're already a good programmer, it never hurts to practise learning a few new languages. Syntax is a minor element of learning a new language (make a cheat sheet); it's idioms you need to (un)learn. Lots of people aren't thrilled with the cruft left behind from C-based languages, the grandfather of the major languages today.

Hence the focus on alternate languages (of which there are dozens, if not scores). It's great to learn different languages so you can know the right tool for the right job. I'm very happy quanting with C++ but if I want to do a quick set of regular expression pattern substitutions, I do NOT load up Boost. I happily use PERL for that. Interactive scripting languages are my main use of non-C++ code, and I use them a lot. If I'm doing interactive maths, Matlab/Octave is great for graphics and interactive vector arithmetic, R is great for interactive stats work, and VBA is great for light duty spreadsheet subroutines.

Edited: Wed Oct 31, 07 at 01:57 PM by eredhuin
 
Reply
   
Quote
   
Top
   
Bottom
     



abginfl
Member

Posts: 38
Joined: Feb 2005

Wed Oct 31, 07 02:44 PM
User is offline

For a interesting commentary on APL, I recommend that you read a couple of sections out of Richard Bookstaber's "A Demon of Our Own Design: Markets, Hedge Funds, and the Perils of Financial Innovation". The section entitled the "The APL Cult" would probably interest you.
 
Reply
   
Quote
   
Top
   
Bottom
     



Cuchulainn
Senior Member

Posts: 37631
Joined: Jul 2004

Wed Oct 31, 07 03:59 PM
User is offline



Edit: what is this?

-------------------------
www.datasimfinancial.com

Edited: Wed Oct 31, 07 at 04:03 PM by Cuchulainn
 
Reply
   
Quote
   
Top
   
Bottom
     



Traden4Alpha
Senior Member

Posts: 16919
Joined: Sep 2002

Wed Oct 31, 07 04:35 PM
User is offline

Quote

Originally posted by: Cuchulainn


Edit: what is this?
My APL has 20 years of rust, but it looks John Conway's Life cellular automata.

Yes, APL can be what some wags call a write-only language. On the other hand, I find that comprehending the densely nested loops and chains of function calls used by other languages to have their own problems with off-by one errors, stopping-condition logic faults, and rat-hole problems. APL is nice for a certain class of numerical processing problems because, like a Matlab-on-steriods, it internalizes all the administrative hassles of arrays to allow operators on multidimensional arrays.

Although I can't imagine APL making a comeback, I do wonder if some APL-like features won't be a key element of a multi-core-friendly next-generation language.


-------------------------
"It often happens that a player carries out a deep and complicated calculation, but fails to spot something elementary right at the first move." -- grandmaster Alexander Kotov --inscribed on gift chess sets given by Amaranth hedge fund.
 
Reply
   
Quote
   
Top
   
Bottom
     



Cuchulainn
Senior Member

Posts: 37631
Joined: Jul 2004

Wed Oct 31, 07 05:49 PM
User is offline

Quote

Originally posted by: Traden4Alpha
Quote

Originally posted by: Cuchulainn


Edit: what is this?
My APL has 20 years of rust, but it looks John Conway's Life cellular automata.

Yes, APL can be what some wags call a write-only language. On the other hand, I find that comprehending the densely nested loops and chains of function calls used by other languages to have their own problems with off-by one errors, stopping-condition logic faults, and rat-hole problems. APL is nice for a certain class of numerical processing problems because, like a Matlab-on-steriods, it internalizes all the administrative hassles of arrays to allow operators on multidimensional arrays.

Although I can't imagine APL making a comeback, I do wonder if some APL-like features won't be a key element of a multi-core-friendly next-generation language.


Do you mean some kind of operator overloading that encapsulates nasty stuff?


-------------------------
www.datasimfinancial.com
 
Reply
   
Quote
   
Top
   
Bottom
     



Traden4Alpha
Senior Member

Posts: 16919
Joined: Sep 2002

Wed Oct 31, 07 06:22 PM
User is offline

Quote

Originally posted by: Cuchulainn
Quote

Originally posted by: Traden4Alpha
Quote

Originally posted by: Cuchulainn


Edit: what is this?
My APL has 20 years of rust, but it looks John Conway's Life cellular automata.

Yes, APL can be what some wags call a write-only language. On the other hand, I find that comprehending the densely nested loops and chains of function calls used by other languages to have their own problems with off-by one errors, stopping-condition logic faults, and rat-hole problems. APL is nice for a certain class of numerical processing problems because, like a Matlab-on-steriods, it internalizes all the administrative hassles of arrays to allow operators on multidimensional arrays.

Although I can't imagine APL making a comeback, I do wonder if some APL-like features won't be a key element of a multi-core-friendly next-generation language.
Do you mean some kind of operator overloading that encapsulates nasty stuff?
Yes, but it is a specialized type of overloading that automatically handles arrays of different shapes and dimensionalities. If A is 5x1 and B is 1x6 and C is 1x1x4, then f(A,B) is 5x6 and g(f(A,B),c) is 5x6x4 for most APL operators. The inputs of any function might be 2-D or 10-D and APL's "overloading" handles its. APL also sports a nice set of array restructuring operators that allow one to rotate elements along any array dimension, transpose N-D arrays, etc.

Most languages barf if one says X+Y where X is a 1x1x1x5 array and Y is a 1x2x3 array. How does C++ or Java handle N-dimensional arrays if N is not known until runtime? What must a programmer do to make C++ or Fortran handle n-D arrays of arbitrary dimensionalities across both built-in and user-defined functions? I'm sure one can get/create libraries for this, but they aren't innate to the language or in standard usage.

-------------------------
"It often happens that a player carries out a deep and complicated calculation, but fails to spot something elementary right at the first move." -- grandmaster Alexander Kotov --inscribed on gift chess sets given by Amaranth hedge fund.
 
Reply
   
Quote
   
Top
   
Bottom
     



abginfl
Member

Posts: 38
Joined: Feb 2005

Thu Nov 01, 07 12:57 AM
User is offline

Quote

Originally posted by: Traden4Alpha
Quote

Originally posted by: Cuchulainn
Quote

Originally posted by: Traden4Alpha
Quote

Originally posted by: Cuchulainn


Edit: what is this?
My APL has 20 years of rust, but it looks John Conway's Life cellular automata.

Yes, APL can be what some wags call a write-only language. On the other hand, I find that comprehending the densely nested loops and chains of function calls used by other languages to have their own problems with off-by one errors, stopping-condition logic faults, and rat-hole problems. APL is nice for a certain class of numerical processing problems because, like a Matlab-on-steriods, it internalizes all the administrative hassles of arrays to allow operators on multidimensional arrays.

Although I can't imagine APL making a comeback, I do wonder if some APL-like features won't be a key element of a multi-core-friendly next-generation language.
Do you mean some kind of operator overloading that encapsulates nasty stuff?
Yes, but it is a specialized type of overloading that automatically handles arrays of different shapes and dimensionalities. If A is 5x1 and B is 1x6 and C is 1x1x4, then f(A,B) is 5x6 and g(f(A,B),c) is 5x6x4 for most APL operators. The inputs of any function might be 2-D or 10-D and APL's "overloading" handles its. APL also sports a nice set of array restructuring operators that allow one to rotate elements along any array dimension, transpose N-D arrays, etc.

Most languages barf if one says X+Y where X is a 1x1x1x5 array and Y is a 1x2x3 array. How does C++ or Java handle N-dimensional arrays if N is not known until runtime? What must a programmer do to make C++ or Fortran handle n-D arrays of arbitrary dimensionalities across both built-in and user-defined functions? I'm sure one can get/create libraries for this, but they aren't innate to the language or in standard usage.


I believe a bit of this N-dimensional array functionality (where dimensions may be mismatched and the operations still perform as one desires) is covered by the broadcasting rules in NumPy for Python (which itself is written in C). With Python/NumPy/Scipy being an interpreted language, like APL was/is and MATLAB or R are today, one does pay the performance penalty for that type of execution model. But there are definitely language extensions in the pipeline (Star-P, DCT/DCE, various MPI-like extensions, etc.) that provide the user-friendly access to multicore environments. The "vectorized" nature of operations in these languages will definitely have some similiarities to the spirit of APL's conciseness, but I am sure the lessons of APL's cryptic/non-user-friendly nature have been learned and will not be repeated.
 
Reply
   
Quote
   
Top
   
Bottom
     



distributed
Member

Posts: 33
Joined: May 2005

Thu Nov 01, 07 05:52 PM
User is offline

k or in its most recent form q is used in many of the largest banks. It is usually the database kdb or kdb+ that drives its adoption. j, k and q are all APL derivatives as is A+ which Morgan Stanley have been trying to get rid of for the last 10 years (still unsuccessfully I might add).
The reason for the adoption is usually the speed at which the in memory database handles time series meaning that any variation on VWAP is a trivial 1 liner. Ticker plants run in k are faster than anything else I have seen. One particular firm has their entire trading platform written in k and I'm pretty sure its the one referred to by corey in the originating post on this thread. If you are in need of a job and you have k experience you wont be in need of a job for very long... (if you are in this position pm me)
I have yet to see anything in the financial sector written in J. APL still has a lot of users, but I think with the exception of maybe Goldman, nearly everyone else has some k in their firm.
some trivia, the entire k and kdb platform is written in 14 pages of very terse concise pages of C.
Arthur Whitney>genius...
 
Reply
   
Quote
   
Top
   
Bottom
     



dirtydroog
Senior Member

Posts: 367
Joined: Jul 2007

Thu Nov 01, 07 06:18 PM
User is offline

Quote

Originally posted by: Cuchulainn


Edit: what is this?


It's incomprehensible rubbish, about as useful as http://compsoc.dur.ac.uk/whitespace/ !

-------------------------
Mockery! FFS
 
Reply
   
Quote
   
Top
   
Bottom
     



msperlin
Senior Member

Posts: 608
Joined: Jul 2006

Thu Nov 01, 07 06:28 PM
User is offline View users profile

Quote

http://compsoc.dur.ac.uk/whitespace/


That's the funniest thing I've seen today.
An example of code:








Some people have way too many spare time on their hands..


-------------------------
My personal site with Matlab Code and research papers here
 
Reply
   
Quote
   
Top
   
Bottom
     



Cuchulainn
Senior Member

Posts: 37631
Joined: Jul 2004

Thu Nov 01, 07 06:59 PM
User is offline

Quote

Originally posted by: msperlin
Quote

http://compsoc.dur.ac.uk/whitespace/


deprecated





Unfortunately, you are using an old versions. Please read this. Hope this helps.

here


-------------------------
www.datasimfinancial.com

Edited: Thu Nov 01, 07 at 07:01 PM by Cuchulainn
 
Reply
   
Quote
   
Top
   
Bottom
     



msperlin
Senior Member

Posts: 608
Joined: Jul 2006

Thu Nov 01, 07 07:13 PM
User is offline View users profile

Quote


Unfortunately, you are using an old versions. Please read this. Hope this helps.

here



I don't get it.

They are very different things. One thing is to use whitespace (or any other symbol) as an operator and another thing is to build an entire language base only on whitespace characters. The first is definitely an advance while the second is just wast of time.

-------------------------
My personal site with Matlab Code and research papers here
 
Reply
   
Quote
   
Top
   
Bottom
     



Cuchulainn
Senior Member

Posts: 37631
Joined: Jul 2004

Fri Nov 02, 07 08:28 AM
User is offline

Quote

Originally posted by: msperlin
Quote

http://compsoc.dur.ac.uk/whitespace/




This code is also not very readable and it is difficult to maintain.

-------------------------
www.datasimfinancial.com
 
Reply
   
Quote
   
Top
   
Bottom
     



Corey
Member

Posts: 35
Joined: Mar 2007

Fri Nov 02, 07 05:56 PM
User is offline

Thanks for all the info guys. I think I am going to try to pick up some K -- see if it totally messes with my mind. Erlang seems more pragmatic ... but you can't deny the awesomeness of loopless code. Erlang doesn't bring much new to the table for me ... but K just seems absurd.
 
Reply
   
Quote
   
Top
   
Bottom
     



dirtydroog
Senior Member

Posts: 367
Joined: Jul 2007

Fri Nov 02, 07 06:36 PM
User is offline

Quote

Originally posted by: Corey
Thanks for all the info guys. I think I am going to try to pick up some K -- see if it totally messes with my mind. Erlang seems more pragmatic ... but you can't deny the awesomeness of loopless code. Erlang doesn't bring much new to the table for me ... but K just seems absurd.


Just because you don't have to write the loops doesn't mean they don't happen.
Anyway... enjoy!

-------------------------
Mockery! FFS
 
Reply
   
Quote
   
Top
   
Bottom
     



Corey
Member

Posts: 35
Joined: Mar 2007

Fri Nov 02, 07 09:17 PM
User is offline

Well, having studied a bit of J I understand the concepts of verbs, nouns, and ranks -- and how they all mix. I don't mean to imply that I don't think that the loops don't actually happen -- but being able to define how I want the function to apply over a data set is a very cool concept, in my opinion.
 
Reply
   
Quote
   
Top
   
Bottom
     



falcon
Member

Posts: 22
Joined: Feb 2004

Fri Nov 09, 07 06:23 PM
User is offline

Erlang is great for concurrent programming. If you are building an OMS or an Algo engine, Erlang will let you easily make use of all the processors on your machine, distribute your application among any number of machines, provide a built-in 'database' which will scale to a cluster of any size. The Scala language also provides some of the functionality of Erlang (very cheap 'threads'), it runs on the JVM, it is statically typed (unlike Erlang), doesn't provide that built-in 'database.'

If you want to experiment with different option pricing algorithms, A/J/K/Q will let you express your ideas more succinctly.

As someone already suggested, Haskell is a great language to learn as well. Parts of it are so simple and beautiful that you will start to get annoyed by Java/C++/C...yet parts of it are very difficult to understand. Haskell currently seems to be the language of choice for language theory researchers. It will soon have very cheap threads (I believe cheaper than Erlang...there are other differences), it has database like transactions for shared memory variables, it has lazy evaluation (things that don't need to be computed don't get computed), functions are pure (which means you can't just add random number without significant changes to your code), is being used more and more in the finance industry (google "haskell financial contracts" for an incredibly interesting paper).
 
Reply
   
Quote
   
Top
   
Bottom
     



Alii
Member

Posts: 38
Joined: Jul 2006

Thu Dec 06, 07 04:37 PM
User is offline

I like to use J for initial prototyping and for ad hoc models of non-standard contracts. It's fast, concise (in the extreme!) and stretches my mind. But really I use it as an alternative to Excel rather than (say) to C++. I would not, for example, consider writing a GUI in it ... 'though people do.

Because its programs are so succinct and therefore quick to tap out again and again with small modifications, J lends itself to a very iterative style of programming. And its array-centrism is valuable. As well as allowing it to perform most types of computation far more speedily than is decent for an interpreted language, it encourages a different sort of mindset that might well lead to better coding in other languages. Indeed it was through using J that I was inspired to rewrite much of our C++ code using arrays - and that resulted in a major speedup.

Edit: is it actually possible to get your hands on K without signing up to their evaluation scheme? Pointers anyone?

Edited: Thu Dec 06, 07 at 04:50 PM by Alii
 
Reply
   
Quote
   
Top
   
Bottom
     

View thread in raw text format
FORUMS > Programming and Software Forum < refresh >

Forum Navigation:

© All material, including contents and design, copyright Wilmott Electronic Media Limited - FuseTalk 4.01 © 1999-2014 FuseTalk Inc. Terms & Conditions