I just want to omit first value of list using a function but below code is returning same list I dont want to return from a fucntion Code:     #! /usr/bin/clisp      (defun omit(lstold)     (setf lstold (cdr lstold)) ) (setq x (list 3 1 2)) (omit x) (write x)  --&gt; gives output 3 1 2 ... why?
14640
I've just started learning Lisp and I can't figure out how to compile and link lisp code to an executable.  I'm using clisp and clisp -c produces two files:   .fas .lib   What do I do next to get an executable?
94174
When I am writing code in Python, I often need to remove items from a list or other sequence type based on some criteria. I haven't found a solution that is elegant and efficient, as removing items from a list you are currently iterating through is bad.  For example, you can't do this:  for name in names:     if name[-5:] == 'Smith':         names.remove(name)   I usually end up doing something like this:  toremove = [] for name in names:     if name[-5:] == 'Smith':         toremove.append(name) for name in toremove:     names.remove(name) del toremove   This is innefficient, fairly ugly and possibly buggy (how does it handle multiple 'John Smith' entries?). Does anyone have a more elegant solution, or at least a more efficient one?   How about one that works with dictionaries?
12708
In python, you can have a function return multiple values.  Here's a contrived example:  def divide(x, y):     quotient = x/y     remainder = x % y     return quotient, remainder    (q, r) = divide(22, 7)   This seems very useful, but it looks like it can also be abused ("Well..function X already computes what we need as an intermediate value.  Let's have X return that value also").  When should you draw the line and define a different method?
82341
example:  a_list = [1, 2, 3] a_list.len() # doesn't work len(a_list) # works   Python being (very) object oriented, I don't understand why the 'len' function isn't inherited by the object.  Plus I keep trying the wrong solution since it appears as the logical one to me
16494
When you pass a collection like list, array to another function in python, does it make a copy of it, or is it just a pointer?
98138
In Python, I can do:  &gt;&gt;&gt; list = ['a', 'b', 'c'] &gt;&gt;&gt; ', '.join(list) 'a, b, c'   Is there any easy way to do the same when I have a list of objects?  &gt;&gt;&gt; class Obj: ...     def __str__(self): ...         return 'name' ... &gt;&gt;&gt; list = [Obj(), Obj(), Obj()] &gt;&gt;&gt; ', '.join(list) Traceback (most recent call last):   File "&lt;stdin&gt;", line 1, in &lt;module&gt; TypeError: sequence item 0: expected string, instance found   Or do I have to resort to a for loop?
106392
To list all the files ending with 10 or 11 or 12 I have tried ls *[10-12] and ls *[10,11,12] but these are not working. I don't know why. Can anyone help me?
2267
What's the difference between the list methods append() and extend()?
17672
I'm trying to write a simple bash function that takes, as its arguments, a number of files and/or directories. It should:   Fully qualify the filenames. Sort them. Remove duplicates. Print all that actually exist. Return the number of non-existent files.   I have a script that almost does what I want, but falls down on the sorting. The return value of the script as it stands is correct, but the output is not (unsorted and duplicates). If I uncomment the | sort -u statement as indicated, the output is correct but the return value is always 0.  N.B. Simpler solutions to solve the problem are welcome but the question is really about why is this occurring in the code I have. That is, why does adding the pipe seemingly stop the script incrementing the variable r?  Here's the script:  function uniqfile {     local r=0       for arg in "$@"     do           readlink -e "$arg" || (( ++r ))      done #| sort -u    ## remove that comment      return $r }
121491
I have read the man page and other references, but I am still confused by the behavior of find with -print0 option.  -print0      This primary always evaluates to true.  It prints the pathname of              the current file to standard output, followed by an ASCII NUL              character (character code 0).   First command:  $ find /some/path/ -iname "*intro*jpeg" -o -iname "*intro*jpg" 2&gt; /dev/null /some/path//asdf199Intro-5kqlw.jpeg /some/path/199intro-2jjaj.JPEG /some/path/199intro-3.jpg /some/path/wuer199intro-4.JPG /some/path/xbzf199INTRO-1.jpg   Second command:  $ find /some/path/ -iname "*intro*jpeg" -o -iname "*intro*jpg" 2&gt; /dev/null -print0 /some/path/136intro-3.jpg/some/path/wuer136intro-4.JPG/some/path/xbzf136INTRO-1.jpg   I can see that the the filenames from the second command are null character separated, but why do I get 3 output as opposed to 5 above?
108260
So I have been tasked to make an array without duplicated values from another existing array. So I did it, but I want to know is there some other better way to do that. Example input/output: Input: 10, 15, 10, 5, 1, 3 Output: 10, 15, 5, 1, 3 So here is my code. #include &lt;stdio.h&gt;  int main(void) {   const int MAX_ARRAY_SIZE = 5;    int m[MAX_ARRAY_SIZE], p[MAX_ARRAY_SIZE];     for(int i = 0; i &lt; MAX_ARRAY_SIZE; i++) {     printf(&quot;Enter number: &quot;);     scanf(&quot;%d&quot;,&amp;m[i]);   }   int k = 0;   int dup = 0;   for(int i =0; i &lt; MAX_ARRAY_SIZE; i++) {     for(int j = i +1; j &lt;MAX_ARRAY_SIZE; j++) {         if(m[i] == m[j]) {             dup = 1;         }     }     if(dup != 1) {       p[k++] = m[i];     }     dup = 0;   }    printf(&quot;The new array without repeated values\n&quot;);   for(int i = 0; i &lt; k; i++) {     printf(&quot;%d\n&quot;,p[i]);   }    return 0; }  I'm not sure if this is the right and simple way I do that. I want some suggestions. Thanks in advance. :)
90301
Formatting breaks if code follows a list:   List item List item  This is in a code block  This does not work as expected   However, it works if between the list and the code   List item List item   There is a line of normal text.  This is in a code block # This does work as expected   Edit  To make this clear: This is not about nesting code in a list but about code following a (finished) list not working as expected (by me). To put it differently: Why is a list not considered finished despite of following empty lines? What do I have to do?
57019
Normally we use a different file to redirect the output.  For example :  cat &lt; first &gt; temp   In this command the contents of first are redirected to temp instead of the standard output.  Then why does it truncates the file if I use the same file name?  Why can't it overwrite the same file?  cat &lt; first &gt; first
13500
Input file1 is:  dog 123 4335 cat 13123 23424  deer 2131 213132 bear 2313 21313   I give the match the  pattern from in other file ( like dog 123 4335 from   file2).  I match the pattern of the line is dog 123 4335 and after printing all lines without match line my output is:   cat 13123 23424 deer 2131 213132 bear 2313 21313   If only use without address of line only use the pattern, for example 1s how to  match and  print the lines?
122801
Using receipt of "" I elaborated  the following code for my needs:  \documentclass{book}  ... \usepackage{expl3}  \begin{document}  \newcommand{\PrintAnswer}[1]{% \InputIfFileExists{#1}{\refstepcounter{subsection}}{\typeout{*** #1 not found ***}}}  \ExplSyntaxOn \cs_new:Nn\PrintAnswerList:n{   \clist_set:Nx\l_csv_clist{#1}   \clist_map_inline:Nn\l_csv_clist{     \typeout{**** Printing ##1.ans}     \ExplSyntaxOff     \PrintAnswer{##1.ans}     \ExplSyntaxOn   } } \PrintAnswerList:n{\inputfiles} \ExplSyntaxOff  \end{document}    It is intended for conditional compilation of a textbook, every chapter of which (eg, 01.tex, 02.tex) writes answers to problems to the file named after the name of the chapter source file, (eg, 01.ans, 02.ans etc). Near the end of the book these files are read in by the macro \PrintAnswer. Usually, I compile only few chapters using the following trick to keep desired chapters in \inputfiles macro:  \typein[\inputfiles]{^^JEnter filename(s) for \protect\includeonly:}   All that works fine, but I was forced to switch off experimental syntax before \PrintAnswer{##1.ans} because otherwise answer files are not processed correctly (in particular, LaTeX complains that the commands for greek letters are not defined and hyphenation is broken). Therefore my question is How can one rewrite the above code using user-level LaTeX3 commands?  I found \SplitList command in xparse package. Can it help?
32302
dir(re.compile(pattern))    does not return pattern as one of the lists's elements. Namely it returns:  ['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner', 'search', 'split', 'sub', 'subn']   According to the manual, it is supposed to contain      the object's attributes' names, the   names of its class's attributes, and   recursively of the attributes of its   class's base classes.   It says also that     The list is not necessarily complete.   Is there a way to get the complete list? I always assumed that dir returns a complete list but apparently it does not...  Also: is there a way to list only attributes? Or only methods?  Edit: this is actually a bug in python -> supposedly it is fixed in the 3.0 branch (and perhaps also in 2.6)
52830
I need to build a list of files present in a directory but also pass in a file containing a list of directories to exclude.  I've seen the below suggestion but I've had no luck with it when it comes to the type flag:  find $dir_name $(printf "! -name %s " $(cat $exclude_file))   Is there a way I can do it or will I need to create the entire list and then work through it removing ones that partially match ones in the exclude directory.