Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
How do you limit the line length of the output commands? Where ispqueue library documented?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Mason Kelsey, post: 4649385"] [Note: parts of this message were removed to make it a legal post.] Thanks for the link to documentation on PQueue. If you maintain the link you might want to make it clear in the description that you can order ascending OR descending in the priority queue, and that any component (subarray) of the array can be used to sort/prioritize on. This automatic feature is of use in a lot of different applications. In my code I am adding elements in an ascending order on the first subarray, the heuristic value created by another method. My code is: pq=PQueue.new(proc{|x,y| x[0][0]*<*y[0][0]}) but if I had wanted descending order I would have written pq=PQueue.new(proc{|x,y| x[0][0]*>*y[0][0]}). Note the change from "<" to ">". And if I had wanted to sort on different subarray I would have changed the values in the brackets accordingly, just making sure that the x and y values were the same. Would be nice to have minor sort capabilities too in some applications. I also recommend that all Ruby documentation include simple real code examples of their use by including actual code that has been tested, with all the essential components included in the example. No Sam [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
How do you limit the line length of the output commands? Where ispqueue library documented?
Top