Giter Club home page Giter Club logo

Comments (4)

rohrlich avatar rohrlich commented on July 23, 2024

I found the source of pi issue #5 but I’m undecided about the best way to fix. The problem is the recursion in the code below. I am leery about adding a bool recurse argument as the method as it would be necessary in a chain of methods. I lean towards a another set of methods that don’t recurse. It would mean some method name changes to make it clear which set did the recursion.

// FindNamePrefix looks for given symbol name prefix within this map
// and any children on the map.
// adds to given matches map (which can be nil), for more efficient recursive use
func (sm *SymMap) FindNamePrefix(seed string, matches *SymMap) {
noCase := true
if complete.HasUpperCase(seed) {
noCase = false
}
for _, sy := range *sm {
nm := sy.Name
if noCase {
nm = strings.ToLower(nm)
}
if strings.HasPrefix(nm, seed) {
if *matches == nil {
*matches = make(SymMap)
}
(*matches)[sy.Name] = sy
}
}
for _, ss := range *sm {
ss.Children.FindNamePrefix(seed, matches)
}
}

from pi.

rcoreilly avatar rcoreilly commented on July 23, 2024

Yep go ahead and add a new set of methods. FindNamePrefixRecursive vs. FindNamePrefix?

from pi.

rohrlich avatar rohrlich commented on July 23, 2024

Yes, that naming is very clear!

from pi.

rohrlich avatar rohrlich commented on July 23, 2024

Done

from pi.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.