I did not mean to mutate the tuple. Just implement the index dropping by 
some code which directly specifies the bits of the new tuple as a function 
of the bits of the old tuple.

On Saturday, June 25, 2016 at 5:40:08 PM UTC+2, Kristoffer Carlsson wrote:
>
> You cannot hack around the fact that a tuple is immutable so you need to 
> construct a new one from scratch.
>
> On Saturday, June 25, 2016 at 9:45:06 AM UTC-4, jw3126 wrote:
>>
>> @Sisyphuss: The problem with vectors is that they are always heap 
>> allocated. If you do stuff involving lots of small size vectors things 
>> become slow. What I need to do is projecting points onto simplexes in 1-4 
>> dimensions, so this a task base arrays are bad at. I tried to do it only 
>> allocating the arrays once and mutating them. But this makes the code very 
>> quickly very ugly... Now I use the FixedSizeArrays 
>> <https://github.com/SimonDanisch/FixedSizeArrays.jl>package instead, 
>> which is based on Tuples.
>>
>> @Tim: Thanks for the insights! On my machine slowness starts to kick in 
>> at size 9 already. I tried to read the llvm code, but did not really 
>> understand it. It seems however that the machine will not go through N 
>> (out, t) pairs for a tuple of length N?
>>
>> Also is it possible in Julia, to implement this function in a low level 
>> way, like directly shifting bits in the tuple?
>>
>>
>> On Saturday, June 25, 2016 at 12:45:55 PM UTC+2, Sisyphuss wrote:
>>>
>>> Why not use `vector`?
>>>
>>> On Friday, June 24, 2016 at 4:16:49 PM UTC+2, jw3126 wrote:
>>>>
>>>> I have a Tuple and I want to drop its ith element (e.g. construct a new 
>>>> tuple with the same elements, except the ith is missing). For example
>>>>
>>>> (1,2,3,4) , 1 --> (2,3,4)
>>>> (1,2,3,4) , 3 --> (1,2,4)
>>>> (1,2,3,4) , 4 --> (1,2,3)
>>>>
>>>> How to do this?
>>>>
>>>

Reply via email to