Jared,

You might be interested in what I consider the most useful Julia function 
that's not actually in 
Base: 
http://stackoverflow.com/questions/29661315/vectorized-in-function-in-julia 
 

vectorin(2, s)

0-dimensional Array{Bool,0}:
true


vectorin(s, 2)

3-element Array{Bool,1}:
  true
 false
 false

although perhaps I'm misunderstanding what you want to do here.  -A

On Monday, August 29, 2016 at 12:59:32 PM UTC-7, Jared Crean wrote:
>
> Here is an oddity:
>
> julia> s
> Set([2,3,1])
>
> julia> in(s, 2)
> false
>
> julia> in(2, s)
> true
>
> I would have though the first use of in would be an error because asking 
> if a set is contained in a number is not defined.  Is there some other 
> interpretation of the operation?
>
>
> On Monday, August 29, 2016 at 3:27:30 PM UTC-4, Jared Crean wrote:
>>
>> Ah, yes.  That's it.
>>
>>   Thanks,
>>     Jared Crean
>>
>> On Monday, August 29, 2016 at 3:11:02 PM UTC-4, Erik Schnetter wrote:
>>>
>>> Jared
>>>
>>> Are you looking for the function `in`?
>>>
>>> -erik
>>>
>>> On Mon, Aug 29, 2016 at 3:06 PM, Jared Crean <jcre...@gmail.com> wrote:
>>>
>>>> I'm looking for a data structure that allows O(1) querying if a value 
>>>> is contained in the data structure, and reasonably fast construction of 
>>>> the 
>>>> data structure given that the initial size is unknown (although this 
>>>> criteria is not that strict).  I was looking at the Set in base, but I 
>>>> can't find a way to test if a Set contains contains a particular value.  I 
>>>> also don't know about the efficiency of appending to a Set.  Any 
>>>> suggestions or information about Set would be appreciated.
>>>>
>>>>     Jared Crean
>>>>
>>>
>>>
>>>
>>> -- 
>>> Erik Schnetter <schn...@gmail.com> 
>>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>>
>>

Reply via email to