Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For what it's worth, the ParaSail parallel programming language (https://github.com/parasail-lang/parasail) supports this:

    func Search(Root : Tree; Desired_Value : Tree_Value)
      -> optional Tree_Id is   
        var Identifier : optional Tree_Id := null;
 
        for T => Root then Left(T) || Right(T)
          while T not null concurrent loop
 
           if Value(T) == Desired_Value then
              // Found desired node,
              // exit with its identifier
              exit loop with Identifier => Key(T);
           end if;
 
        end loop;
 
        return Identifier;
    end func Search;
I actually don't use this feature much, because usually there is a key of some sort that determines which side of the tree is of interest.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: