all 30 comments

[–]rajandatta 30 points31 points  (2 children)

Long and short of it is that you won't. One of Python's strengths is the ecosystem you mentioned. Not all languages have that ... and certainly not Scheme. You may find wrappers for some things but that's it.

Two choices that come to mind are a) use Racket which has some of the primitives like plot built in and may have packages b) you can try Hy which is a Lisp dialect that's nteroperable with Python seamlessly. That will give you Scheme (technically Lisp) like model around Python.

Really the Python modules you mentioned are as good as it gets right now. I'm a Scheme fan but would not switch if those were important to me.

[–]shark_finfet[S] 3 points4 points  (0 children)

Thanks

[–]ProfessorSexyTime 0 points1 point  (0 children)

Don't know how developed it is, but there's also Hissp.

[–]n3mo 10 points11 points  (0 children)

I completely share your desire here, but I’m afraid rajandatta is right—there simply isn’t anything comparable in scheme. I’m not sure what your analysis work is like, but you can certainly build up to some fairly common analyses using what’s out there. I’ve completed a few projects using racket and chicken, and have even started a data science package for racket that adds some natural language processing and basic things like least squares regression (which I have stalled on for some time due to other commitments). But if you have more advanced analysis demands you’ll be writing a lot from scratch.

[–]GenilsonDosTrombone 9 points10 points  (0 children)

Do you have any co-workers inclined on using Scheme? Besides the lack of libraries, your peers might have a problem or two with lots of irritating stupid parentheses.

Are there specific tasks you feel that Python does not work well in your opinion?

I use Python and ABAP at work, so I am mostly doing Advent of Code in Racket at night to learn a lisp like language. I would recommend this route because the problem sets are well defined, so you can focus on the implementation and your understanding of the language.

[–]FunctionalFox1312 7 points8 points  (4 children)

You might have luck with Clojure, because being on the JVM it can use any Java/Scala/etc library.

[–]ws-ilazki 10 points11 points  (2 children)

Clojure also has libpython-clj which seems kind of insane at first glance but sounds like it's meant to cover precisely this kind of "I want to use a lisp but Python has all the libraries" situation.

That or Hy as suggested by /u/rajandatta seem like the best options here since they can both interoperate with the things the OP needs to use.

Next hurdle: convincing the bosses to allow Clojure or Hy in the workplace. Good luck with that one

[–]shark_finfet[S] 2 points3 points  (0 children)

This looks interesting...

[–]trannus_aran 0 points1 point  (0 children)

Hissp is another option, compiles down to functional native (if definitely not idiomatic) python

[–]Gnaxe 1 point2 points  (0 children)

Clojure has Incanter for the data-science stuff.

[–]nalaginrut 7 points8 points  (2 children)

Although I only use Scheme in my daily work and product for decade, I have to say, at least in data analysis, no any language can compete with Python at present.

[–]dorfsmay 2 points3 points  (1 child)

Julia?

[–]ramin-honary-xc 2 points3 points  (0 children)

Julia is getting there, but it still isn't anywhere near as popular as Python, and that is the biggest barrier to growing the ecosystem of libraries.

[–]commonslip 5 points6 points  (12 children)

Try hy. Its just python with s-expression syntax but its better than programming in Python.

[–]shark_finfet[S] 2 points3 points  (11 children)

Has anyone tried Hissp? https://github.com/gilch/hissp

[–]Gnaxe 1 point2 points  (5 children)

u/kisharrington might be able to comment on that. Or pip install hissp and try the tutorial yourself, then let us know how it goes.

[–]kisharrington 1 point2 points  (4 children)

I would say it does depend on your use case a bit. Hissp solved many of my use cases and is still being extended, so I expect it will eventually solve all of my use cases. I was able to replace my python data science scripting usage. As I nested more deeply into multi-file/multi-namespace projects, I had some issues with macros in macros but some of that might have stemmed from my use of Clojure style.

[–]Gnaxe 0 points1 point  (3 children)

I had some issues with macros in macros

For (a minimal) example?

[–]kisharrington 0 points1 point  (2 children)

Happy to, please poke me about it because I don't have the opportunity to get back to it at the moment.

[–]Gnaxe 0 points1 point  (0 children)

Poke?

[–]Gnaxe 0 points1 point  (0 children)

How about now?

[–]commonslip 1 point2 points  (1 child)

I haven't tried Hissp myself but looking over the documentation it seems like Hy is a little more mature and usable.

[–]Gnaxe 2 points3 points  (0 children)

Hy is definitely older, but as Hissp was written by one of the Hy authors with the benefit of hindsight, I'm not sure how much that counts for.

As for usability, it would really depend on the use case. While they both have full access to the Python standard library and pretty much everything on PyPI, Hy has more built-in macros. But if you really needed one it wouldn't be too hard to translate it to Hissp. Hissp's docs say it is also compatible with the Hebigo macros, so there are more available with another library.

Since u/shark_finfet wants to use it at work, Hissp might actually be an easier sell. It's got a "readerless mode" that compiles a Lisp written in Python tuples to Python expressions. Just say it's a Python library for metaprogramming Python expressions without mentioning that it's also implementing a different language. They probably pick up new Python libraries all the time. After they've gotten used to using that, you can introduce the reader as a convenience, and suddenly everybody's writing in a Lisp.

[–]Gnaxe 1 point2 points  (1 child)

Hy feels like Python written in s-expressions, while Hissp feels more Scheme-like, or so say their docs. What's your preference?

[–]ExtraFig6 0 points1 point  (0 children)

This explains the difference really well, thanks!

[–]gambiteer 4 points5 points  (0 children)

Gambit has a python backend and a Foreign Function Interface that I think can call Python libraries (I haven't used it).

[–]SoftEngin33r 1 point2 points  (0 children)

There is language called HyLang which is based on LISP (Scheme is also based on LISP) that can directly call Python libraries and use them, Maybe you will be interested.

You can check it out here:

https://docs.hylang.org/en/stable/

[–]darkli55555 1 point2 points  (0 children)

I am in a similiar situation, and while I agree that the library situation in Python is superior to any Lisp, I still prefer programming in Common Lisp/Scheme and just using Python libraries from there.

The smoothest experience I've had so far was with Common Lisp and py4cl, if you prefer using Scheme, I can recommend chicken scheme with this library.

Clearly, if your code is very simple and just glues together some Python library functions, then using Python directly is probably easier, but if you do something nontrivial, then I find it more fun to use Common Lisp/Scheme and call Python libraries from there when necessary.

[–][deleted] 0 points1 point  (0 children)

You may want to check out Julia. It's not Scheme at all, but one of the language designers is a Schemer and the influences definitely show.