Great video. Thank you At around 5:46 it reminded me of some code that Raul recently shared:
http://www.youtube.com/watch?v=zC479khP7BY#t=340 The video has: data_get_station =: 4 : ' (I. (<y) E. 0 {|:x) { x' I thought I'd be clever and use the approach that I saw from Raul to create verbs for each column to select by name: load 'strings' data=: > (<&dltb);._2 each (],&';') each LF cut (0 :0) John ;Smith ;31;Acme Frank;Taylor ;45;Acme Jane ;Doe ;55;Blatz ) colN=:3 : 0 {.y&{"1`'' ) NB. Raul's version http://www.jsoftware.com/pipermail/chat/2014-March/005893.html NB. '`FName LName Age Company'=: colN"0 i.4 NB. My dynamic version cols=: 'FName';'LName';'Age';'Company' ('`',(, > (],&' ') each cols)) =: colN"0 i. $ cols I then thought I would try to create a set of dyadic verbs to do data Company_eq 'Acme' FName_eq 'John' Alas, I tried a few approaches and really didn't understand how Raul's worked in the first place. It had something to do with "If the character list begins with ` then gerund referents are evoked. " - http://www.jsoftware.com/help/dictionary/d001.htm It looks like colN"0 i.2 creates a boxed representation (list of gerunds?) Feeble attempts mostly yielded syntax errors... Here's as close as I got dynamically: m=: 3 : '=y' ('`',(, > (],&'_eq ') each cols)) =: (3 : '{.y&{"1&m` '''' ' )"0 i. 4 Then I tried doing it explicitly: '`Company_eq FName_eq' =: ((= Company) # ])`((= FName) # ]) Which does seem to work: (<'John') FName_eq (<'Acme') Company_eq data +----+-----+--+----+ |John|Smith|31|Acme| +----+-----+--+----+ It would be nice if I could generate the list of _eq verbs from a list of columns. It works with Do. '`Company_eq FName_eq' =: ". '((= Company) # ])`((= FName) # ])' So I can generate a string and evaluate it, but is there a better way than evaluating the string? ('`',(, > (],&'_eq ') each cols)) =: ". }. ,> ('`',[) each ('((= ' , ') # ])' ,~ ]) each cols (<'Smith') LName_eq data +----+-----+--+----+ |John|Smith|31|Acme| +----+-----+--+----+ On Fri, Apr 25, 2014 at 4:51 AM, Martin Saurer <martin.sau...@bluewin.ch>wrote: > Hello all, > > > > There's an new "J in 10 minutes" video: > > J in 10 minutes (2. Desktop Applications) / with narration > > No background sound ;-) > > > > http://youtu.be/zC479khP7BY > > > > Cheers > > > > Martin > > > > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm