is there a way to iterate over Tuples or get an Element of a Tuple without using BIFs? And i need to do this without using any other Data type like lists or maps or something else.
I did a lot of research but found nothing. :(
Thanks!
Related
I am trying to duplicate all values in an array in my sheet. I have {1,6,14,15} and I want to output {1,1,6,6,14,14,15,15}. I would like to do this exclusively with functions. I have seen the VSTACK function, which seems very useful, however joining the insider thing seems like a hassle and would not allow this spreadsheet to be usable across other devices easily.
I have tried the CONCAT function, however this simply returns 161415161415 which is not helpful to me. The various alternatives to VSTACK all remove duplicates, which is exactly not what I am looking for. Besides all of those alternatives are lengthy and hard for me to wrap my head around.
You could use EXPAND() here:
=LET(arr,{1,6,14,15},TOROW(IFERROR(EXPAND(arr,2),arr),,1))
Note that 2 will define how often you want to duplicate the input.
If you have LET and SEQUENCE:
=LET(ζ,{1,6,14,15},INDEX(ζ,SEQUENCE(,2*COUNTA(ζ),,0.5)))
I'm making a scheduling app, and storing all the scheduled things in firebase with arrays. When I try to schedule something with the same string value, it fails and doesn't add it to the array. I don't know if this is something in swift I can edit, or if it's a firebase setting.
If it's something in swift, here's the code updating the array:
doc.updateData([
"Instructor": FieldValue.arrayUnion(["\(scheduleinstructor)"])
])
If it's something in firebase, could someone please explain a way around this or a simple fix I overlooked?
According to the documentation on adding items to an array:
arrayUnion() adds elements to an array but only elements not already present
So the fact that the duplicate entry is not added is by design. If you want to allow that, you'll have to:
Read the document with the array from the databae.
Extract the array from the document into your application code.
Add the item to the array.
Write the entire modified array back to the database.
I am creating a Sudoku project in vb.net, to such an end I need to store a list of all the possibilities for each square where the squares are indexed by one number. for example the computer needs to know that for square [8] the numbers {1,3,5,9} are possible etc... I began by using a jagged array however there is no apparent 'remove' method which needs to be called a lot. this makes my code looks ugly with all the redim statements in it and so I was curious as to whether a list or arraylist would be best suited to my purposes? I have discovered arraylists have a remove method but I have also read that array lists are all but deprecated and i want to know if there is a nicer solution to this.
I'm trying to pick out unique elements from a collection of objects and then save them to a sub collection.
The code I have is:
for item in db.col1.find({'Summary': {'$ne':{}}}):
current_specs = item['Summary']['Specs']
if not db.col1.specs.find({'Specs':current_specs}).count():
db.col1.specs.save({'Specs':current_specs, 'Updated': datetime.datetime.now()},safe=True)
This produces duplicate entries within db.col1.specs. I thought by using safe=True, it would make sure the write was completed and hence duplicates would not be added but this does not seem to be the case.
Can anyone explain why this is failing and the correct way of doing it?
Cheers
Figured it out:
the item['Summary']['Specs'] entry is itself a dictionary and to search for dictionaries you have to search for each individual dictionary entry
e.g. if the object looks like:
current_specs = {'field1': something, 'field2': something_else}
then we can find it via:
find({'Specs.field1':current_specs[field1], 'Specs.field2': current_specs[field2]})
you can't just use:
find({'Specs':current_specs})
Is it possible to create a multidimensional array of gtkwidgets? Specifically something like this:
mywidgetlist[2]["title"];
Or should I be doing this in a different way? How would I do this?
Basically I have a number of "widgets" (Loaded from gtkbuilder) composed of smaller widgets and I want to be able to change certain values, so this array setup seems preferable.
Is there another way of doing this (Other than actually coding a complete widget using signals etc and placing them in a simple array?)
In C, you cannot use a string to index into an array. Or, strictly speaking you can, but it's almost never what you want to do.
For C solution using glib (handy if you already use GTK+), consider a single-dimensional array of GHashTable pointers.