Re: [Jprogramming] @: and capped fork

2012-11-30 Thread km
(1) You could also have done isint =: [: (= >.) ] NB. ignores left argument if given isint 2 0.5 1 0 13 isint 2 0.5 1 0 (2) Check out the monad/dyad "core" lab. The following is from the iPad version of J. Hlab NB. Help for labs labs are interactive tutorials manage labs with the

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
Hm, yes, I hadn't realised both cases could be specified implicitly, that's really useful. Another one for the FAQ! On 1 December 2012 04:37, Alex Giannakopoulos wrote: > Great, thanks, hadn't seen that technique before! > > > On 1 December 2012 04:35, km wrote: > >> About your closing question,

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
Great, thanks, hadn't seen that technique before! On 1 December 2012 04:35, km wrote: > About your closing question, you can do > >isint =: (= <.) : [: >isint 2 0.5 > 1 0 >2 isint 3 > |domain error: isint > | 2 isint 3 > > > The definition of isint specifies [: as the dyadic ca

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread km
About your closing question, you can do isint =: (= <.) : [: isint 2 0.5 1 0 2 isint 3 |domain error: isint | 2 isint 3 The definition of isint specifies [: as the dyadic case, and [; rejects every argument with a domain error. Kip Murray Sent from my iPad On Nov 30, 2012, at

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
Incidentally, does Jsoftware have an individual responsible for presentation, marketing, outreach, holy-rolling etc? If, say, I wanted to contribute something, who would coordinate? Or does it all just get (somehow) vetted through the community here? --

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Alex Giannakopoulos
On 30 November 2012 16:17, Bo Jacoby wrote: > J is a rich language, and it might be a good idea to define an elementary > subset for beginners. Couldn't agree more. A simple startup configuration file. Define verbs for trig functions so they don't look stupidly arbitrary. Some other elementary

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread 김창준
Hi Aai, I like the use of ;: inv. ;: b. _1 }:@;@(,&' '&.>"1) :.;: I hadn't thought about its existence. That's pretty handy. Thank you! On Sat, Dec 1, 2012 at 2:31 AM, Aai wrote: > I use this for the database conversion: > > DB=: ({.,<@}:@(;: inv@}.))"1 ;:;. _2 (0 :0) > > 1 CREDO > 11 IN

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread 김창준
Hi. 'key val'=: <"1 |: >({. , ([,' ',])&.>/@:}.)@:(' '&cut) each LF cut 1!:1 wrote: > Hi Aai. Thanks. I did, but still: > >22{. DB > 1 CREDO > 11 IN > 111 UNUM >_18{.DB NB. it is necessary to put a blank character before AMEN. > 321 SÆCULI > AMEN > >$ DB > 1926 > > >'key val'=:

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Bo Jacoby
Hi Devon Thank you for your interest! Ordinal Fractions are easier to understand than to explain. You know that some book editors number the chapters like this: 1 chapter one 1.1 chapter one, section one 1.2 chapter one, section two 1.2.1 chapter one, section two, subsection one and so on.

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Ian Clark
> In other words, I got to J the same way Arthur Rubinstein directed the > tourist to Carnegie Hall. I didn't know this, and had to google it. Here it is, for any other ignoramus on this list ... http://quotationsbook.com/quote/31803/ Apparently, he was approached in the street near the Carnegie

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Ian Clark
> I taught my son elementary APL when he was 10 years old, and he loved it! I remember APL rapidly catching on with IBM salesmen in the 1970s. At Long Last, they were free of the programming dept (and the extended wait for their services). No IBM salesman I ever met had the slightest difficulty le

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Don Guinn
> > > >Floor (and Ceiling (<.)) can be useful for forcing >floating point representations of integers to be >integers in order to save memory (8 vs 4 bytes per value). > > Only for J32. -- For information about J forums

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Ian Clark
Oops, a better link: http://jsoftware.com/help/phrases/hooks.htm On Fri, Nov 30, 2012 at 11:48 PM, Ian Clark wrote: >> If someone asked me to encapsulate "whether values are integers or not", I >> would use >> >> (= <.) 3 3.14 5 > > See 1st entry in: > file:///Applications/j602/help/phrases

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Ian Clark
> If someone asked me to encapsulate "whether values are integers or not", I > would use > > (= <.) 3 3.14 5 See 1st entry in: file:///Applications/j602/help/phrases/hooks.htm IanClark On Fri, Nov 30, 2012 at 11:36 PM, Peter B. Kessler wrote: > And having read that statement about parenth

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Peter B. Kessler
And having read that statement about parentheses, you then come to the bottom of http://www.jsoftware.com/help/jforc/common_mistakes.htm where it says As a stopgap, you can imagine that each name's value is enclosed in parentheses before it is substituted. This still isn't exactly right

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Ian Clark
...resending: (Google rejected because of my tinyurl link...) km says: > Who are your "beginners"? That is indeed the Question To Ask. The whole area was comprehensively researched back in the late 70s by Morton, Hammond, Barnard, Long (et al), at the Medical Research Council Applied Psych

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Raul Miller
Ironically, a good way to improve J documentation would be to write some (perhaps in blog posts?) and then go through a revision process with an audience on that. That said, the best J documentation seems to be "off hand" -- tutorials that focus on some application and cover just enough of J for i

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Devon McCormick
People with prior exposure to traditional programming languages also seem to have trouble with array-based approaches as well though it's a more natural way to think about many kind of problems. On Fri, Nov 30, 2012 at 1:25 PM, km wrote: > Who are your "beginners"? Beginning calculus students

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Devon McCormick
Hi Bo - I looked at the page explaining ordinal fractions but still can't fathom them. The second paragraph reads: 10 means 'the first half, both quarters'. 100 means 'the first half, both quarters, both eighths'. Obviously 1=10=100. You may pad with zeroes to the right. This is like decimal

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread km
Who are your "beginners"? Beginning calculus students are thrown by right to left evaluation because they are used to Texas Instruments calculators' Algebraic Logic System. For them J is not a nice calculator. I gave them rules for how to do arithmetic calculations with J, and showed them onl

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Ian Clark
There is no bug. Try it in quotes. pray '0' pray '00' pray just happens to accept an integer too. But that falls down with leading zeros. On Fri, Nov 30, 2012 at 12:54 AM, Linda Alvord wrote: > J701 with Vista agree on the results for 0 and 00 > > pray 0 > CREDO CONFITEOR ET EXPECTO AMEN

[Jprogramming] topswops

2012-11-30 Thread Aai
One can cheat the Rosetta Code task for topswops by using a much faster solution: topswop=: |.@{.,}. topswopz=: [: ;](] <@,"_ 1 (topswop"0 1 {:))L:0~(1+[:I.(=1+i.@#)@{:)L:0 i,.0, ([: # 0 {:: _2 {[: topswopz^:(0<#)^:a: [: (<@,:@topswop"0 1~}.) >:@i.)"0 }.i=.1+i.10 1 0 2 1 3 2 4 4 5

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Aai
I use this for the database conversion: DB=: ({.,<@}:@(;: inv@}.))"1 ;:;. _2 (0 :0) 1 CREDO 11 IN 111 UNUM 11 DEUM ... 32 VITAM 3211 VENTURI 0 AMEN ) Following June Kim's suggestion about AMEN. _4 {. v ┌──┬─┬───┬┐ │ET│VITAM│VENTURI│AMEN│ └──┴─┴───┴┘ _4 {. k ┌──┬─

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread David Ward Lambert
The DoJ is perhaps the best technical writing I've seen, even having admitted that it was 2 years before I understood how to decipher headings conjunction and adverb headings such as Atopu@v mv lv rv Let's continue the NuVoc project. http://www.jsoftware.com/jwiki/ControlNuVoc Maybe we'll deci

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Bo Jacoby
Hi Aai. Thanks. I did, but still:    22{. DB 1 CREDO 11 IN 111 UNUM    _18{.DB NB. it is necessary to put a blank character before AMEN. 321 SÆCULI  AMEN    $ DB 1926    'key val'=: <"1 |: >({. , ([,' ',])&.>/@:}.)@:(' '&cut) each LF cut DB |domain error |   'key val'=:<"1|:>    ({.,([,' ',])&

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Bo Jacoby
J is a rich language, and it might be a good idea to define an elementary subset for beginners. J is a nice calculator for elementary computations. You can do a lot of computing without knowing anything about binomial coefficients and taylor expansions and capped forks. If you need to understand

Re: [Jprogramming] index of the highest number in a list

2012-11-30 Thread Roger Hui
> Or, generalizing the question, given a list N how can i know the index of the highest element? N i. >./ N , equivalent to (i.>./) N . The latter is special-coded. http://www.jsoftware.com/help/dictionary/special.htm On Fri, Nov 30, 2012 at 4:00 AM, alessandro codenotti wrote: > > Solving Pro

Re: [Jprogramming] @: and capped fork

2012-11-30 Thread Ian Clark
I too have felt the need for Really Prominent Pages (RPPs?) and I've regretfully come to conclude that the only workable solution for the beginner is the forum, as Dan hints. Hence certain issues will turn up over and over again in the threads. Experienced programmers, trying to pick-up J from the

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Aai
Hi Bo, you need to feed the animal, e.g. DB=: 0 :0 1 CREDO 11 IN 111 UNUM ... ) and then: 'key val'=: <"1 |: >({. , ([,' ',])&.>/@:}.)@:(' '&cut) each LF cut DB On 30-11-12 15:03, Bo Jacoby wrote: Hi June. I can't make it work. require 'strings' cut ' '&$: :([: -.&a: <;._2@,~) '

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread Bo Jacoby
Hi June. I can't make it work.    require 'strings'    cut ' '&$: :([: -.&a: <;._2@,~)    'key val'=: <"1 |: >({. , ([,' ',])&.>/@:}.)@:(' '&cut) each LF cut |domain error |   'key val'=:<"1|:>    ({.,([,' ',])&.>/@:}.)@:(' '&cut)each LF cut - Bo > > Fra: June Ki

Re: [Jprogramming] index of the highest number in a list

2012-11-30 Thread Brian Schott
Do you mean verb m1 at the following link? http://jsoftware.com/help/phrases/locate_select.htm On Fri, Nov 30, 2012 at 7:00 AM, alessandro codenotti wrote: > > Solving Project Euler 69 i encountered a problem, with the following J code: > >>./(>:i.10e6)%5 p: >:i.10e6 > > i can easily find out wh

[Jprogramming] index of the highest number in a list

2012-11-30 Thread alessandro codenotti
Solving Project Euler 69 i encountered a problem, with the following J code: >./(>:i.10e6)%5 p: >:i.10e6 i can easily find out which is the maximum value of n/phi(n) for n<10e6, but how can i know what is the value of n? Or, generalizing the question, given a list N how can i know the index of

Re: [Jprogramming] Arc consistency in J

2012-11-30 Thread Linda Alvord
Another problem is cleared up. A=:4 B=:2 6 A,&.>B ┌───┬───┐ │4 2│4 6│ └───┴───┘ NB. x u&.v y ↔ vi (v x) u (v y) (>A),"0(>B) ┌───┬───┐ │4 2│4 6│ └───┴───┘ So, hh and ii replace the two functions h and I below. hh=: [:,[: > ,&.>/ A hh B A hh B 4 2 4 6 ii=: 13

Re: [Jprogramming] Translating BASIC into J

2012-11-30 Thread 김창준
I forgot to mention that cut is from strings. Hence, you should require 'strings' first, before running my other lines. On Wed, Nov 28, 2012 at 2:43 PM, June Kim (김창준) wrote: > Hi Bo, > > Firstly on the database file: > > I suppose there is no blank line in between the lines of the file. > I