Skip to content

Instantly share code, notes, and snippets.

@leque
Created April 30, 2012 06:29
Show Gist options
  • Save leque/2555991 to your computer and use it in GitHub Desktop.
Save leque/2555991 to your computer and use it in GitHub Desktop.
BiwaScheme で (values 1) == 1 になるようにする
diff --git a/src/library/r6rs_lib.js b/src/library/r6rs_lib.js
index 2d738b4..ecdfc42 100644
--- a/src/library/r6rs_lib.js
+++ b/src/library/r6rs_lib.js
@@ -1216,16 +1216,19 @@ if( typeof(BiwaScheme)!='object' ) BiwaScheme={}; with(BiwaScheme) {
x.cdr);
})
define_libfunc("values", 0, null, function(ar){
- return new Values(ar);
+ if (ar.length == 1)
+ return ar[0]
+ else
+ return new Values(ar);
})
define_libfunc("call-with-values", 2, 2, function(ar){
var producer = ar[0], consumer = ar[1];
return new Call(producer, [], function(ar){
var values = ar[0];
if(!(values instanceof Values))
- throw new Error("values expected, but got "+to_write(values));
-
- return new Call(consumer, values.content);
+ return new Call(consumer, [values]);
+ else
+ return new Call(consumer, values.content);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment