1

Topic: [Erlang] the Binary data. Concatenation

All greetings! Wrote here function. She on idea should install  in 1 if at the sorted list from fields is present with a current index, and 0 if is not present. I can not understand why it swears badarg on the selected line. bitmap ([Idx | Tail], Idx, Bitmaps)-> NewBitmap = <<Bitmaps/binary, 1:1>>, bitmap (Tail, Idx+1, NewBitmap); bitmap (_Fields, 65, Bitmaps)-> <<Bitmaps/binary>>; bitmap (Fields, Idx, Bitmaps)-> NewBitmap = <<Bitmaps/binary, 0:1>>, bitmap (Fields, Idx+1, NewBitmap). Function is caused so bitmap ([2,5,6], 1, <<>>) In process happens Idx=0: Bitmap: <<>> Idx=1: Bitmap: <<0:1>> and during the moment when we try to make <<Bitmaps/binary, 1:1>> - we fall with