Re: [Jprogramming] Euler Project Problem 1

2014-04-09 Thread Linda Alvord
Here's a look from a mathematics perspective and sets: set=: 13 :'0 = x | y' ]A=:3 set 1+i.35 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 ]B=:5 set 1+i.35 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 A+.B 0 0 1 0 1 1 0 0 1

Re: [Jprogramming] "Segmented Strings"

2014-04-09 Thread Linda Alvord
I would not get rid of your table made of strings. I would access it in the form of J tables because that is what J does nicely. Linda -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of Raul Miller Sent: Wedn

Re: [Jprogramming] Euler Project Problem 1

2014-04-09 Thread Nimp O
Here is my Euler 1 solution for reference. It is concise and I think it's pretty easy to understand. +/I.+./0=3 5 |/ i.1e3 233168 It's the same as: sum(indices(any(zero?(remainder table

Re: [Jprogramming] "Segmented Strings"

2014-04-09 Thread Raul Miller
How? Thanks, -- Raul On Wed, Apr 9, 2014 at 3:44 AM, Linda Alvord wrote: > I would not get rid of your table made of strings. I would access it in > the form of J tables because that is what J does nicely. > > Linda > > -Original Message- > From: [email protected]

[Jprogramming] Two small questions. :D

2014-04-09 Thread Ray Zhao
Hi all, I have two small questions: 1. How do you use variables as such: x y $ 5 I have found many examples with actual nums such as 5 6 $ 6 and I know that x y is a syntax error, but I'm not sure how to make it NOT a syntax error. 2. Can different types, when combined, only produce boxes? This is

Re: [Jprogramming] Two small questions. :D

2014-04-09 Thread Roger Hui
1. (x,y)$5 2. J arrays are homogeneous. So, you can not combine numbers and characters, for example. However, you can convert before combining, e.g. 'The number of seconds ',":secs. And of course you can box first before combining: (<'Seconds: '), wrote: > Hi all, I have two small questions:

Re: [Jprogramming] Two small questions. :D

2014-04-09 Thread robert therriault
Hi Ray 1. You are right that x y $ 5 is a syntax error so you first make x and y into a list using , result is (x,y) $ 5 which should work. 2. You can convert numbers to characters using ": 'number of seconds: ', ": 5 NB. result of ":5 is the character '5' Cheers, bob On Apr 9, 2014,

Re: [Jprogramming] Two small questions. :D

2014-04-09 Thread Raul Miller
You probably want: (x,y)$5 And while boxes do enclose mismatched types, allowing them to be combined without much thought, any function whose results are of a compatible type can be used to combine arguments. For example: 'The number of seconds ',":secs Here's the documentation on ": htt

Re: [Jprogramming] Two small questions. :D

2014-04-09 Thread Raul Miller
P.S. Also note that the >> and << links are "Next" and "Previous" - they lead to adjacent pages. Thanks, -- Raul On Wed, Apr 9, 2014 at 3:21 PM, Raul Miller wrote: > You probably want: > (x,y)$5 > > And while boxes do enclose mismatched types, allowing them to be > combined without much thou

Re: [Jprogramming] Two small questions. :D

2014-04-09 Thread Joe Bogner
On Wed, Apr 9, 2014 at 3:20 PM, robert therriault wrote: > Hi Ray > > 1. You are right that x y $ 5 is a syntax error so you first make x and y > into a list using , result is (x,y) $ 5 which should work. You might be wondering "why!?" A series of numbers is automatically converted to a li

Re: [Jprogramming] Two small questions. :D

2014-04-09 Thread Tracy Harms
If x and y are names for scalars and you wish to use them as a list, then (x,y) is the answer, as several here have already said. In J, however, it's common for nouns to be non-scalar values. Whether they can be simply joined is not something that can be answered in general. What we can say is tha

Re: [Jprogramming] an improvement to apply and perhaps anon evoke

2014-04-09 Thread Jose Mario Quintana
That is right, evoke&6 deals with atomic representations (or equivalent) not necessarily with linear representations, quoting myself: "This is not suitable for the purposes that Pascal has in mind (that is an ideal job for wl (104!:1)); but, apply can return any kind of words." Word from linear (

Re: [Jprogramming] Euler Project Problem 1

2014-04-09 Thread Don Kelly
Nice! I missed the summation part but overall this is much better. Don Kelly On 09/04/2014 5:06 AM, Nimp O wrote: +./0=3 5 |/ i.1e3 -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] "Segmented Strings"

2014-04-09 Thread Linda Alvord
Your example FirstName=:;LF&,each }.0{"1 table is a string creation. Mine ]FN2=: >"0 }.0{"1 table is a table. If you create tables of character dat and tables of the numeric data separately, you could transform the numeric data and then join columns to columns or rows to rows. More dimen

Re: [Jprogramming] "Segmented Strings"

2014-04-09 Thread Raul Miller
Oh, I see how you were thinking. Actually, the code was secondary - it was only meant to illustrate the structure of the data. In "real life", I will not be using that code to create the segmented strings. It'll be more involved. Thanks, -- Raul On Wed, Apr 9, 2014 at 9:43 PM, Linda Alvord w

[Jprogramming] J801 source ?

2014-04-09 Thread ssinfod ssinfod
Hello, I see that J801 executable has been released last february. Is there any plan to release the source of this version on the website or something else ? It would be great to add the J source to a SVN or GIT repository ? Thanks

Re: [Jprogramming] Euler Project Problem 1

2014-04-09 Thread Linda Alvord
Some subtle differences. I.+./0=3 5 |/i.35 0 3 5 6 9 10 12 15 18 20 21 24 25 27 30 33 (1+i.35)#~+./0=3 5 |/1+i.35 3 5 6 9 10 12 15 18 20 21 24 25 27 30 33 35 +/I.+./0=3 5 |/i.35 258 +/(1+i.35)#~+./0=3 5 |/1+ i.35 293 +/I.+./0=3 5 |/ i.100x 2.3e11 +/(1

Re: [Jprogramming] "Segmented Strings"

2014-04-09 Thread Linda Alvord
Can you still extract tables from it rather than strings? Linda -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of Raul Miller Sent: Wednesday, April 09, 2014 9:47 PM To: Programming forum Subject: Re: [Jprogra

Re: [Jprogramming] J801 source ?

2014-04-09 Thread Raul Miller
It's the same source as j701 for the interpreter. The differences are in the *.ijs code distributed with it (and stuff like QtCore4 which comes from the qt project instead of jsoftware). Probably http://www.jsoftware.com/source.htm should be updated to reflect this state of affairs. Thanks, --

Re: [Jprogramming] "Segmented Strings"

2014-04-09 Thread Raul Miller
I do not understand your question. Could you uncompress it a little? Thanks, -- Raul On Wed, Apr 9, 2014 at 11:59 PM, Linda Alvord wrote: > Can you still extract tables from it rather than strings? > > Linda > > -Original Message- > From: [email protected] > [m