It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
3::[4;5;2;7];;
List.length [4;5;2;7];;
[4;5;2;7]::3;;
This gives the error This expression was expected to have type int list list but here has type int
I know that it can be solved by doing : [4;5;2;7];; List.append it [3];; but is there any other way to do it?
This is a really bad question. However, The last line in your code will fail with
This expression was expected to have type
int list list but here has type
int
.. because :: concatenates an element to a list. It can only do it from the front because the list is a singly linked list. If you want to add an element at the end of the list, you're probably using the wrong data structure. If you really want to add an element to the end of a list, you could do
[4;5;2;7] # [3];;
Be aware that this will be really inefficient.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I want to validate a text box (with max length 2) to contain only these 3 set of values.
(i) 00-99
(ii) Q
(iii) DQ
Invalid values are 1Q, 2D, QD, QQ, DD,etc etc
Alright you can use the following it will check for what you asked for its very simple and primitive regix but will work:
\d{2}|DQ|Q
If you want to better understand regular expressions the following might help:
http://msdn.microsoft.com/en-us/library/az24scfc.aspx
You can also use:
http://myregextester.com/index.php
As a tool to test your regix.
Hope that helps
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Which part of the following statement is incorrect?
An input iterator can only read from the current position once and must then be incremented. The current position cannot be written to.
An input iterator can only read from the current position once and must then be incremented.
This part is incorrect. You may dereference an input iterator as many times as you like! (However, most input iterators are single-pass.)
The current position cannot be written to.
This part is correct. You have an input iterator.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a member L that is a list of pairs of ints which I would like to use in a const function. I'm hence not supposed to modify L, but I don't know how I can iterate through L, to read its contents (as opposed to modifying them).
The compiler keeps saying there is a conversion issue.
Assuming you are using std::list<std::pair<int,int>> you need to use std::list<std::pair<int,int>>::const_iterator as the type for your iterator.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I have ordederd to make a function, which takes a list ex [3,4,6,1,29] and returns a list of tuples [(3,4),(4,6),(6,1),(1,29)]
This is a very easy question, it's really hard to help without defeating the purpose...
If you are allowed to use predifined functions, there is already one which can do almost all work for you (if you don't know which one, try finding it with http://www.haskell.org/hoogle/ ). Take a step back and think about the easier question how to produce a list [(3,3),(4,4),(6,6),(1,1),(29,29)].
If you can't use predefined functions, then recursion is your friend: What do you need to do for an empty list? What for a list with one element? With two elements?
Without any own effort I can't give more hints. If you're stuck, extend your question and show what you already got, and we'll try to help.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
input: name <hui.li#xxx.ch>; hans#dhdfhgdfgh <hans.dampf#xxxx>;
Output: e1#mail.com, e2#mail.com, e3#mail.com,e#mail.com
I want to erase the stuff between: >;(?*)< But my regex isn't working.
If >;(?*)< is the Regex you tried, then the question mark is probably wrong. It has no special meaning. Try using >;(.*)< instead and see if thats what you wanted.
you should go another way. Instead of filtering the decoration you should write a regex, that matches only email addresses. Get the result as an array and join it with ", "
To find valid emails there are plenty of expressions out there. More ore less accurate. http://regexlib.com/Search.aspx?k=email