rubymotionlisp 0.2.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +129 -2
- data/lib/rubylisp/atom.rb +25 -6
- data/lib/rubylisp/boolean.rb +9 -6
- data/lib/rubylisp/builtins.rb +33 -0
- data/lib/rubylisp/character.rb +14 -275
- data/lib/rubylisp/class_object.rb +56 -0
- data/lib/rubylisp/cons_cell.rb +50 -20
- data/lib/rubylisp/environment.rb +27 -0
- data/lib/rubylisp/environment_frame.rb +24 -6
- data/lib/rubylisp/eof_object.rb +26 -0
- data/lib/rubylisp/exception.rb +61 -61
- data/lib/rubylisp/ext.rb +32 -6
- data/lib/rubylisp/ffi_new.rb +2 -1
- data/lib/rubylisp/ffi_send.rb +15 -5
- data/lib/rubylisp/frame.rb +5 -164
- data/lib/rubylisp/function.rb +4 -3
- data/lib/rubylisp/macro.rb +13 -8
- data/lib/rubylisp/{object.rb → native_object.rb} +0 -15
- data/lib/rubylisp/number.rb +5 -0
- data/lib/rubylisp/parser.rb +81 -52
- data/lib/rubylisp/port.rb +27 -0
- data/lib/rubylisp/prim_alist.rb +115 -0
- data/lib/rubylisp/prim_assignment.rb +61 -0
- data/lib/rubylisp/prim_character.rb +273 -0
- data/lib/rubylisp/{ffi_class.rb → prim_class_object.rb} +16 -69
- data/lib/rubylisp/prim_environment.rb +203 -0
- data/lib/rubylisp/prim_equivalence.rb +93 -0
- data/lib/rubylisp/prim_frame.rb +166 -0
- data/lib/rubylisp/prim_io.rb +266 -0
- data/lib/rubylisp/prim_list_support.rb +496 -0
- data/lib/rubylisp/{logical.rb → prim_logical.rb} +9 -14
- data/lib/rubylisp/prim_math.rb +397 -0
- data/lib/rubylisp/prim_native_object.rb +21 -0
- data/lib/rubylisp/prim_relational.rb +42 -0
- data/lib/rubylisp/{special_forms.rb → prim_special_forms.rb} +97 -84
- data/lib/rubylisp/prim_string.rb +792 -0
- data/lib/rubylisp/prim_system.rb +55 -0
- data/lib/rubylisp/prim_type_checks.rb +58 -0
- data/lib/rubylisp/prim_vector.rb +497 -0
- data/lib/rubylisp/primitive.rb +51 -6
- data/lib/rubylisp/string.rb +4 -803
- data/lib/rubylisp/symbol.rb +0 -1
- data/lib/rubylisp/tokenizer.rb +160 -136
- data/lib/rubylisp/vector.rb +10 -31
- data/lib/rubymotion/debug.rb +40 -0
- data/lib/rubymotion/require-fix.rb +1 -0
- data/lib/rubymotionlisp.rb +4 -0
- metadata +28 -17
- data/lib/rubylisp/alist.rb +0 -230
- data/lib/rubylisp/assignment.rb +0 -65
- data/lib/rubylisp/equivalence.rb +0 -118
- data/lib/rubylisp/io.rb +0 -74
- data/lib/rubylisp/list_support.rb +0 -526
- data/lib/rubylisp/math.rb +0 -405
- data/lib/rubylisp/motion_builtins.rb +0 -31
- data/lib/rubylisp/relational.rb +0 -46
- data/lib/rubylisp/system.rb +0 -20
- data/lib/rubylisp/testing.rb +0 -136
- data/lib/rubylisp/type_checks.rb +0 -60
data/lib/rubylisp/type_checks.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
module Lisp
|
2
|
-
|
3
|
-
class TypeChecks
|
4
|
-
|
5
|
-
def self.register
|
6
|
-
Primitive.register("list?") {|args, env| Lisp::TypeChecks::typep_impl("list?", :pair, args, env) }
|
7
|
-
Primitive.register("pair?") {|args, env| Lisp::TypeChecks::typep_impl("pair?", :pair, args, env) }
|
8
|
-
Primitive.register("symbol?") {|args, env| Lisp::TypeChecks::typep_impl("symbol?", :symbol, args, env) }
|
9
|
-
Primitive.register("number?") {|args, env| Lisp::TypeChecks::typep_impl("number?", :number, args, env) }
|
10
|
-
Primitive.register("integer?") {|args, env| Lisp::TypeChecks::integerp_impl(args, env) }
|
11
|
-
Primitive.register("float?") {|args, env| Lisp::TypeChecks::floatp_impl(args, env) }
|
12
|
-
Primitive.register("function?") {|args, env| Lisp::TypeChecks::functionp_impl(args, env) }
|
13
|
-
|
14
|
-
Primitive.register("nil?") {|args, env| Lisp::TypeChecks::nilp_impl(args, env) }
|
15
|
-
Primitive.register("null?") {|args, env| Lisp::TypeChecks::nilp_impl(args, env) }
|
16
|
-
Primitive.register("not-nil?") {|args, env| Lisp::TypeChecks::not_nilp_impl(args, env) }
|
17
|
-
Primitive.register("not-null?") {|args, env| Lisp::TypeChecks::not_nilp_impl(args, env) }
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
def self.typep_impl(name, sym, args, env)
|
22
|
-
return Lisp::Debug.process_error("#{name} needs 1 argument", env) unless args.length == 1
|
23
|
-
return Lisp::Boolean.with_value(args.car.evaluate(env).type == sym)
|
24
|
-
end
|
25
|
-
|
26
|
-
|
27
|
-
def self.integerp_impl(args, env)
|
28
|
-
return Lisp::Debug.process_error("integer? needs 1 argument", env) unless args.length == 1
|
29
|
-
val = args.car.evaluate(env)
|
30
|
-
return Lisp::Boolean.with_value(val.type == :number && val.integer?)
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
def self.floatp_impl(args, env)
|
35
|
-
return Lisp::Debug.process_error("float? needs 1 argument", env) unless args.length == 1
|
36
|
-
val = args.car.evaluate(env)
|
37
|
-
return Lisp::Boolean.with_value(val.type == :number && val.float?)
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
def self.functionp_impl(args, env)
|
42
|
-
return Lisp::Debug.process_error("function? needs 1 argument", env) unless args.length == 1
|
43
|
-
val = args.car.evaluate(env)
|
44
|
-
return Lisp::Boolean.with_value(val.type == :function || val.type == :primitive)
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def self.nilp_impl(args, env)
|
49
|
-
return Lisp::Debug.process_error("nil? needs 1 argument", env) unless args.length == 1
|
50
|
-
return Lisp::Boolean.with_value(args.car.evaluate(env).nil?)
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
def self.not_nilp_impl(args, env)
|
55
|
-
return Lisp::Debug.process_error("not-nil? needs 1 argument", env) unless args.length == 1
|
56
|
-
return Lisp::Boolean.with_value(!args.car.evaluate(env).nil?)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|