Nice, I like this.
Here's a variant which tells you how many bits are in an integer:
2^.|{.i:_j1
Add 1 if you want to include the sign bit or want the native word
size. Though if you want native word size, or prefer to avoid a
floating point representation, you might perfer
##:|{.i:_j1
Thanks,
--
Raul
On Fri, Jan 24, 2014 at 12:56 PM, Dan Bron <[email protected]> wrote:
> What's the highest value a signed integer can represent on your platform
> (ie. 32 bit or 64 bit)?
>
> |>:{.i:_j1
> 9223372036854775807
>
> 1 + |>:{.i:_j1 NB. Now floating-point
> 9.22337e18
>
> -Dan
>
>
> ----- Original Message ---------------
>
> Subject: Re: [Jchat] [Jprogramming] more fork examples
> From: Devon McCormick <[email protected]>
> Date: Fri, 24 Jan 2014 12:31:53 -0500
> To: Chat forum <[email protected]>
>
> What's 2147483647+1 in Julia?
>
>
> On Fri, Jan 24, 2014 at 10:07 AM, Joe Bogner <[email protected]> wrote:
>
>> My experience with python is that it's difficult to set up an scipy
>> environment on windows. There are packaged solutions, like Anaconda[1]
>> that simplify it greatly, but it's still a 340MB download. I've
>> installed all the packages manually before and dealt with the
>> dependencies. It probably took about an hour of trial and error. My
>> install folder is 800MB
>>
>> It works well once it's up and running. I haven't had it break, but
>> I'm also afraid to update anything. Fortunately, it's a relatively
>> complete environment for what I'm using it for.
>>
>> I would not want to try and push it out to a team.
>>
>> R just works and it's package manager has never let me down. It's easy
>> to update packages and the dependencies are resolved. It's generally
>> fast enough for what I'm doing.
>>
>> I've played with Julia on and off over the past year and it's looking
>> more and more like a useful platform. There wasn't a pre-built 64-bit
>> binary as-of 6 months ago. It was released about 4 months ago. I read
>> this article yesterday that re-invigorated my interest.
>> http://www.evanmiller.org/why-im-betting-on-julia.html As a language
>> geek, it's neat to see what's really happening under the hood. It's
>> array handling is fairly clean
>> (http://docs.julialang.org/en/latest/manual/arrays/)
>>
>>
>> julia> [1 2 3] + 1
>> 1x3 Array{Int32,2}:
>> 2 3 4
>>
>> julia> [1 2 3] + [2 3 4]
>> 1x3 Array{Int32,2}:
>> 3 5 7
>>
>> This made me cringe... Probably a slightly nicer way to do it:
>>
>> julia> map(x->length(x) > 0 ? first(x) : -1, map((y) -> find((x) ->
>> x==y,[1,2,3]
>> ),[1,2,5,1]))
>>
>> 4-element Array{Int32,1}:
>> 1
>> 2
>> -1
>> 1
>>
>> Compared to
>>
>> (1 2 3) i. (1 2 5 1)
>> 0 1 3 0
>>
>> Sidenote: (Julia arrays are 1-based and I substituted -1 instead of
>> length for not found):
>>
>> That being said, it does have coroutines and worker processes,
>> http://docs.julialang.org/en/latest/manual/parallel-computing/
>>
>> [1] - http://continuum.io/downloads
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
>
>
> --
> Devon McCormick, CFA
> ----------------------------------------------------------------------
> 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