Re: [Jprogramming] Code golf: approximate pi

2013-07-22 Thread Skip Cave
The J code on SO for odd numbers is missing the ">" This is what is posted on SO: c=:*:({&' *'@],&":2%(%+/@,))] (|@j./~2&|#])@i:@<: c 13 |index error: c This is what it should be: c=:*:({&' *'@],&":2%(%+/@,))]>(|@j./~2&|#])@i:@<: Skip On Mon, Jul 22, 2013 at 9:13 PM, Marshall Lochbaum wrote:

Re: [Jprogramming] Code golf: approximate pi

2013-07-22 Thread Dan Bron
Noticed the same thing. I've updated the answer on SO to reflect the shortest standard solution (45 chars), the generalized solution (49 chars), and added a link to this thread. I also note that the 2* in 2*+/ is a bit redundant with the _2 in _2 {.\ : if we applied the +/ to the unfiltered

Re: [Jprogramming] Code golf: approximate pi

2013-07-22 Thread Raul Miller
You could replace *:@# with #*# That's all I can see at the moment. FYI, -- Raul On Mon, Jul 22, 2013 at 10:13 PM, Marshall Lochbaum wrote: > I don't have an SO account, so go ahead and post that. While I'm at it, > I shaved a character off the original by noting that the length of the > circ

Re: [Jprogramming] Code golf: approximate pi

2013-07-22 Thread Marshall Lochbaum
I don't have an SO account, so go ahead and post that. While I'm at it, I shaved a character off the original by noting that the length of the circle is half the diameter for even lengths. This doesn't hold for odd lengths, so it won't help there. c=:({&' *',&":2*+/@,%*:@#)@:>_2{.\|@j./~@i:@<: Ma

Re: [Jprogramming] Code golf: approximate pi

2013-07-22 Thread Dan Bron
Oh! Nice. If you have an account on SO feel free to post it, I'll vote it up past my original. If you don't, I'll replace mine with yours and link to your message on the Forum. -Dan -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoft

Re: [Jprogramming] Code golf: approximate pi

2013-07-22 Thread Marshall Lochbaum
I haven't been able to shorten your code. But here's a version which handles odd numbers, at the cost of only two characters: c=:*:({&' *'@],&":2%(%+/@,))]>(|@j./~2&|#])@i:@<: Rather than filtering by position (_2{.\]), we filter the x values by oddness (2&|#]). Marshall On Mon, Jul 22, 2013 at

[Jprogramming] Code golf: approximate pi

2013-07-22 Thread Dan Bron
There's a code golf challenge on StackOverflow [1] which asks us to generate an approximation of a circle in ASCII (i.e. using integral Cartesian coordinates) and a corresponding estimation of pi. For example, the 8th order circle in ASCII has 15 rows and 8 columns and gives an approximate value o

Re: [Jprogramming] Trains of verbs

2013-07-22 Thread Jose Mario Quintana
http://www.jsoftware.com/pipermail/general/2006-January/026271.html On Mon, Jul 22, 2013 at 7:00 AM, Raul Miller wrote: > If I recall correctly (and a quick search isn't finding me anything, > but we've discussed this previously in this forum), hooks were a > mistake - they were unnecessary cute

[Jprogramming] Rank related questions

2013-07-22 Thread Jose Mario Quintana
III. Definitions ( http://www.jsoftware.com/help/dictionary/dict3.htm ) explains the rank information shown in the vocabulary entries for verbs. Most of the other entries also have what it seems to be the rank information of verbs that they produce. The following are just a few related questions:

Re: [Jprogramming] Trains of verbs

2013-07-22 Thread Raul Miller
If I recall correctly (and a quick search isn't finding me anything, but we've discussed this previously in this forum), hooks were a mistake - they were unnecessary cuteness. But, now that we have them, we can't get rid of them - it would break too many things. That said, here's the dictionary pa

Re: [Jprogramming] Trains of verbs

2013-07-22 Thread Tobia Conforto
Thank you. I had tried to do something similar, but I couldn't come up with a decent ambivalent verb to use. Now for the big question. Even-numbered and odd-numbered dyadic trains behave very differently. Is there a purpose behind this difference? Or is it just a product of the other rules? I