![]() I hope that makes sense and what little I offered up helps you in some way. I have *some* code but you'd have to be the judge of its value (Any autolisp code I have is very old I wrote it years ago). The logic being that searching for number falling outside a specific range is faster then comparing characters or strings. ![]() Convert list back to text and write back to file. OPTIONAL: do the search and replace here as separate process.ģ./4. Iterate through that list and convert to a list of ASCII numbers and search for a value that falls out of range (then replace if necessary).ģ. Read the contents of the file into a list of lists.Ģ. I would tackle this in a few steps like so:ġ. why are you sorting a list of chars? Operating on a smallest as possible list (a list of numbers for example) will make your operation faster. But from what little I understand of your code I think you're making it too complicated -i.e. I doubt you really meant that, but it's okay because you can process the string within the list.I understand your question but my problem is that I cannot read AutoLisp very well anymore (I'm not very good at it anymore because of lack of practice). you showed your string actually as a list of a string. I'm using format, but I'm not sure if I'm using it incorrectly. It's not as fast as Marc'Antonio's, but pretty close. 1 How do you convert a list into a string I am trying to use parse-int to take a list of numbers and convert them to decimal, but i end up getting an error saying 'The control-string must be a string, not (contents)'. (setq lst (cons (substr str (1+ i)(- j i)) lst) (while (setq j (vl-string-search pat str i)) Taking the best from Luis and Marc'Antonio, plus acknowledgments to Eric The reduce function can be used to turn a list into a scalar, by applying a function on successive subsets of the list. multiple-character delimiter, which his will not handle. While Marc'Antonio's method is the fastest, I've grown a liking to the A placeholder for indicating that a function definition is a template. provide for validating the input or for multiple-character delimiters. Your offering is the almost the same a Luis' except that yours doesn't As Marc'Antonio sagely reminded us, setting string symbols is slower than You could use something like (prin1 (entget ename) openfilename) and (read-line filename) back in. Converting Numeric Data Types AutoLISP supports several numeric data types, such as integers, real numbers, and ratios. Strings are used as names of symbols, buffers, and files, to send messages. For every task addressed, a worked-out solution is presented as a short, focused, directly usable piece of code. First let me point out that the one you call JohnU is actually List data types can be converted to strings using strcat in combination with other list manipulation functions like mapcar, and specific elements can be extracted using nth, car, and cdr. A string in XEmacs Lisp is an array that contains an ordered sequence of characters. Elisp Cookbook This page contains snippets of code that demonstrate basic EmacsLisp programming operations in the spirit of the O’Reilly cookbook series of books. Virtually all modern programming languages. ![]() This function takes a delimited string, and returns a list: In most languages, this is realized as an array, vector, list, or sequence.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |