Module: Nendo::BuiltinFunctions
- Included in:
- Evaluator
- Defined in:
- lib/nendo.rb
Overview
built-in functions
Instance Method Summary collapse
- #__ASMARK(*args) ⇒ Object
- #__ASMARKFILE_ASMARK ⇒ Object
- #__ASMARKLINE_ASMARK ⇒ Object
- #__assertFlat(*args) ⇒ Object
- #__assertList(funcname, arg) ⇒ Object
- #__EQMARK(a, b) ⇒ Object
- #__GTMARK(a, b) ⇒ Object
- #__GTMARK_EQMARK(a, b) ⇒ Object
- #__LTMARK(a, b) ⇒ Object
- #__LTMARK_EQMARK(a, b) ⇒ Object
- #__MIMARK(first, *rest) ⇒ Object
- #__PAMARK(first, *rest) ⇒ Object
- #__PAMARKlist_QUMARK(arg) ⇒ Object
- #__PLMARK(*args) ⇒ Object
- #__SLMARK(first, *rest) ⇒ Object
- #_apply1(first, arg) ⇒ Object
- #_car(cell) ⇒ Object
- #_cdr(cell) ⇒ Object
- #_cons(first, second) ⇒ Object
- #_core_MIMARKsyntax_QUMARK(arg) ⇒ Object
- #_display(arg) ⇒ Object
- #_eq_QUMARK(a, b) ⇒ Object
- #_equal_QUMARK(a, b) ⇒ Object
- #_eqv_QUMARK(a, b) ⇒ Object
- #_exit(*args) ⇒ Object
- #_ge_QUMARK(a, b) ⇒ Object
- #_global_MIMARKvariables ⇒ Object
- #_gt_QUMARK(a, b) ⇒ Object
- #_hash_MIMARKtable_MIMARKexist_QUMARK(h, key) ⇒ Object
- #_hash_MIMARKtable_MIMARKget(h, key, *args) ⇒ Object
- #_hash_MIMARKtable_MIMARKput_EXMARK(h, key, value) ⇒ Object
- #_integer_QUMARK(arg) ⇒ Object
- #_intern(arg) ⇒ Object
- #_keyword_MIMARK_GTMARKstring(arg) ⇒ Object
- #_keyword_QUMARK(arg) ⇒ Object
- #_le_QUMARK(a, b) ⇒ Object
- #_length(arg) ⇒ Object
- #_list(*args) ⇒ Object
- #_lt_QUMARK(a, b) ⇒ Object
- #_macro_QUMARK(arg) ⇒ Object
- #_macroexpand_MIMARK1(arg) ⇒ Object
- #_make_MIMARKkeyword(arg) ⇒ Object
- #_make_MIMARKvalues(lst) ⇒ Object
- #_modulo(first, *rest) ⇒ Object
- #_newline ⇒ Object
- #_nil_QUMARK(arg) ⇒ Object
- #_not(arg) ⇒ Object
- #_null_QUMARK(arg) ⇒ Object
- #_number_QUMARK(arg) ⇒ Object
- #_pair_QUMARK(arg) ⇒ Object
- #_print(arg) ⇒ Object
- #_printf(format, *rest) ⇒ Object
- #_procedure_QUMARK(arg) ⇒ Object
- #_quotient(first, second) ⇒ Object
-
#_raise(exception, message, backtrace) ⇒ Object
backtrace expects this format “filename:lineno: place message ”.
- #_range(num, *args) ⇒ Object
- #_read(*args) ⇒ Object
- #_read_MIMARKfrom_MIMARKstring(str) ⇒ Object
- #_remainder(first, second) ⇒ Object
- #_require(arg) ⇒ Object
- #_reverse(arg) ⇒ Object
- #_set_MIMARKcar_EXMARK(cell, arg) ⇒ Object
- #_set_MIMARKcdr_EXMARK(cell, arg) ⇒ Object
- #_sprintf(format, *rest) ⇒ Object
- #_string_MIMARK_GTMARKsymbol(arg) ⇒ Object
- #_string_MIMARKjoin(lst, *args) ⇒ Object
- #_string_QUMARK(arg) ⇒ Object
- #_symbol_MIMARK_GTMARKstring(arg) ⇒ Object
- #_symbol_QUMARK(arg) ⇒ Object
- #_syntax_QUMARK(arg) ⇒ Object
- #_to_arr(arg) ⇒ Object
- #_to_i(arg) ⇒ Object
- #_to_list(arg) ⇒ Object
- #_to_MIMARKarr(arg) ⇒ Object
- #_to_MIMARKi(arg) ⇒ Object
- #_to_MIMARKlist(arg) ⇒ Object
- #_to_MIMARKs(arg) ⇒ Object
- #_to_s(arg) ⇒ Object
- #_uniq(arg) ⇒ Object
- #_values_MIMARKvalues(arg) ⇒ Object
- #_values_QUMARK(arg) ⇒ Object
- #_vector_MIMARKset_EXMARK(v, index, value) ⇒ Object
- #_write(arg) ⇒ Object
- #_write_MIMARKto_MIMARKstring(arg) ⇒ Object
Instance Method Details
#__ASMARK(*args) ⇒ Object
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
# File 'lib/nendo.rb', line 869 def __ASMARK( *args ) arr = args[0].to_arr case args[0].length when 0 1 else __assertFlat( arr ) arr.each { |x| if not _number_QUMARK(x) raise TypeError end } case args[0].length when 1 args[0].car else arr[1..-1].inject(arr[0]){|x,y| x*y} end end end |
#__ASMARKFILE_ASMARK ⇒ Object
1246 1247 1248 |
# File 'lib/nendo.rb', line 1246 def __ASMARKFILE_ASMARK() @lastSourcefile end |
#__ASMARKLINE_ASMARK ⇒ Object
1242 1243 1244 |
# File 'lib/nendo.rb', line 1242 def __ASMARKLINE_ASMARK() @lastLineno end |
#__assertFlat(*args) ⇒ Object
815 816 817 818 819 820 821 822 823 824 825 |
# File 'lib/nendo.rb', line 815 def __assertFlat( *args ) if 0 == args.length raise ArgumentError, "Error: + - * / % operator got illegal argument. " else args.each { |x| if Cell == x.class or Nil == x.class raise ArgumentError, "Error: + - * / % operator got illegal argument. " end } end end |
#__assertList(funcname, arg) ⇒ Object
827 828 829 830 831 |
# File 'lib/nendo.rb', line 827 def __assertList( funcname, arg ) if Cell != arg.class raise ArgumentError, "Error: %s expects a list argument.\n" end end |
#__EQMARK(a, b) ⇒ Object
1036 |
# File 'lib/nendo.rb', line 1036 def __EQMARK( a,b ) a == b end |
#__GTMARK(a, b) ⇒ Object
1037 |
# File 'lib/nendo.rb', line 1037 def __GTMARK( a,b ) a > b end |
#__GTMARK_EQMARK(a, b) ⇒ Object
1038 |
# File 'lib/nendo.rb', line 1038 def __GTMARK_EQMARK( a,b ) a >= b end |
#__LTMARK(a, b) ⇒ Object
1039 |
# File 'lib/nendo.rb', line 1039 def __LTMARK( a,b ) a < b end |
#__LTMARK_EQMARK(a, b) ⇒ Object
1040 |
# File 'lib/nendo.rb', line 1040 def __LTMARK_EQMARK( a,b ) a <= b end |
#__MIMARK(first, *rest) ⇒ Object
890 891 892 893 894 895 896 897 898 899 |
# File 'lib/nendo.rb', line 890 def __MIMARK( first, *rest ) raise TypeError if not _number_QUMARK(first) rest = rest[0].to_arr __assertFlat( rest ) if 0 == rest.length - first else rest.inject(first){|x,y| x-y} end end |
#__PAMARK(first, *rest) ⇒ Object
912 913 914 |
# File 'lib/nendo.rb', line 912 def __PAMARK( first, *rest ) _modulo( first, *rest ) end |
#__PAMARKlist_QUMARK(arg) ⇒ Object
1073 1074 1075 1076 1077 1078 1079 |
# File 'lib/nendo.rb', line 1073 def __PAMARKlist_QUMARK( arg ) if _pair_QUMARK( arg ) (not arg.lastAtom) and (1 <= arg.to_arr.size) # it means proper list? else _null_QUMARK( arg ) end end |
#__PLMARK(*args) ⇒ Object
847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 |
# File 'lib/nendo.rb', line 847 def __PLMARK( *args ) arr = args[0].to_arr case args[0].length when 0 0 else __assertFlat( arr ) arr.each { |x| if not (_number_QUMARK(x) or _string_QUMARK(x)) ##arr.each { |v| STDERR.printf( "__PLMARK: %s\n", v ) } raise TypeError, sprintf( "Error: arg %s is [%s] type",x ,x.class ) end } case args[0].length when 1 args[0].car else arr[1..-1].inject(arr[0]){|x,y| x+y} end end end |
#__SLMARK(first, *rest) ⇒ Object
901 902 903 904 905 906 907 908 909 910 |
# File 'lib/nendo.rb', line 901 def __SLMARK( first, *rest ) raise TypeError if not _number_QUMARK(first) rest = rest[0].to_arr __assertFlat( rest ) if 0 == rest.length 1 / first else rest.inject(first){|x,y| x/y} end end |
#_apply1(first, arg) ⇒ Object
1167 1168 1169 |
# File 'lib/nendo.rb', line 1167 def _apply1( first, arg ) trampCall( callProcedure( "(apply1 genereate func)", first, arg.to_arr )) end |
#_car(cell) ⇒ Object
1047 |
# File 'lib/nendo.rb', line 1047 def _car( cell ) cell.car end |
#_cdr(cell) ⇒ Object
1048 |
# File 'lib/nendo.rb', line 1048 def _cdr( cell ) cell.cdr end |
#_cons(first, second) ⇒ Object
944 945 946 947 948 949 950 951 952 953 954 955 956 957 |
# File 'lib/nendo.rb', line 944 def _cons( first, second ) if first.is_a? Nil first = Cell.new end if second.is_a? Cell if second.isNull Cell.new( first ) else Cell.new( first, second ) end else Cell.new( first, second ) end end |
#_core_MIMARKsyntax_QUMARK(arg) ⇒ Object
1059 1060 1061 1062 1063 1064 1065 |
# File 'lib/nendo.rb', line 1059 def _core_MIMARKsyntax_QUMARK( arg ) if arg.is_a? LispCoreSyntax arg.syntaxName else nil end end |
#_display(arg) ⇒ Object
1051 |
# File 'lib/nendo.rb', line 1051 def _display( arg ) printer = Printer.new ; print printer._print( arg ) ; arg end |
#_eq_QUMARK(a, b) ⇒ Object
1041 |
# File 'lib/nendo.rb', line 1041 def _eq_QUMARK( a,b ) a == b end |
#_equal_QUMARK(a, b) ⇒ Object
833 834 835 836 837 838 839 840 841 842 843 844 845 |
# File 'lib/nendo.rb', line 833 def _equal_QUMARK( a, b ) if a.is_a? String and b.is_a? String a === b elsif _null_QUMARK( a ) and _null_QUMARK( b ) true elsif a.class != b.class false elsif a.class == Cell _equal_QUMARK( a.car, b.car ) and _equal_QUMARK( a.cdr, b.cdr ) else (a === b) end end |
#_eqv_QUMARK(a, b) ⇒ Object
1046 |
# File 'lib/nendo.rb', line 1046 def _eqv_QUMARK( a,b ) a === b end |
#_exit(*args) ⇒ Object
982 983 984 985 986 987 988 989 |
# File 'lib/nendo.rb', line 982 def _exit( *args ) if 0 == args[0].length Kernel::exit(0) else arr = args[0].to_arr Kernel::exit(arr[0]) end end |
#_ge_QUMARK(a, b) ⇒ Object
1043 |
# File 'lib/nendo.rb', line 1043 def _ge_QUMARK( a,b ) a >= b end |
#_global_MIMARKvariables ⇒ Object
1171 1172 1173 1174 1175 1176 1177 |
# File 'lib/nendo.rb', line 1171 def _global_MIMARKvariables self.instance_variables.select { |x| x.match( /^[@]_[_a-zA-Z]/ ) }.map{ |name| self.toLispSymbol( name[1..-1] ).intern }.to_list end |
#_gt_QUMARK(a, b) ⇒ Object
1042 |
# File 'lib/nendo.rb', line 1042 def _gt_QUMARK( a,b ) a > b end |
#_hash_MIMARKtable_MIMARKexist_QUMARK(h, key) ⇒ Object
1232 1233 1234 1235 |
# File 'lib/nendo.rb', line 1232 def _hash_MIMARKtable_MIMARKexist_QUMARK( h, key ) # don't use h.has_key(k), because has_key method undefined on some database bindings. (e.g. KyotoCabinet) h[key] ? true : false end |
#_hash_MIMARKtable_MIMARKget(h, key, *args) ⇒ Object
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 |
# File 'lib/nendo.rb', line 1215 def _hash_MIMARKtable_MIMARKget( h, key, *args ) if h.has_key?(key) h[key] else arr = args[0].to_arr if 0 < arr.length arr[0] else raise RuntimeError, sprintf( "Error: in hash-table-get() key [%s] was not exist.\n", key ) end end end |
#_hash_MIMARKtable_MIMARKput_EXMARK(h, key, value) ⇒ Object
1228 1229 1230 |
# File 'lib/nendo.rb', line 1228 def _hash_MIMARKtable_MIMARKput_EXMARK( h, key, value ) h[key] = value end |
#_integer_QUMARK(arg) ⇒ Object
1080 |
# File 'lib/nendo.rb', line 1080 def _integer_QUMARK( arg ) arg.is_a? Integer end |
#_intern(arg) ⇒ Object
1118 |
# File 'lib/nendo.rb', line 1118 def _intern( arg ) arg.intern end |
#_keyword_MIMARK_GTMARKstring(arg) ⇒ Object
1207 1208 1209 1210 1211 1212 1213 |
# File 'lib/nendo.rb', line 1207 def _keyword_MIMARK_GTMARKstring( arg ) if _keyword_QUMARK( arg ) arg.key.to_s else raise TypeError, "Error: keyword->string expects only keyword object." end end |
#_keyword_QUMARK(arg) ⇒ Object
1057 |
# File 'lib/nendo.rb', line 1057 def _keyword_QUMARK( arg ) (arg.is_a? LispKeyword) end |
#_le_QUMARK(a, b) ⇒ Object
1045 |
# File 'lib/nendo.rb', line 1045 def _le_QUMARK( a,b ) a <= b end |
#_length(arg) ⇒ Object
1012 1013 1014 1015 1016 1017 1018 1019 1020 |
# File 'lib/nendo.rb', line 1012 def _length( arg ) if _null_QUMARK( arg ) 0 elsif arg.is_a? Cell arg.length else raise TypeError end end |
#_list(*args) ⇒ Object
1021 |
# File 'lib/nendo.rb', line 1021 def _list( *args) args[0] end |
#_lt_QUMARK(a, b) ⇒ Object
1044 |
# File 'lib/nendo.rb', line 1044 def _lt_QUMARK( a,b ) a < b end |
#_macro_QUMARK(arg) ⇒ Object
1055 |
# File 'lib/nendo.rb', line 1055 def _macro_QUMARK( arg ) (LispMacro == arg.class) end |
#_macroexpand_MIMARK1(arg) ⇒ Object
1083 1084 1085 1086 1087 1088 1089 1090 |
# File 'lib/nendo.rb', line 1083 def ( arg ) if _pair_QUMARK( arg ) ( 1 ) ( arg ) else arg end end |
#_make_MIMARKkeyword(arg) ⇒ Object
1199 1200 1201 1202 1203 1204 1205 |
# File 'lib/nendo.rb', line 1199 def _make_MIMARKkeyword( arg ) if _symbol_QUMARK( arg ) or _string_QUMARK( arg ) LispKeyword.new( arg.to_s ) else raise TypeError, "Error: make-keyword expects symbol or string object." end end |
#_make_MIMARKvalues(lst) ⇒ Object
1179 1180 1181 1182 1183 1184 1185 1186 1187 |
# File 'lib/nendo.rb', line 1179 def _make_MIMARKvalues( lst ) if _pair_QUMARK( lst ) LispValues.new( lst.to_arr ) elsif _null_QUMARK( lst ) LispValues.new( [] ) else raise ArgumentError, "Error: make-values expects a list argument." end end |
#_modulo(first, *rest) ⇒ Object
928 929 930 931 932 933 934 935 936 937 |
# File 'lib/nendo.rb', line 928 def _modulo( first, *rest ) raise TypeError if not _number_QUMARK(first) rest = rest[0].to_arr __assertFlat( rest ) if 0 == rest.length 1 % first else rest.inject(first){|x,y| x%y} end end |
#_newline ⇒ Object
1053 |
# File 'lib/nendo.rb', line 1053 def _newline( ) print "\n" end |
#_nil_QUMARK(arg) ⇒ Object
1095 |
# File 'lib/nendo.rb', line 1095 def _nil_QUMARK( arg ) arg.nil? end |
#_not(arg) ⇒ Object
939 940 941 942 |
# File 'lib/nendo.rb', line 939 def _not( arg ) arg = false if Nil == arg.class not arg end |
#_null_QUMARK(arg) ⇒ Object
1003 1004 1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/nendo.rb', line 1003 def _null_QUMARK( arg ) if Nil == arg.class true elsif Cell == arg.class arg.isNull else false end end |
#_number_QUMARK(arg) ⇒ Object
1081 |
# File 'lib/nendo.rb', line 1081 def _number_QUMARK( arg ) arg.is_a? Numeric end |
#_pair_QUMARK(arg) ⇒ Object
1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/nendo.rb', line 1066 def _pair_QUMARK( arg ) if _null_QUMARK( arg ) false else (Cell == arg.class) end end |
#_print(arg) ⇒ Object
991 992 993 |
# File 'lib/nendo.rb', line 991 def _print( format, *rest ) print( format, *(rest[0].to_arr) ) end |
#_printf(format, *rest) ⇒ Object
995 996 997 |
# File 'lib/nendo.rb', line 995 def _printf( format, *rest ) Kernel::printf( format, *(rest[0].to_arr) ) end |
#_procedure_QUMARK(arg) ⇒ Object
1054 |
# File 'lib/nendo.rb', line 1054 def _procedure_QUMARK( arg ) ((Proc == arg.class) or (Method == arg.class)) end |
#_quotient(first, second) ⇒ Object
916 917 918 919 920 |
# File 'lib/nendo.rb', line 916 def _quotient( first, second ) raise TypeError if not _number_QUMARK(first) raise TypeError if not _number_QUMARK(second) (first / second.to_f).to_i end |
#_raise(exception, message, backtrace) ⇒ Object
backtrace expects this format “filename:lineno: place message ”. e.g. “init.nnd:10: in aaa macro.”.
1238 1239 1240 |
# File 'lib/nendo.rb', line 1238 def _raise( exception, , backtrace ) raise exception, , [ backtrace ] end |
#_range(num, *args) ⇒ Object
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 |
# File 'lib/nendo.rb', line 1024 def _range( num, *args ) arr = args[0].to_arr if 0 < arr.length if arr[0].is_a? Fixnum (0..num-1).to_a.map { |x| x + arr[0] }.to_list else raise TypeError, "Error range's start expects number." end else (0..num-1).to_a.to_list end end |
#_read(*args) ⇒ Object
1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 |
# File 'lib/nendo.rb', line 1147 def _read( *args ) lst = args[0].to_arr io = if 0 == lst.length STDIN else lst[0] end reader = Reader.new( io, "STDIN", false ) ret = nil begin s = reader._read ret = s[0] if s[1] # EOF? ret = Cell.new break end end until s[2] ret end |
#_read_MIMARKfrom_MIMARKstring(str) ⇒ Object
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 |
# File 'lib/nendo.rb', line 1137 def _read_MIMARKfrom_MIMARKstring( str ) if not str.is_a? String raise TypeError, "Error: read-from-string expects sexp as String." else sio = StringIO.open( str ) reader = Reader.new( sio, "(string)", false ) s = reader._read s[0] end end |
#_remainder(first, second) ⇒ Object
922 923 924 925 926 |
# File 'lib/nendo.rb', line 922 def _remainder( first, second ) raise TypeError if not _number_QUMARK(first) raise TypeError if not _number_QUMARK(second) first - _quotient( first, second ) * second end |
#_require(arg) ⇒ Object
1133 1134 1135 1136 |
# File 'lib/nendo.rb', line 1133 def _require( arg ) require( arg ) false end |
#_reverse(arg) ⇒ Object
1022 |
# File 'lib/nendo.rb', line 1022 def _reverse( arg ) arg.to_arr.reverse.to_list end |
#_set_MIMARKcar_EXMARK(cell, arg) ⇒ Object
959 960 961 962 963 964 965 966 |
# File 'lib/nendo.rb', line 959 def _set_MIMARKcar_EXMARK( cell, arg ) if cell.is_a? Cell cell.car = arg cell else raise TypeError end end |
#_set_MIMARKcdr_EXMARK(cell, arg) ⇒ Object
968 969 970 971 972 973 974 975 976 977 978 979 980 |
# File 'lib/nendo.rb', line 968 def _set_MIMARKcdr_EXMARK( cell, arg ) arg = if arg.is_a? Cell _null_QUMARK( arg ) ? Nil.new : arg else arg end if cell.is_a? Cell cell.cdr = arg cell else raise TypeError end end |
#_sprintf(format, *rest) ⇒ Object
999 1000 1001 |
# File 'lib/nendo.rb', line 999 def _sprintf( format, *rest ) Kernel::sprintf( format, *(rest[0].to_arr) ) end |
#_string_MIMARK_GTMARKsymbol(arg) ⇒ Object
1119 |
# File 'lib/nendo.rb', line 1119 def _string_MIMARK_GTMARKsymbol( arg ) arg.intern end |
#_string_MIMARKjoin(lst, *args) ⇒ Object
1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 |
# File 'lib/nendo.rb', line 1121 def _string_MIMARKjoin( lst, *args ) arr = args[0].to_arr if 0 < arr.length if not arr[0].is_a? String raise TypeError, "Error: string-join's expects delimitter as String." else lst.to_a.map{ |x| x.car }.join( arr[0] ) end else lst.to_a.map{ |x| x.car }.join end end |
#_string_QUMARK(arg) ⇒ Object
1082 |
# File 'lib/nendo.rb', line 1082 def _string_QUMARK( arg ) arg.is_a? String end |
#_symbol_MIMARK_GTMARKstring(arg) ⇒ Object
1120 |
# File 'lib/nendo.rb', line 1120 def _symbol_MIMARK_GTMARKstring( arg ) arg.to_s end |
#_symbol_QUMARK(arg) ⇒ Object
1056 |
# File 'lib/nendo.rb', line 1056 def _symbol_QUMARK( arg ) (Symbol == arg.class) end |
#_syntax_QUMARK(arg) ⇒ Object
1058 |
# File 'lib/nendo.rb', line 1058 def _syntax_QUMARK( arg ) (arg.is_a? LispSyntax) end |
#_to_arr(arg) ⇒ Object
1107 |
# File 'lib/nendo.rb', line 1107 def _to_arr( arg ) _to_MIMARKarr( arg ) end |
#_to_i(arg) ⇒ Object
1093 |
# File 'lib/nendo.rb', line 1093 def _to_i( arg ) _to_MIMARKi( arg ) end |
#_to_list(arg) ⇒ Object
1096 |
# File 'lib/nendo.rb', line 1096 def _to_list( arg ) _to_MIMARKlist( arg ) end |
#_to_MIMARKarr(arg) ⇒ Object
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 |
# File 'lib/nendo.rb', line 1108 def _to_MIMARKarr( arg ) case arg when Cell arg.to_arr when Array arg else raise TypeError end end |
#_to_MIMARKi(arg) ⇒ Object
1094 |
# File 'lib/nendo.rb', line 1094 def _to_MIMARKi( arg ) arg.to_i end |
#_to_MIMARKlist(arg) ⇒ Object
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 |
# File 'lib/nendo.rb', line 1097 def _to_MIMARKlist( arg ) case arg when Array arg.to_list when Cell arg else raise TypeError end end |
#_to_MIMARKs(arg) ⇒ Object
1092 |
# File 'lib/nendo.rb', line 1092 def _to_MIMARKs( arg ) arg.to_s end |
#_to_s(arg) ⇒ Object
1091 |
# File 'lib/nendo.rb', line 1091 def _to_s( arg ) _to_MIMARKs( arg ) end |
#_uniq(arg) ⇒ Object
1023 |
# File 'lib/nendo.rb', line 1023 def _uniq( arg ) arg.to_arr.uniq.to_list end |
#_values_MIMARKvalues(arg) ⇒ Object
1191 1192 1193 1194 1195 1196 1197 |
# File 'lib/nendo.rb', line 1191 def _values_MIMARKvalues( arg ) if _values_QUMARK( arg ) arg.values.to_list else raise TypeError, "Error: values-values expects only LispValues object." end end |
#_values_QUMARK(arg) ⇒ Object
1189 |
# File 'lib/nendo.rb', line 1189 def _values_QUMARK( arg ) arg.is_a? LispValues end |
#_vector_MIMARKset_EXMARK(v, index, value) ⇒ Object
1250 1251 1252 1253 1254 1255 1256 1257 1258 |
# File 'lib/nendo.rb', line 1250 def _vector_MIMARKset_EXMARK( v, index, value ) if !(v.is_a? Array) raise TypeError, "Error: vector-set! requires Array as argument v(Lisp's vector).\n" end if (index < 0) or (v.size <= index) raise ArgumentError, "Error: vector-set! requires index between 0 and (size-1) number.\n" end v[index] = value end |