Re: [Jprogramming] a cool codeinsert adverb

2014-08-22 Thread 'Pascal Jasmin' via Programming
A one line version of your verb codeinsertJB3 =: 4 : '> (''('' , ] , op , '')'' ,~ [) each/ |. y [ op=.'' '',x,'' ''' The verb version runs faster on your benchmark, even when the tacit adverb is bound, but the adverb can be bound:   'and' codeinsert  NB. returns tacit verb [: > ('(' , ')' ,~

Re: [Jprogramming] a cool codeinsert adverb

2014-08-22 Thread Joe Bogner
sent too soon (sorry for the excess messages)... You could also just do this in JS (no need for reverse and reduceRight)... My first was a sloppy translation from the J pattern ['a','b','c','d','e'].reduce(function(x,y) { return '(' + x + ' and ' + y + ')'}) a and b) and c) and d) and e) I fi

Re: [Jprogramming] a cool codeinsert adverb

2014-08-22 Thread Joe Bogner
As a parallel example in another language, this is how I would do it in javascript: ['a','b','c','d','e'].reverse().reduceRight(function(x,y) { return '(' + x + ' and ' + y + ')'}) a and b) and c) and d) and e) or as a function: var codeinsert = function(f,arr) { return arr.reverse().reduc

Re: [Jprogramming] a cool codeinsert adverb

2014-08-22 Thread Joe Bogner
I like the codeinsert adverb. I didn't understand the solution at first so I thought I'd write my own. I started here at a few attempts at first that didn't use "each". I also quickly realized that I needed to reverse the input Attempt #1 > 4 : '''('',y,'' and '',x,'')''' each/ |. ;: 'a b c d e'

Re: [Jprogramming] Matrix equation

2014-08-22 Thread Papp Erik Tamás
Your solutions of Wx and dX are perfect! Thank you, Erik - Eredeti levél (Original Message) - Feladó: Mike Day Dátum: Szerda, Augusztus 20, 2014 4:42 du Tárgy: Re: [Jprogramming] Matrix equation Címzett: programm...@jsoftware.com > 0. Your J expression for Wx looks wrong to me. > If y