Send Programming mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.jsoftware.com/cgi-bin/mailman/listinfo/programming
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Programming digest..."
Today's Topics:
1. Re: Possible to nest multiline noun definition within verb
definition? ( Bj?rn Helgason )
2. RE: Using scriptdoc for user functions? (Miller, Raul D)
3. RE: Using scriptdoc for user functions? (Sherlock, Ric)
4. RE: Using scriptdoc for user functions? (Sherlock, Ric)
5. Interfaces/R/batch (Bill Harris)
6. More on Guides (Bill Harris)
7. RE: More on Guides (Alex Rufon)
----------------------------------------------------------------------
Message: 1
Date: Wed, 14 Feb 2007 21:34:27 +0000
From: " Bj?rn Helgason " <[EMAIL PROTECTED]>
Subject: Re: [Jprogramming] Possible to nest multiline noun definition
within verb definition?
To: "Programming forum" <[email protected]>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset=UTF-8; format=flowed
You can structure it any way you like
GetPrices1=: 4 : 0
sel =. ' cl_lname, cl_title, '
sel =. sel,'pp_year, pp_id, pr_mfd, pr_price'
from =. ' (price_profiles INNER JOIN'
from =. from,' prices ON pp_id = pr_pp) INNER JOIN'
from =. from,'(clients INNER JOIN revs ON cl_id = '
from =. from,'rv_client) ON pp_id = rv_pp'
where =.' cl_id=? AND rv_validuntil Is Null'
orderby =. ' cl_lname, pr_mfd;'
sqlcmd =. ' SELECT ',sel
sqlcmd =. sqlcmd,' FROM ',from
sqlcmd =. sqlcmd,' WHERE ',where
sqlcmd =. sqlcmd,' ORDER BY ',orderby
NB. profiles=. > _3 {."1 }. y query__db sqlcmd
NB. 'pp mfd prc'=: |: data
NB. profiles=. ((_1}.pp~:1|.pp),1) <;.2 profiles
)
SEL =: ' cl_lname, cl_title, '
SEL =: SEL,'pp_year, pp_id, pr_mfd, pr_price'
FROM =: ' (price_profiles INNER JOIN'
FROM =: FROM,' prices ON pp_id = pr_pp) INNER JOIN'
FROM =: FROM,'(clients INNER JOIN revs ON cl_id = '
FROM =: FROM,'rv_client) ON pp_id = rv_pp'
WHERE =: ' cl_id=? AND rv_validuntil Is Null'
ORDERBY =: ' cl_lname, pr_mfd;'
GetPrices2=: 4 : 0
('sel';'from';'where';'orderby') =.x
sqlcmd =. ' SELECT ',sel
sqlcmd =. sqlcmd,' FROM ',from
sqlcmd =. sqlcmd,' WHERE ',where
sqlcmd =. sqlcmd,' ORDER BY ',orderby
NB. profiles=. > _3 {."1 }. y query__db sqlcmd
NB. 'pp mfd prc'=: |: data
NB. profiles=. ((_1}.pp~:1|.pp),1) <;.2 profiles
)
1 GetPrices1 3
SELECT cl_lname, cl_title, pp_year, pp_id, pr_mfd, pr_price FROM
(price...
(SEL;FROM;WHERE;ORDERBY) GetPrices2 3
SELECT cl_lname, cl_title, pp_year, pp_id, pr_mfd, pr_price FROM
(price...
2007/2/14, Sherlock, Ric <[EMAIL PROTECTED]>:
>
> Thanks for the dyad example and yes stored procedures might be a good
> idea but I'm using SQLite via Oleg's package and that doesn't support
> stored procedures. Bjorn, in my second (fuller) post on the subject I
> discounted appending to the line over multiple lines. I don't know about
> you but I find it tedious & messy (and much harder to copy/paste ;-) )
>
> I think the "keep it simple" advice I've had from a number of people is
> probably pretty sound, so will probably go that way for now.
>
> Being quite new to J I'm not really sure how important it is for the
> debugger to handle this sort of case (especially the anonymous), vs
> coming up with a way of allowing nesting. Would this be useful in more
> general cases, or would finding some way to allow nesting, render it a
> non-issue?
> To me, allowing nesting seems simpler and would result in more readable
> code, but I'm sure I'm not aware of all the issues.
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Miller, Raul D
> Sent: Thursday, 15 February 2007 01:39
> To: Programming forum
> Subject: RE: [Jprogramming] Possible to nest
> multilinenoundefinitionwithinverb definition?
>
> Dan Bron wrote:
> > I would warn you away from this pattern if you use or intend to use
> > the J debugging facilities. The dyad within the monad GetPrice is
> > anonymous, and consequently atomic from the J debugger's POV; hence
> > undebuggable.
>
> I consider this a defect in the debugger, and refuse to let it impact my
> code.
>
> Note that this defect also matters for code like:
>
> verba=:3 :0"1
>
> or
>
> verbb=:3 :0&.>
>
> etc.
>
> When I need to use that aspect of the debugger to isolate a problem with
> my code, I'm already in a position where I need to be re-writing my
> code. And the debugger will tell me which specific function is having
> the problem. So, in that case, I first rewrite the function to make the
> debugger happy with it, and then use the debugger to find the flaw, and
> then I fix the problem, test some more, and quite probably rewrite some
> more based on the outcome of my testing.
>
> But you're right that this issue does warrant an occasional warning.
>
> Finally note that for SQL, I prefer using stored procedures over inline
> code. There are times when I can't (mysql doesn't support stored
> procedures), so sometimes I have to make allowences there, too.
>
> --
> Raul
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127
801 Grímsnes ,t-póst: [EMAIL PROTECTED]
Skype: gosiminn, gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming
Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans
góður kennari getur stigið á tær án þess að glansinn fari af skónum
/|_ .-----------------------------------.
,' .\ / | Með léttri lund verður |
,--' _,' | Dagurinn í dag |
/ / | Enn betri en gærdagurinn |
( -. | `-----------------------------------'
| ) | (\_ _/)
(`-. '--.) (='.'=)
`. )----' (")_(")
------------------------------
Message: 2
Date: Wed, 14 Feb 2007 17:22:29 -0500
From: "Miller, Raul D" <[EMAIL PROTECTED]>
Subject: RE: [Jprogramming] Using scriptdoc for user functions?
To: "Programming forum" <[email protected]>
Message-ID:
<
[EMAIL PROTECTED]
>
Content-Type: text/plain; charset="us-ascii"
Sherlock, Ric wrote:
> scriptdoc jpath '~user/projects/myproject/test.ijs'
> |domain error: fmtfile
> | 'script: ' ,partname y
I am not able to reproduce this error.
I tried:
require '~system/extras/util/scripdoc.ijs'
scriptdoc '~user/projects/first/defs.ijs'
scriptdoc jpath '~user/projects/first/defs.ijs'
9!:14''
j601/2006-11-17/17:05
--
Raul
------------------------------
Message: 3
Date: Thu, 15 Feb 2007 12:05:54 +1300
From: "Sherlock, Ric" <[EMAIL PROTECTED]>
Subject: RE: [Jprogramming] Using scriptdoc for user functions?
To: "Programming forum" <[email protected]>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"
9!:14'' gives the same J version as yours.
I have recently updated the base library using the Package Manager to
6.1.21. Could that have a different version of scriptdoc than what was
installed with 6.01?
I just checked the Package Manager again & I see there is a newer
version now available (6.1.22) I will try that.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Miller, Raul D
Sent: Thursday, 15 February 2007 11:22
To: Programming forum
Subject: RE: [Jprogramming] Using scriptdoc for user functions?
Sherlock, Ric wrote:
> scriptdoc jpath '~user/projects/myproject/test.ijs'
> |domain error: fmtfile
> | 'script: ' ,partname y
I am not able to reproduce this error.
I tried:
require '~system/extras/util/scripdoc.ijs'
scriptdoc '~user/projects/first/defs.ijs'
scriptdoc jpath '~user/projects/first/defs.ijs'
9!:14''
j601/2006-11-17/17:05
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
------------------------------
Message: 4
Date: Thu, 15 Feb 2007 13:26:52 +1300
From: "Sherlock, Ric" <[EMAIL PROTECTED]>
Subject: RE: [Jprogramming] Using scriptdoc for user functions?
To: "Programming forum" <[email protected]>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"
* Updated to the latest base library package but still got same error.
* Compared '~system/extras/util/scripdoc.ijs' with the same file from
the j601c_win.exe - they were quite different.
* Replaced '~system/extras/util/scripdoc.ijs' with the same file from
the j601c_win.exe - scriptdoc is able to display my user scripts no
problem!!
Do some scripts in the base library of the Package Manager need to be
updated?
Should I refrain from using Package Manager to update my base library?
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sherlock, Ric
Sent: Thursday, 15 February 2007 12:06
To: Programming forum
Subject: RE: [Jprogramming] Using scriptdoc for user functions?
9!:14'' gives the same J version as yours.
I have recently updated the base library using the Package Manager to
6.1.21. Could that have a different version of scriptdoc than what was
installed with 6.01?
I just checked the Package Manager again & I see there is a newer
version now available (6.1.22) I will try that.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Miller, Raul D
Sent: Thursday, 15 February 2007 11:22
To: Programming forum
Subject: RE: [Jprogramming] Using scriptdoc for user functions?
Sherlock, Ric wrote:
> scriptdoc jpath '~user/projects/myproject/test.ijs'
> |domain error: fmtfile
> | 'script: ' ,partname y
I am not able to reproduce this error.
I tried:
require '~system/extras/util/scripdoc.ijs'
scriptdoc '~user/projects/first/defs.ijs'
scriptdoc jpath '~user/projects/first/defs.ijs'
9!:14''
j601/2006-11-17/17:05
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
------------------------------
Message: 5
Date: Wed, 14 Feb 2007 17:49:32 -0800
From: Bill Harris <[EMAIL PROTECTED]>
Subject: [Jprogramming] Interfaces/R/batch
To: J Programming Forum <[email protected]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying the R batch interface, and it's not working. I have R 2.4.1,
updated just yesterday. I've gotten the public rcmd.ijs and modified
the RBINW line to
RBINW=: 'c:\program files\r\r-2.4.1\bin\r.exe'
I've checked, and I get
,----[ J ijx snippet ]
| RCMD_5_
| c:\program files\r\r-2.4.1\bin\r.exe CMD BATCH --quiet --slave
--vanilla c:\program files\j601\temp\r.in c:/program files/j601/temp/r.out
`----
I loaded rdcmd.ijs and did the '' conew 'prdcmd' as shown on the Wiki.
If I run
Rcmdr 'rnorm(5)'
I see a black terminal window pop up for a second, and then it goes
away. J returns _1.
There is an r.in in c:/Program Files/j601/temp, but that's it.
,----[ r.in ]
| sink("c:/program files/j601/temp/r.res")
| print.eval=TRUE
| rnorm(5)
| sink()
`----
I could run Rserve or at least R using DCOM, but I'm not (yet). Ideas?
BTW, I always have trouble finding the Interfaces page on the Wiki. I
usually end up searching for it. I've now discovered that it's
accessible through Guides from the FrontPage. Would it be reasonable to
expand a bit on what Guides contains on the FrontPage, or am I the only
one who never thinks to look at it, because it looks so small compared
to the other, enumerated categories?
Thanks,
Bill
- --
Bill Harris http://facilitatedsystems.com/weblog/
Facilitated Systems Everett, WA 98208 USA
http://facilitatedsystems.com/ phone: +1 425 337-5541
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: For more information, see http://www.gnupg.org
iD8DBQFF07wx3J3HaQTDvd8RAo8JAKCD/EvHN4kmmRn6FpfWbAK5z7GsRgCdFdra
UbePBA6BvoAR0GIlQBJ2lj0=
=aM2R
-----END PGP SIGNATURE-----
------------------------------
Message: 6
Date: Wed, 14 Feb 2007 18:10:11 -0800
From: Bill Harris <[EMAIL PROTECTED]>
Subject: [Jprogramming] More on Guides
To: J Programming Forum <[email protected]>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
While I'm thinking about the Guides page in the Wiki, I have a
suggestion, if someone has a good script they'd be willing to post.
It seems to me that one of the challenges people face shortly after
getting J is figuring out how to get data into J. If they have it in a
spreadsheet, they may look on the Interfaces page to find the Excel
link.
While Tara, OLE, and the like may work well, there's still a bit of work
to do. For example, the newcomer to J and CSV will have to figure out
how to extract the numeric part, open (unbox) it, and convert it to J
numbers properly. It'd be nice to have such sample scripts under the
CSV section.
More than that, a newcomer might not think of their data as being in
spreadsheet format; it's just a text file with numbers. That may leave
them wondering what to do.
I wonder if the J as Client section of the Interfaces page might benefit
either from making the first line "Excel, other spreadsheets, and plain
text files" or, perhaps better, adding a second line "Text files" that
links to an expanded section on CSV.
I showed someone
http://www.jeremymiles.co.uk/regressionbook/extras/appendix2/R/ today
for R, and steps 4 and 5 make the whole process seem very easy.
Thanks,
Bill
- --
Bill Harris http://facilitatedsystems.com/weblog/
Facilitated Systems Everett, WA 98208 USA
http://facilitatedsystems.com/ phone: +1 425 337-5541
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: For more information, see http://www.gnupg.org
iD8DBQFF08EH3J3HaQTDvd8RAoOQAJ9l64AjAJq7MD1NPbDO64SNF9D6KACfXI/J
RZK2HzXirffhJw/bz4sw03Q=
=7nTl
-----END PGP SIGNATURE-----
------------------------------
Message: 7
Date: Thu, 15 Feb 2007 10:23:42 +0800
From: "Alex Rufon" <[EMAIL PROTECTED]>
Subject: RE: [Jprogramming] More on Guides
To: "Programming forum" <[email protected]>
Message-ID:
<
[EMAIL PROTECTED]>
Content-Type: text/plain; charset="us-ascii"
I started replying to your post by typing up a script that would import
a text file then I realized that what you're saying is bigger than that.
Yes, I agree, a categorized guide on how to import file, however simple
it, is in the WIKI would help. In the example I made for my J C# guide
... I actually had to put in a few converters particularly formatting
date values coming in from text files.
I could contribute some scripts to that guide if its on the WIKI.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bill Harris
Sent: Thursday, February 15, 2007 10:10 AM
To: J Programming Forum
Subject: [Jprogramming] More on Guides
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
While I'm thinking about the Guides page in the Wiki, I have a
suggestion, if someone has a good script they'd be willing to post.
It seems to me that one of the challenges people face shortly after
getting J is figuring out how to get data into J. If they have it in a
spreadsheet, they may look on the Interfaces page to find the Excel
link.
While Tara, OLE, and the like may work well, there's still a bit of work
to do. For example, the newcomer to J and CSV will have to figure out
how to extract the numeric part, open (unbox) it, and convert it to J
numbers properly. It'd be nice to have such sample scripts under the
CSV section.
More than that, a newcomer might not think of their data as being in
spreadsheet format; it's just a text file with numbers. That may leave
them wondering what to do.
I wonder if the J as Client section of the Interfaces page might benefit
either from making the first line "Excel, other spreadsheets, and plain
text files" or, perhaps better, adding a second line "Text files" that
links to an expanded section on CSV.
I showed someone
http://www.jeremymiles.co.uk/regressionbook/extras/appendix2/R/ today
for R, and steps 4 and 5 make the whole process seem very easy.
Thanks,
Bill
- --
Bill Harris http://facilitatedsystems.com/weblog/
Facilitated Systems Everett, WA 98208 USA
http://facilitatedsystems.com/ phone: +1 425 337-5541
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
Comment: For more information, see http://www.gnupg.org
iD8DBQFF08EH3J3HaQTDvd8RAoOQAJ9l64AjAJq7MD1NPbDO64SNF9D6KACfXI/J
RZK2HzXirffhJw/bz4sw03Q=
=7nTl
-----END PGP SIGNATURE-----
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
------------------------------
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
End of Programming Digest, Vol 17, Issue 30
*******************************************