Hacker News new | past | comments | ask | show | jobs | submit login
Scheme.forth.jl: Scheme in Forth in Julia (github.com/tgvaughan)
91 points by lelf on April 9, 2020 | hide | past | favorite | 14 comments



To really go through the rabbit hole, I wonder if one could then use this as Julia's parser, which itself is written in Femtolisp (a scheme).


You'd almost have a quine relay: https://github.com/mame/quine-relay


Wow, that is impressively insane!


Seems like you could use this to build a chain of platforms for the hell of it.

Prolog in Elixir in Python in Scheme...


There's a good start on a list-expression evaluator here: https://norvig.com/lispy.html

I followed that introduction to start hacking on my first compiler (in an interpreted language with no system calls or any concept of variable scoping). I think I got to implementing an AST before I quit. When I do it again I'll be using a different language (probably Gambit/Gerbil if I can find time to learn them).

Makes me wonder why python is so much easier for me than Gambit? I think it might just be the sheer volume of SE posts, tutorials, and documentation...


Would be a fun data science project: given the READMEs of all github projects, find the longest chain of programming language implementations without (close) duplicates.

Prove that it is a valid chain by actually running all compilers.

Bonus points for less common languages such as SNOBOL and Mumps, or languages rarely reimplemented and/or rarely used for writing compilers such as TI-59 or Lotus-123 macro language.


I sure thought that there was a name, somewhere between quine (https://en.wikipedia.org/wiki/Quine_(computing) ) and polyglot (https://en.wikipedia.org/wiki/Polyglot_(computing) ), for this: a program in one language that, when run, outputs a program in another language that etc. I can't find the name or a good example (other than the parent post!), though.


You're going to have a hell of a time implementing elixir in python.


It’d be a lot harder to implement Python in Elixir!


Would it? The basics of the language are at least easy, you might have trouble when python drops into it's ffi. Same holds in the reverse; you can't easily do elixir ffi in python.

FFI aside, I don't see a good way of implementing Kernel.spawn/1, Process.monitor/1, etc. in python, without rebuilding the entire erlang VM from scratch.


It’s a lot easier to implement an immutable language in a mutable one than vice versa, or so I’d assume, never having tried.

But yeah, I’d assume you’d have to build the VM first. A lot of work.


You can mock mutable variables in actors. Actors and genservers are a first class module in the standard library. Elixir is not Haskell. There are plenty of places with accessible statefulness/mutability, it's just shielded in a functional wrapper and made slightly difficult to dissuade you from using statefulness unnecessarily, so you make fewer coding and concurrency mistakes in annoying places and you can focus on delivering features and solving hard problems.


Was gonna try it, but it failed to install the forth.jl package. Then I went and looked at the forth.jl github page and it says:

> Be aware that forth.jl requires Julia 1.0

Whereas on the scheme.forth.jl page it said:

> (forth.jl requires version >=1.0)

At any rate it doesn't install in Julia 1.4.0:

> ERROR: could not find project file in package at https://github.com/tgvaughan/forth.jl


I'm loving all these little projects embedding languages in Julia.




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

Search: