Search found 14 matches

by ljgww
Mon May 25, 2020 3:25 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

Note this too (a lesson after trying to find some other bug in my code):

viewtopic.php?f=12&t=75388
by ljgww
Mon May 25, 2020 3:24 pm
Forum: Tricks 'n' Tips
Topic: Map keys behave differently between PB and SB
Replies: 1
Views: 1438

Map keys behave differently between PB and SB

It is not safe to assume that keys in the map are behaving in the same way when porting code forth and back between SpiderBasic and PureBasic.

Apparently SpiderBasic preserves map keys in order of populating while PureBasic does something else (likely some hashing for speed optimization)

the code ...
by ljgww
Mon May 25, 2020 3:21 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

what you've described is exactly what a prefix trie is for, otherwise you'd be looking at a DAG or something else that works.
Personally I think Tries are the the missing link, theoretically they're better than a hash table but they're hard to generalise, which is probably why you don't see them ...
by ljgww
Tue May 19, 2020 1:23 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

you want a trie instead of a map.

https://www.purebasic.fr/english/viewtopic.php?f=12&t=74786

Thank you for this, Idle. Programming is endless amusement and this is one of best examples. It is also a discovery path - one starts a naive journey somewhere and the on the way steps on something ...
by ljgww
Mon May 18, 2020 3:28 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

Cool.
Thank you Marc56us
by ljgww
Mon May 18, 2020 3:00 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

Brings to the next question are Map keys inherently sorted?, or I need to iterate whole set (making it O(n) effectively)
Seems that they are not. They seem to keep sequence of how they were added. Gosh.
by ljgww
Mon May 18, 2020 2:56 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

Is there any technique that allows finding closest map element by providing incomplete/partial key?
meaning, any faster technique apart from sequentially searching thru the list of map keys The sequential search is not necessarily very slow and ForEach and FindString in PB allows to browse a Map or ...
by ljgww
Mon May 18, 2020 2:41 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

An in-memory SQLite database should work.
A query like "SELECT * FROM [TABLE] WHERE KEY LIKE 'BC%' would return all elements with keys starting with 'BC'.

While I am pondering how not to use SQL way...

Just a question here: LIKE 'BC%' would be I guess 'left match'. (would need to go into SqlLite ...
by ljgww
Mon May 18, 2020 2:14 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Re: Map partial key match method

Ty NickTheQuick for prompt answer.

After I posted a question I asked myself is this thing really available in some other languages like Python, JavaScript or C# who have "dictionary" like structures. And it seems to me that this is somewhat of gray area in other languages too. So far of a few ...
by ljgww
Mon May 18, 2020 1:26 pm
Forum: Coding Questions
Topic: Map partial key match method
Replies: 15
Views: 3875

Map partial key match method

Consider this code


NewMap txt.s()

AddMapElement(txt(),"abcd")
txt()="abcd"
AddMapElement(txt(),"bcde")
txt()="bcde"
AddMapElement(txt(),"cdef")
txt()="cdef"

; finding exact key
If FindMapElement(txt(),"cdef")
Debug "cdef found"
Debug MapKey(txt())
Else
Debug "cdef not found"
Debug MapKey ...
by ljgww
Thu Apr 22, 2010 12:57 pm
Forum: Mac OSX
Topic: 4.40 ppc don't work linker error
Replies: 3
Views: 2584

Re: 4.40 ppc don't work linker error

This was helpful after upgrading from PB4.10 to PB 4.41. Upgrading to XCode 2.5 solved linker errors.
(x86 Imac, MacOSX 10.4.11)
by ljgww
Thu Apr 22, 2010 12:46 pm
Forum: Mac OSX
Topic: PB4.41 Font size in editor
Replies: 3
Views: 2512

Re: PB4.41 Font size in editor

For what is worth:

Intel IMac, MacOSX 10.4.11, PB 4.41, XCode 2.5.
PPC Mac, MacOSX 10.4.11, PB 4.10, XCode 2.0.

Same problem - font selection button is "disabled" in editor options (PB Preferences), makes it difficult to write in IDE editor as default font is too small. Problem is obviously ...
by ljgww
Sun Nov 11, 2007 9:12 pm
Forum: Mac OSX
Topic: It will be a purebasic 4.0 version for mac os x??
Replies: 43
Views: 24308

Re: Windows > OS X > Linux

IMHO, based on the potential to gain additional users, the order should be:
1. Windows
2. Mac OS X
3. Linux
Mac OS X users are used to paying for software and that is the platform for the most potential growth but based on the *existing* user base I understand how Fred would want to work on the ...
by ljgww
Fri Nov 02, 2007 6:58 pm
Forum: General Discussion
Topic: WANTED Help file (English) for version 3.10
Replies: 8
Views: 2832

Documentation Quirks - Mac OS x

I have noted this in both and current stable release help files are in 3 folders (mac OS x version of purebasic) i did not explore Windows version as yet, but if this made as development snapshot it is likely that it is in other versions too...

purebasic
purebasic_german
purebasic_french

only ...