Good point, it's probably there solely for the type cast, allowing later operations to work on integers. On my machine it's ~10% faster:
collatzv=: 3 : '(2|y)} 0 1 + 0.5 3 */y' ts 'cnv 1e6' 2.03499 5.97765e7 ts 'cnv 1e6' 2.04466 5.97765e7 ts 'cnv 1e6' 2.08829 5.97765e7 collatzv=: 3 : '<. (2|y)} 0 1 + 0.5 3 */y' ts 'cnv 1e6' 1.81025 6.03008e7 ts 'cnv 1e6' 1.83654 6.03008e7 ts 'cnv 1e6' 1.87314 6.03008e7 On Mon, Aug 4, 2014 at 3:45 PM, Raul Miller <[email protected]> wrote: > That's an interesting thought. > > As near as I can tell, the only thing it does is convert the result from > floating point representation to integer representation. > > Whether that's good, bad, relevant or irrelevant is ... not something I > know how to decide for the general case. > > Thanks, > > -- > Raul > > > > > On Mon, Aug 4, 2014 at 5:13 PM, Michal D. <[email protected]> > wrote: > > > Is it just me or is the <. in collatzv unnecessary? > > > > (I'm referring to http://jsoftware.com/jwiki/Essays/Collatz%20Conjecture > ) > > > > Cheers, > > > > Mike > > > > > > > > > > On Mon, Aug 4, 2014 at 1:28 PM, Dan Bron <[email protected]> wrote: > > > > > Since material related to J is mostly concentrated on jsoftware.com, > > I've > > > sometimes found it more fruitful to use the J wiki's built-in search > > > engine rather than Google. For example, try typing "Collatz" into the > > > search box at the top-right corner on any J wiki page, and hit "text" > > (not > > > "titles", that's almost always way too restrictive, though in this > > > particular case it would work ok). > > > > > > However, in this case, I actually typed [Collatz site:jsoftware.com] > > into > > > Google (where the []s represent Google's search box, and shouldn't be > > > taken literally as part of the search terms). That usually works well > too > > > (sometimes better than the Wiki's built-in search), but in this case it > > > only worked because I knew what I was looking for, and I knew it > actually > > > existed on the site. Because, when I tried it, while the Essay in > > > question was actually the first result returned, what I actually saw > was: > > > > > > Source - Jsoftware > > > jsoftware.com/jwiki/Essays/Collatz%20ConjectureJ > > > A description for this result is not available because of this site's > > > robots.txt – learn more > > > > > > Where "Source - Jsoftware" would usually be the title of the linked > page, > > > and the only way I knew this result was actually the essay I sought was > > > the URL below that, which included the words "Collatz Conjecture". > > > > > > Someone should probably look into this [1]: SERPs (and, by implication) > > SEO > > > is the internet's analog to one's storefront. Bloomingdales probably > > > wouldn't be doing so well if they blacked out all their window displays > > > and wrote "Macy's" on them. > > > > > > -Dan > > > > > > [1] Starting with http://www.jsoftware.com/robots.txt as Google's > > > complaint > > > suggests) > > > > > > ----- Original Message --------------- > > > > > > Subject: Re: [Jprogramming] Memoizing (Project Euler problem 14) > > > From: mvillarino <[email protected]> > > > Date: Mon, 4 Aug 2014 18:30:58 +0200 > > > To: [email protected] > > > > > > 2014-08-04 14:12 GMT+02:00 Dan Bron <[email protected]>: > > > > If you're OK with spoilers, have you seen Roger's Collatz Conjecture > > > essay > > > > on the Wiki? > > > > > > > > http://jsoftware.com/jwiki/Essays/Collatz%20Conjecture > > > > > > > > > > ? I googled for information on a J spoiler... but no, I haven't found > it. > > > Thanks a lot !!! > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
