Bug? Tricky syntax? Finding items in a list
|
11-03-2017, 03:28 PM
(This post was last modified: 11-03-2017 09:16 PM by StephenG1CMZ.)
Post: #1
|
|||
|
|||
Bug? Tricky syntax? Finding items in a list
This program is meant to find the positions of items in a list.
A simple FOR loop, yes? No, it has problems if the list contains lists. It gives a Bad Agument Error...unless you insert a diagnostic print, in which case the inner list is printed, and nothing after that. Code:
Example: Find({1,{},33,4},33) should yield {3} But (1,{} ,3,4},3 fails. Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
11-03-2017, 03:53 PM
Post: #2
|
|||
|
|||
RE: Bug? Tricky syntax? Finding items in a list
Code:
Viga C | TD | FB |
|||
11-03-2017, 04:19 PM
Post: #3
|
|||
|
|||
RE: Bug? Tricky syntax? Finding items in a list
This is a little faster
Code:
Viga C | TD | FB |
|||
11-04-2017, 07:01 AM
Post: #4
|
|||
|
|||
RE: Bug? Tricky syntax? Finding items in a list
There are 2 list libraries in the software libraries that you might find useful. The first is an extension to the list functions, and the second (which uses the first) is for associated lists (content addressable memory). Both are linked to from the Programming Documentation section of the wiki here...
http://www.wiki4hp.com/doku.php?id=prime:start Here are the 2 links... First is the Programmer's Expanded List Library... http://www.hpmuseum.org/forum/thread-700...light=list Then there is the Associative List Library... http://www.hpmuseum.org/forum/thread-909...light=list |
|||
11-04-2017, 09:36 AM
(This post was last modified: 11-04-2017 09:38 AM by StephenG1CMZ.)
Post: #5
|
|||
|
|||
RE: Bug? Tricky syntax? Finding items in a list
(11-03-2017 04:19 PM)Carlos295pz Wrote: This is a little faster Yes...Actually, I see that as about 6 times faster, not just "a little". I will include that version in my List API if I may. http://www.hpmuseum.org/forum/thread-9411.html Stephen Lewkowicz (G1CMZ) https://my.numworks.com/python/steveg1cmz |
|||
11-04-2017, 09:42 AM
Post: #6
|
|||
|
|||
RE: Bug? Tricky syntax? Finding items in a list | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)