gregspurrier / shen-ruby Goto Github PK
View Code? Open in Web Editor NEWShenRuby is a port of the Shen programming language to Ruby
License: Other
ShenRuby is a port of the Shen programming language to Ruby
License: Other
The or
and and
functions should support partial application. When partially applied, they move into the realm of normal functions and no longer short-circuit their evaluation.
This is the behavior in the SBCL port:
(0-) ((or) true (do (print "evaluated") true))
"evaluated"true
This the is current, erroneous behavior in ShenRuby:
(0-) ((or) true (do (print "evaluated") true))
or expects 2 arguments but was given 0
It appears that ShenRuby::Shen.new
enters an infinite loop when running under Rubinius 2.0.0 head.
Shen, copyright (C) 2010-2015 Mark Tarver
www.shenlanguage.org, Shen 17
running under Ruby, implementation: ruby 2.2.0
port 0.13.0 ported by Greg Spurrier
(0-) (defcc <a> a := [/.];)
undefined method `hd' for nil:NilClass
This works in both the SBCL and chibi-scheme ports. The latter is important because, like ShenRuby, chibi-shen raises an error when hd
is applied to the empty list. This suggests this is a ShenRuby bug rather than a case of Shen accidentally relying on (hd [])
returning []
as it does in the CL ports.
Using JRuby 1.7.2 and master as of commit a642f9b, ShenRuby::Shen.new
fails with java.lang.ArrayIndexOutOfBoundsException
while loading declarations.kl.
The failure occurs while evaluating the shen-initialise_arity_table
expression.
Using the v0.1.0 code, the same exception is encountered while executing the chapter 11: (load "binary.shen")
test case. Therefore I do not thinks this problem is introduced by the changes since v0.1.0, but rather that the characteristics of the code have changed in such a way that the same problem manifests itself in a different situation.
Using Shen 15 and Ruby 2.0.0 the test in interpreter.shen fails with the following message:
Qi interpreter - chapter 13: (tc +) = true
run time: 4.0531158447265625e-06 secs
passed
Qi interpreter - chapter 13: (load "interpreter.shen") = loaded
type#num : symbol
type#primitive_object : symbol
type#pattern : symbol
type#l_formula : symbol
l_interpreter : (A --> B)
read_eval_print_loop : (string --> A)
normal_form : (l_formula --> l_formula)
failed with error maximum stack depth exceeded
Qi interpreter - chapter 13: (tc -) = false
run time: 1.0013580322265625e-05 secs
passed
passed ... 111
failed ...1
pass rate ...99.10714285714286%
Reported on the Qilang Google group:
I just tried it but I am getting an error:
$ srrepl
Loading.../usr/lib/ruby/gems/1.9.1/gems/shen-ruby-0.1.0/lib/kl/cons.rb:32: stack level too deep (SystemStackError)
I am testing under cygwin, is that a problem?
The type of quit should be declared so that it works properly when type checking is enabled.
Shen 2010, copyright (C) 2010 Mark Tarver
www.shenlanguage.org, version 8
running under Ruby, implementation: ruby 1.9.3
port 0.3.1 ported by Greg Spurrier
(0-) (tc +)
true
(1+) (quit)
type error
This isn't an issue but a suggestion for the next version. How would you feel about coercing Ruby Arrays to vectors instead of cons lists? This way the length attribute can be preserved and to me it seems like a more intuitive mapping.
From the qilang Google group:
Hi Greg,
As you specified on the webpage https://github.com/gregspurrier/shen-ruby the shen environment can be extended with functions written in Ruby. This functionality turned out to be quite useful. For example in "Ruby Program 2" in https://groups.google.com/forum/#!msg/qilang/aOdyQQJYR5w/3Ep-K7k37ZUJ I used the Ruby modulo function in a Shen program in order to achieve speedup. In the example in https://groups.google.com/forum/#!msg/qilang/lFWmNMQydD0/thpnLIrvA_MJ I used the Ruby "rand" function from within Shen (since Shen does not have its own random number generator).
My question is whether it is possible to use the wrapped Ruby functions from within the srrepl? If not, would it be possible to allow these wrapped functions to be accessible from within the Repl, please? Thanks.
This could be a good bridge between no Shen->Ruby interop and full support. Perhaps via eval-ruby and/or load-ruby functions.
This is the expected behavior as seen in Shen 7.1 under CLisp:
(0-) ((/. X Y (+ X Y)) 1 2 3)
oops
This is the behavior of ShenRuby 0.1.0:
(0-) (trap-error ((/. X Y (+ X Y)) 1 2 3) (/. _ oops))
Ruby exception: undefined method `arity' for 3:Fixnum
This situation should instead raise an instance of Kl::Error
so that trap-error
can catch it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.