Re: [Jprogramming] more fork examples

2014-01-15 Thread Roger Hui
Dyalog APL will have forks in the next version, an occasion which led me to make up a list of evocative forks ("trainspotting"). Some selections from this list, transcribed back into J from APL: >./ - <./range +,-,*,%“function vector” _10&< *. <&10 open inter

Re: [Jprogramming] more fork examples

2014-01-15 Thread Roger Hui
http://keiapl.org/anec/#nvv sin=: 1 o. ] cos=: 2 o. ] (^@j. = cos + 0j1 * sin) 1 2 3 0.1j_0.2 1 1 1 1 (^@j. = cos j. sin) 1 2 3 0.1j_0.2 1 1 1 1 The insight that led to the invention of the j. function illustrates what separate genius from mere mortals. Who would think of inventing

Re: [Jprogramming] Code clarity

2014-01-15 Thread bill lam
What did you mean for "n't work"? And what did you intend to do? the hook expands as, ([ sminfo) y <-> y [ sminfo y so that it should return the value of y (untested) Ср, 15 янв 2014, Don Kelly писал(а): > I tried this - it didn't work- but if I do sminfo a=: x foo y > it works. > On 15/01

[Jprogramming] more fork examples

2014-01-15 Thread Raul Miller
I think we some simple, evocative fork examples which are not mean. One possibility is fahrenheit to centigrade conversion: (5r9 * -&32) Another might be area of a circle with the given radius: (2 * o.) What might some others be? Perhaps a dyadic use of fork could be both simple to expre

Re: [Jprogramming] Code clarity

2014-01-15 Thread Don Kelly
I tried this - it didn't work- but if I do sminfo a=: x foo y it works. On 15/01/2014 6:51 PM, bill lam wrote: sminfo is a cover verb, it will display in a popup box or just on the session pane depending on you are running on gui or jconsole. If you want to preserve the "result" try using the ho

Re: [Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Don Kelly
Often the one-liners are impressive but there is a problem in that sometimes they become incomprehensible-needing several lines of comment to explain. However APL (and J) does provide for explicit programs which can call on other programs as subroutines (i.e verbs that are not primiitve(witness,

Re: [Jprogramming] Code clarity

2014-01-15 Thread bill lam
sminfo is a cover verb, it will display in a popup box or just on the session pane depending on you are running on gui or jconsole. If you want to preserve the "result" try using the hook ([ sminfo) Ср, 15 янв 2014, Don Kelly писал(а): > This looks great -in that the listings do describe things fa

Re: [Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Joe Bogner
Thanks for all the links and ideas. Lots to digest, which is what I wanted. Raul - I found APL\360 an Interactive Approach online and a list of other good resources here: http://www.softwarepreservation.org/projects/apl/Physics%20in%20APL2 I will check it out. Kenneth - I haven't seen that list,

Re: [Jprogramming] Code clarity

2014-01-15 Thread Don Kelly
This looks great -in that the listings do describe things fairly well as most are simple and useful. However in some cases things are still unclear. an example is sminfo It appears that it simply shows a result in a separate box but unless one uses sminfo a=: foo y , vs sminfo foo y , the

Re: [Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Kenneth Lettow
Hi Joe, Have you seen https://sites.google.com/site/baavector/ ? It may not be exactly what you are looking for, but the site is loaded with great articles on all array languages. I received a nice surprise when I visited a few minutes ago, from the archives - Special Feature: J by Kenneth E. Iv

Re: [Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Roger Hui
One aspect: J/APL programmers tend to stay in the nice world of expressions and avoid the nastier world of statements. This tendency pushes you towards array thinking and away from scalar thinking. For example, if b is a boolean array, and you want 4 where b is 0 and 17 where b is 1, write: (4*

Re: [Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Henry Rich
To think like a J programmer, write code to solve your problems using J without loops. It's not so much that loops are evil, as that they encourage scalar thinking. If you are forced to find J primitives to express your ideas, you will eventually stop thinking about integers and start thinkin

Re: [Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Raul Miller
A classic work is APL: An Interactive Approach by Leonard Gilman and Allen J. Rose. I've seen it for sale for as low as $3 recently, but it looks like computer bidding is driving the price up right now. And, of course, anything written by Ken Iverson is good - especially if you take the time to tr

[Jprogramming] Applied APL - How to think like an APL programmer?

2014-01-15 Thread Joe Bogner
I went googling for some deeper material on how to think like an APL programmer. I have read/skimmed through a good set of the material on http://jsoftware.com/papers/ and have skimmed through many of the books listed on http://www.jsoftware.com/jwiki/Books. Are there any specific recommendations,

Re: [Jprogramming] Code clarity

2014-01-15 Thread Don Kelly
That would be wonderful!!! Don Kelly On 14/01/2014 6:50 PM, Pascal Jasmin wrote: actually a documentation effort on the z profile names would be quite helpful. From: Don Guinn To: Programming forum Sent: Tuesday, January 14, 2014 4:15:08 PM Subject: Re: [Jpro

Re: [Jprogramming] Code clarity

2014-01-15 Thread Ian Clark
@jasmine - it's hard to know how to do better than edit 'stdlib' or for a particular verb: edit 'splitstring' because the scripts are well-commented. And they have the vast advantage of keeping themselves up-to-date -- a bg problem with jwiki. The contents of _z_ are documented here

Re: [Jprogramming] maybe a bug in short circuiting. Help with a guard structure

2014-01-15 Thread Pascal Jasmin
thank you Raul.  I thought the x parameter was not necessary. - Original Message - From: Raul Miller To: Programming forum Cc: Sent: Wednesday, January 15, 2014 12:29:54 PM Subject: Re: [Jprogramming] maybe a bug in short circuiting. Help with a guard structure   3 +^:1: 2 5

Re: [Jprogramming] maybe a bug in short circuiting. Help with a guard structure

2014-01-15 Thread Raul Miller
3 +^:1: 2 5 Looking at your definition for guard: guard =: 2 : 0 : (u@:[)^: (v y) 1 ) This will give you a conjunction which will define a dyadic verb, but that dyadic verb will ignore its left argument. I assume you meant to say guard =: 2 : 0 : x (u@:[)^: (v y) 1 ) Thanks, -- Raul O

Re: [Jprogramming] maybe a bug in short circuiting. Help with a guard structure

2014-01-15 Thread Pascal Jasmin
I see the problem with guard now.  Its related to dyadic ^: having a weird static optimization by doing (x&u) so even though guard asks for (u@:[) it passes the 1 at the far end of guard.   Basically the u side of ^: is always monadic, though it might be buggy:    (2 = +/) 2 1    2 (2 = +/) guar

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Thomas Costigliola
GCC 4.8 results posted to source forum: http://www.jsoftware.com/pipermail/source/2014-January/000527.html On Wed, Jan 15, 2014 at 8:49 AM, Thomas Costigliola wrote: > Also, I'm pretty sure I tried with all optimizations turned off. > > > On Wed, Jan 15, 2014 at 8:45 AM, Thomas Costigliola wrot

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Thomas Costigliola
Also, I'm pretty sure I tried with all optimizations turned off. On Wed, Jan 15, 2014 at 8:45 AM, Thomas Costigliola wrote: > Off the top of my head g000i.ijs is one. There are others, when I get some > time I will retry with your suggestion and post the results. > > > On Wed, Jan 15, 2014 at 8:

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Thomas Costigliola
Off the top of my head g000i.ijs is one. There are others, when I get some time I will retry with your suggestion and post the results. On Wed, Jan 15, 2014 at 8:19 AM, bill lam wrote: > I didn't test. Which tests failed with gcc 4.8? I guess it is the loop > vectorize optimization that may bre

Re: [Jprogramming] maybe a bug in short circuiting. Help with a guard structure

2014-01-15 Thread Brian Schott
I am not sure I can answer your question about guard, but I was able to get trace to work (after I loaded the exact filename) by appending "__" to the names as shown below. Maybe the trace will shed some light for you. I have to go out for a while now. load jpath '~addons/general/misc/trace.ijs'

Re: [Jprogramming] maybe a bug in short circuiting. Help with a guard structure

2014-01-15 Thread Raul Miller
Could you clarify this statement "I'm still interested in the guard conjunction that I don't understand why it doesn't work"? I am not sure what you mean by "why it doesn't work". But let's say that y was 1 2 3 and that sideff y was 14. In that case, these would be equivalent statements: if. -.

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread bill lam
I didn't test. Which tests failed with gcc 4.8? I guess it is the loop vectorize optimization that may break ar.c, you may try disable it with a CFLAG switch. 15.01.2014, в 20:38, Thomas Costigliola написал(а): > Hi Bill, did you run the test suite after compiling? I have been having > proble

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Thomas Costigliola
Hi Bill, did you run the test suite after compiling? I have been having problems with gcc 4.8. I haven't been able to get a passing libj, I have tried a few distros' gcc with different optimizations. It seems to always be overoptimizing some things. Gcc 4.7 doesn't have the issue. On Jan 14, 2014

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Ben Gorte - CITG
Hi Bob! 208s on my phone (LG-P970, Android 4.0.4) :-) How about your iPhone? Regards, Ben From: programming-boun...@forums.jsoftware.com [programming-boun...@forums.jsoftware.com] on behalf of Rob Hodgkinson [rhodg...@me.com] Sent: Wednesday, January 15

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Rob Hodgkinson
FYI - 8s on my MacBookPro 13" Regards Rob Sent from my iPhone > On 15 Jan 2014, at 7:12 pm, Ben Gorte - CITG wrote: > > Thanks, this is great. After recompiling libj with -O3 my computer does Fibo > 100 in 13.6s instead of 41.3. Also Haralick became a bit quicker, 75s now. > > But shoul

Re: [Jprogramming] On benchmarking results from J programming styles

2014-01-15 Thread Ben Gorte - CITG
Thanks, this is great. After recompiling libj with -O3 my computer does Fibo 100 in 13.6s instead of 41.3. Also Haralick became a bit quicker, 75s now. But shouldn't it be like this in the binary downloads as well? Regards, Ben From: programming-boun