rubymotionlisp 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +129 -2
  3. data/lib/rubylisp/atom.rb +25 -6
  4. data/lib/rubylisp/boolean.rb +9 -6
  5. data/lib/rubylisp/builtins.rb +33 -0
  6. data/lib/rubylisp/character.rb +14 -275
  7. data/lib/rubylisp/class_object.rb +56 -0
  8. data/lib/rubylisp/cons_cell.rb +50 -20
  9. data/lib/rubylisp/environment.rb +27 -0
  10. data/lib/rubylisp/environment_frame.rb +24 -6
  11. data/lib/rubylisp/eof_object.rb +26 -0
  12. data/lib/rubylisp/exception.rb +61 -61
  13. data/lib/rubylisp/ext.rb +32 -6
  14. data/lib/rubylisp/ffi_new.rb +2 -1
  15. data/lib/rubylisp/ffi_send.rb +15 -5
  16. data/lib/rubylisp/frame.rb +5 -164
  17. data/lib/rubylisp/function.rb +4 -3
  18. data/lib/rubylisp/macro.rb +13 -8
  19. data/lib/rubylisp/{object.rb → native_object.rb} +0 -15
  20. data/lib/rubylisp/number.rb +5 -0
  21. data/lib/rubylisp/parser.rb +81 -52
  22. data/lib/rubylisp/port.rb +27 -0
  23. data/lib/rubylisp/prim_alist.rb +115 -0
  24. data/lib/rubylisp/prim_assignment.rb +61 -0
  25. data/lib/rubylisp/prim_character.rb +273 -0
  26. data/lib/rubylisp/{ffi_class.rb → prim_class_object.rb} +16 -69
  27. data/lib/rubylisp/prim_environment.rb +203 -0
  28. data/lib/rubylisp/prim_equivalence.rb +93 -0
  29. data/lib/rubylisp/prim_frame.rb +166 -0
  30. data/lib/rubylisp/prim_io.rb +266 -0
  31. data/lib/rubylisp/prim_list_support.rb +496 -0
  32. data/lib/rubylisp/{logical.rb → prim_logical.rb} +9 -14
  33. data/lib/rubylisp/prim_math.rb +397 -0
  34. data/lib/rubylisp/prim_native_object.rb +21 -0
  35. data/lib/rubylisp/prim_relational.rb +42 -0
  36. data/lib/rubylisp/{special_forms.rb → prim_special_forms.rb} +97 -84
  37. data/lib/rubylisp/prim_string.rb +792 -0
  38. data/lib/rubylisp/prim_system.rb +55 -0
  39. data/lib/rubylisp/prim_type_checks.rb +58 -0
  40. data/lib/rubylisp/prim_vector.rb +497 -0
  41. data/lib/rubylisp/primitive.rb +51 -6
  42. data/lib/rubylisp/string.rb +4 -803
  43. data/lib/rubylisp/symbol.rb +0 -1
  44. data/lib/rubylisp/tokenizer.rb +160 -136
  45. data/lib/rubylisp/vector.rb +10 -31
  46. data/lib/rubymotion/debug.rb +40 -0
  47. data/lib/rubymotion/require-fix.rb +1 -0
  48. data/lib/rubymotionlisp.rb +4 -0
  49. metadata +28 -17
  50. data/lib/rubylisp/alist.rb +0 -230
  51. data/lib/rubylisp/assignment.rb +0 -65
  52. data/lib/rubylisp/equivalence.rb +0 -118
  53. data/lib/rubylisp/io.rb +0 -74
  54. data/lib/rubylisp/list_support.rb +0 -526
  55. data/lib/rubylisp/math.rb +0 -405
  56. data/lib/rubylisp/motion_builtins.rb +0 -31
  57. data/lib/rubylisp/relational.rb +0 -46
  58. data/lib/rubylisp/system.rb +0 -20
  59. data/lib/rubylisp/testing.rb +0 -136
  60. data/lib/rubylisp/type_checks.rb +0 -60
@@ -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