nendo 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,21 +96,43 @@
96
96
  (bench-task #f
97
97
  "for-each 10000 (nendo version)"
98
98
  (for-each
99
- (lambda (x) x)
99
+ (lambda (x) (+ 1 x))
100
100
  list10000))
101
101
 
102
102
  (bench-task #f
103
- "map 10000 (nendo version)"
103
+ "map 10000 (nendo version)"
104
104
  (map
105
- (lambda (x) x)
105
+ (lambda (x) (+ 1 x))
106
106
  list10000))
107
107
 
108
108
  (bench-task #f
109
- "filter 10000 (nendo version)"
109
+ "filter 10000 (nendo version)"
110
110
  (filter
111
111
  (lambda (x) (if (< x 100) x false))
112
112
  list10000)))
113
113
 
114
-
114
+ ;; ------------- higher-order for vector ----------------
115
+
116
+ (use nendo.experimental)
117
+
118
+ (let ([vec10000 (to-arr (range 10000)]])
119
+ (bench-task #f
120
+ "for-each vector 10000 (nendo version)"
121
+ (for-each
122
+ (lambda (x) (+ 1 x))
123
+ vec10000))
124
+
125
+ (bench-task #f
126
+ "map vector 10000 (nendo version)"
127
+ (map
128
+ (lambda (x) (+ 1 x))
129
+ vec10000))
130
+
131
+ (bench-task #f
132
+ "filter vector 10000 (nendo version)"
133
+ (filter
134
+ (lambda (x) (if (< x 100) x false))
135
+ vec10000))
136
+ )
115
137
 
116
138
  ;;[EOF]
@@ -4,17 +4,20 @@
4
4
  #
5
5
 
6
6
  trampCall(
7
- delayCall( '_require', 'require',
8
- begin
9
- if @global_lisp_binding.has_key?('_require') then
10
- trampCall(@_require)
11
- else raise NameError.new( "Error: undefined variable _require", "_require" ) end
12
- rescue => __e ; __e.set_backtrace( ["./lib/debug/syslog.nnd:37"] + __e.backtrace ) ; raise __e
13
- end ,
14
- [
15
- "syslog"
16
- ]
17
- )
7
+ begin
8
+ embedBacktraceInfo( "./lib/debug/syslog.nnd", 37 );
9
+ delayCall( '_require', 'require',
10
+ begin
11
+ if @global_lisp_binding.has_key?('_require') then
12
+ trampCall(@_require)
13
+ else raise NameError.new( "Error: undefined variable _require", "_require" ) end
14
+ rescue => __e ; __e.set_backtrace( ["./lib/debug/syslog.nnd:37"] + __e.backtrace ) ; raise __e
15
+ end ,
16
+ [
17
+ "syslog"
18
+ ]
19
+ )
20
+ end
18
21
  )
19
22
  #--------------------
20
23
 
@@ -37,13 +40,16 @@ trampCall(
37
40
  rescue => __e ; __e.set_backtrace( ["./lib/debug/syslog.nnd:41"] + __e.backtrace ) ; raise __e
38
41
  end ,
39
42
  "%s" ,
40
- __PLMARK_ARGS2(
41
- "Nendo: " ,
42
- begin
43
- trampCall(_str)
44
- rescue => __e ; __e.set_backtrace( ["./lib/debug/syslog.nnd:41"] + __e.backtrace ) ; raise __e
45
- end
46
- )
43
+ begin
44
+ embedBacktraceInfo( "./lib/debug/syslog.nnd", 41 );
45
+ __PLMARK_ARGS2(
46
+ "Nendo: " ,
47
+ begin
48
+ trampCall(_str)
49
+ rescue => __e ; __e.set_backtrace( ["./lib/debug/syslog.nnd:41"] + __e.backtrace ) ; raise __e
50
+ end
51
+ )
52
+ end
47
53
  )
48
54
  rescue => __e ; __e.set_backtrace( ["./lib/debug/syslog.nnd:41"] + __e.backtrace ) ; raise __e
49
55
  end
data/lib/init.nnd CHANGED
@@ -519,7 +519,7 @@
519
519
  (append cdrs (list cdr1))))))
520
520
 
521
521
 
522
- (define (%map proc . lists)
522
+ (define (%map-original proc . lists)
523
523
  (letrec ((result '())
524
524
  (%map-arg1
525
525
  (lambda (proc lst)
@@ -545,7 +545,8 @@
545
545
  (cons (apply proc cars)
546
546
  (if (null? cdrs)
547
547
  '()
548
- (apply %map (cons proc cdrs)))))))))))
548
+ (apply %map-original (cons proc cdrs)))))))))))
549
+ (define %map %map-original)
549
550
 
550
551
  (define (%internal-define-to-letrec _sym _src)
551
552
  (if (not (list? (cadr _src)))
@@ -580,7 +581,7 @@
580
581
  `(,_sym ,@_src))))))))
581
582
 
582
583
 
583
- (define (%for-each proc . lists)
584
+ (define (%for-each-original proc . lists)
584
585
  (define (%for-each-arg1 proc lst)
585
586
  (if (null? lst)
586
587
  #t
@@ -601,9 +602,10 @@
601
602
  (apply proc cars)
602
603
  (if (null? cdrs)
603
604
  '()
604
- (apply %for-each (cons proc cdrs)))))))))
605
+ (apply %for-each-original (cons proc cdrs)))))))))
606
+ (define %for-each %for-each-original)
605
607
 
606
- (define (%filter pred lst)
608
+ (define (%filter-original pred lst)
607
609
  (define result '())
608
610
  (define (%filter-arg1 proc lst)
609
611
  (if (null? lst)
@@ -615,6 +617,7 @@
615
617
 
616
618
  (%filter-arg1 pred lst) ;; tail call optimization version
617
619
  (reverse result))
620
+ (define %filter %filter-original)
618
621
 
619
622
  (define (%filter-map pred lst)
620
623
  (define result '())
@@ -1201,29 +1204,6 @@
1201
1204
  ;; ----------------------------------------
1202
1205
  ;; Nendo compiler utility
1203
1206
  ;; ----------------------------------------
1204
- (define (disasm varname . opt)
1205
- (let ((kind (get-optional opt 'compiled))
1206
- (alist (get-source-info (varname.to_s))))
1207
- (cond
1208
- ((eqv? kind 'compiled)
1209
- (assv-ref "compiled_str" alist))
1210
- ((eqv? kind 'source)
1211
- (assv-ref "source" alist))
1212
- ((eqv? kind 'expanded)
1213
- (assv-ref "expanded" alist))
1214
- ((eqv? kind 'info)
1215
- (string-join
1216
- (list
1217
- (sprintf " file: %s \n" (assv-ref "sourcefile" alist))
1218
- (sprintf " lineno: %s \n" (assv-ref "lineno" alist))
1219
- (sprintf " source: \n" )
1220
- (pretty-print-to-string
1221
- (assv-ref "source" alist))
1222
- (sprintf " expanded: \n" )
1223
- (pretty-print-to-string
1224
- (assv-ref "expanded" alist))))))))
1225
-
1226
-
1227
1207
  (define (compiled-code-string compiled-code filename)
1228
1208
  (define (compiled-body-string string-list filename)
1229
1209
  (+
@@ -1708,4 +1688,8 @@
1708
1688
 
1709
1689
  (define-syntax %syntax-rules syntax-rules)
1710
1690
 
1691
+
1692
+ (use nendo.experimental)
1693
+
1694
+
1711
1695
  ;;[EOS]