array:set

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

array:set

Donald Steven
Apparently, array:set can only be used on one index at a time, as in: 
array:set(?TRACK1, Track1, Sounds),


I'd like to do the equivalent of (I made up the syntax):
array:set(?TRACK1, Track1; ?TRACK2, Track2, ...; Sounds),


Is my only option a recursive function making 2 lists and then going
through them using hd(), tl()?

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: array:set

Fred Youhanaie-2
If your intention is to set the entire contents of the array, then you can use array:from_list/2, see the man page for details.

On 03/03/2019 12:55, Donald Steven wrote:

> Apparently, array:set can only be used on one index at a time, as in: array:set(?TRACK1, Track1, Sounds),
>
>
> I'd like to do the equivalent of (I made up the syntax): array:set(?TRACK1, Track1; ?TRACK2, Track2, ...; Sounds),
>
>
> Is my only option a recursive function making 2 lists and then going through them using hd(), tl()?
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: array:set

Donald Steven
Perfect!  Thanks Fred.

On 3/3/2019 8:24 AM, Fred Youhanaie wrote:

> If your intention is to set the entire contents of the array, then you
> can use array:from_list/2, see the man page for details.
>
> On 03/03/2019 12:55, Donald Steven wrote:
>> Apparently, array:set can only be used on one index at a time, as in:
>> array:set(?TRACK1, Track1, Sounds),
>>
>>
>> I'd like to do the equivalent of (I made up the syntax):
>> array:set(?TRACK1, Track1; ?TRACK2, Track2, ...; Sounds),
>>
>>
>> Is my only option a recursive function making 2 lists and then going
>> through them using hd(), tl()?
>>
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email]
>> http://erlang.org/mailman/listinfo/erlang-questions
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions