1. How to Tell Phix Where the Standard Includes Are

In OE, I can use a settings file to direct Euphoria where to find the files I'm including in my source.

How do I do that with Phix, if my standard includes are in c:\Phix\std?

OK, on further review, apparently, there is no std/ include directory in a Phix installation. It's all in builtins?

I'm trying to add an intersection() function to the Phix source. One of these:

public function intersection(sequence a, sequence b) 
sequence s = {}, y, z 
 
    -- loop over the shortest sequence 
    -- although this probably takes longer than just looping over either one 
    -- I suspect with very large sequences, this might save more than 0 seconds 
     
    if length(a) > length(b) then 
        y = b 
        z = a 
    else 
        y = a 
        z = b 
    end if 
 
    for c=1 to length(y) do 
        if find(y[c],z) then 
            s = append(s, y[c]) 
        end if 
    end for 
return sort(s) 
end function 
public function intersection_more(sequence sources) 
sequence s = {} 
if length(sources) > 1 then 
    for b=1 to length(sources) do 
        if sequence(sources[b]) then 
            for c=1 to length(sources[b]) do 
                if find(sources[b][c],s) = 0 then 
                    s = append(s,sources[b][c]) 
                end if 
            end for 
        else 
            puts(1,"intersection(sources) - sources must be composed only of sequences") 
            ?9/0 
        end if 
    end for 
else 
    puts(1,"sequence parameter of intersection() requires a sequence of at least length 2") 
    ?9/0 
end if 
return sort(s) 
end function 

I wanted to try the "Pull request" functionality of the repo... grin

new topic     » topic index » view message » categorize

2. Re: How to Tell Phix Where the Standard Includes Are

You can just put a new file into builtins and it should find it.

Formal incorporation into the language involves making it an autoinclude (if appropriate, ie changes to psym.e) and properly documenting it (either in Library Routines or Other Libraries), along with checking the OE docs and sources for compatibility (aka minimising future incompatibilities) - on that front, my first question would be: is intersection_more() actually the same thing as union()?

So, posting here, exactly as you just have, is probably the best option right now.

new topic     » goto parent     » topic index » view message » categorize

3. Re: How to Tell Phix Where the Standard Includes Are

petelomax said...

is intersection_more() actually the same thing as union()?

I'm not sure! Where is union() documented? I couldn't find it anywhere in the Phix docs.

On another note, you should probably do some SEO. grin

"phix union" on Google

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu