Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Embedding to Python #220

Open
Nanguage opened this issue Jun 12, 2021 · 2 comments
Open

Embedding to Python #220

Nanguage opened this issue Jun 12, 2021 · 2 comments

Comments

@Nanguage
Copy link

Nanguage commented Jun 12, 2021

It's possible to embedding seq-lang to Python? Just like the numba and taichi.

The syntax of seq-lang is very similar to Python, so I think maybe it's possible to compile the source code in a Python function to seq-lang, for example:

@seq_lang
def check_prime(n):
   # this part in "seq-lang scope", it will compile to seq lang and get high performance
    if n > 1:
        for i in range(2, n):
            if n % i == 0:
                return False
        return True
    else:
        return False

# this part run in "Python scope", run slow but could interact with other Python library
n = 1009
print(n, 'is', 'a' if check_prime(n) else 'not a', 'prime')

If it's possible, it's will more convenient for Python users in their daily work.

@arshajii
Copy link
Member

Hi @Nanguage, thanks for the suggestion. This is definitely something on our todo list. In theory it shouldn't be too difficult, and we have an idea of how to implement it. We're in the process now of generalizing/expanding Seq w.r.t. Python compatibility and interoperability, and plan to look more into this soon.

@jamestwebber
Copy link

Just saw the paper and was intrigued, and this issue was top of my mind. Calling Python from Seq is great, but calling Seq from Python would be even better :D That way I can keep my existing Python pipeline and only speed up the parts that are particularly painful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants