What is difference between contains and includes methods in immutable js?
The documentation just says
ALIAS
contains()
You already said it: includes is an alias for contains, meaning: It's the same function. You can see that by looking into the actual source code, dist/immutable.js, line 4824:
CollectionPrototype.contains = CollectionPrototype.includes;
Related
My question is Python specific (3.4.3).
My question is specific to Built-In functions only.
It is clear to me the difference between a keyword (reserved word) and an identifier (user-defined variable).
See: https://en.wikipedia.org/wiki/Reserved_word
Likewise, I understand the basic meaning of the terminology 'function'
See : https://en.wikipedia.org/wiki/Functional_programming \
and
http://www.learnpython.org/en/Functions
However, I am having difficulty understanding the difference between Built-in functions and keywords; such as 'if' and 'for'.
https://docs.python.org/3/library/functions.html#built-in-funcs
What is the difference between the two? Keyword and Function.
Is the Keyword 'if' not simply a built in function? If so, why does it not appear in the official list of Built-In functions in the Python documentation?
https://docs.python.org/3/library/functions.html#built-in-funcs
It certainly behaves as a function. Is it simply because it preforms a procedure as opposed to returning a value? In which case how would you define it? As a method?
I have searched high and low on stackoverflow and I cannot seem to locate an answer.
Answers such as the two examples given below do not answer the overriding questions for me. Which are;
1) What defines a keyword as a keyword, rather than a builtIn function?
2) If keywords such as 'if' are not functions, then what are they? They are not classes etc. I understand that 'IF' is an example of a condition statement but what is the generic terminology for these keywords. The word keyword only defines the fact that it is reserved within the language, it does not define what the actual object is, i.e. function, class, method etc.
http://stackoverflow.com/questions/6054672/whats-the-difference-between-a-keyword-or-a-statement-and-a-function-call
http://stackoverflow.com/questions/155609/difference-between-a-method-and-a-function?rq=1
Keywords are those that describe the action to be performed, or specify how to interpret something (give meaning to instructions)
Functions are simply labels (for a set of instructions).
If you change function names it won't matter to Python (you can edit built in modules), but you can't relabel keywords.
You have already added tons of references to both, so I will not cite more.
Not sure if this is the right place to post this question but:
If I have a list of functions that I am listing in a spec doc, lets say
MyObj_Func1
MyObj_Func2
MyObj_Func3
and so on but I just want to list the core name of the functions (Func1, Func2, Func3) How do I note at the top to say "the functions listed below all start with "MyObj_"?
Something like: MyObj_:: and then ... before the function names in the list?
I would leave the prefixes in the documentation. Though repetitive, it's what I would expect to see (as a c developer).
For example see the GNOME docs for hash table (which I consider to be fairly well done): https://developer.gnome.org/glib/2.31/glib-Hash-Tables.html.
To try to understand, I looked for some code on the internet and found the following declaration of what I suppose to be functions, and that I don't understand at all.
sext #(.inwidth(1), .outwidth(32)) scc_sext_i0(
.i0(paw_0_i0_outport0[32]),
.o0(scc_sext_i0_o0));
combine2_wn #(.inwidth0(32), .inwidth1(32)) scc_combine2_wn_i0(
.i0(paw_0_i0_outport0[31 : 0]),
.i1(scc_sext_i0_o0),
.o0(scc_combine2_wn_i0_o0));
combine2_wn #(.inwidth0(32), .inwidth1(32)) scc_combine2_wn_i1(
.i0(scc_combine2_wn_i2_o0[31 : 0]),
.i1(scc_combine2_wn_i2_o0[63 : 32]),
.o0(scc_combine2_wn_i1_o0));
My questions are the following:
Are these really functions mapping?
If yes, they are not defined in any other lower level .v file (and no library is included either in the top-level file). So what is their use?
What does # symbol mean?
What does .inwidth(32) mean? input of 32 bits? (impossible to find on the internet...)
If yes, the combine2_wn blocks should have only 2 inputs, why is there an output mapped each time?
More generally, are these any kind of concatenation functions?
These are most likely module instantiations, not function calls.
You should have a module named sext and another named combine2_wn declared in files somewhere in your Verilog search path.
#() means you are assigning values to parameters inside the named modules.
There is a parameter named inwidth in the sext module. You are assigning it a value of 1.
There are plenty of references on the web. Look at the verilog wiki site.
I'm very newbie in closure,
I'm reading the tutorial at: https://developers.google.com/closure/library/docs/tutorial
and it says that
goog.provide('tutorial.notepad.Note');
is equivalent to
tutorial = tutorial || {};
tutorial.notepad = tutorial.notepad || {};
tutorial.notepad.Note = tutorial.notepad.Note || {};
basing on that fact, I assume that if use goog.provide('tutorial.notepad.Note');
then there is no need to use goog.provide('tutorial.notepad);
but the example uses both of them together.
may somebody explain to me why?
goog.provide(namespace) will check each dot-delimited name starting on the left and create a property pointing to a new object literal equivalent to the tutorial excerpt you provided above. Therefore, you are correct that notepad.js does not technically need to include goog.provide('tutorial.notepad'), since goog.provide('tutorial.notepad.Note') will ensure that the object chain tutorial.notepad exists.
However, in addition to defining a Note object with member function makeNoteDom, notepad.js also defines a utility function makeNotes, which is a member of the tutorial.notepad namespace. By including goog.provide(tutorial.notepad), it indicates that notepad.js provides package-level functionality in addition to defining a Note object.
I'm working on a project that's integrating with StrobeMediaPlayback and have been having trouble working out why I can't get my media loaded.
One of the two available public functions for the class is:
public function loadMedia(..._):void
If this is a rest parameter, there's no use of '_' as an argument list within the function.
What's going on here? The class extends Sprite, so its not a case of an override.
It is the ... (rest) parameter.
The parameter does not need to be called rest; it can have any name that is not a keyword.
Valid variable names start with a non number character and can include alphanumeric characters, the underscore and the dollar sign. So _ is a valid name for a parameter.
The question why exactly the parameter was named that way can probably only be answered by the author of that function. So here's what I think: Aside from its use as a short variable name for often used objects (like $ as shorter name for jQuery in javascript), the name _ is sometimes used as a placeholder, or unused variable. If I understand the question right, an the variable isn't even used in the function, it probably was added for future use. This way the API wouldn't need to be changed once the feature based on this parameter will be implemented. The developers maybe thought that a parameter name with semantic meaning could confuse the users, as they would expect it to actually doing something.