unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* (apply make-vector '(1 2 3))
@ 2006-09-10 23:15 Marius Vollmer
  2006-09-11  1:35 ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Vollmer @ 2006-09-10 23:15 UTC (permalink / raw)


Hi,

(just for the record, I am going to fix this myself if nobody beats me
to it.)

    guile> (make-vector 1 2 3)
    ABORT: (wrong-number-of-args)

but

    guile> (apply make-vector '(1 2 3))
    #(2)

This doesn't happen for Scheme functions, probably only for (certain
types of) primitives.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: (apply make-vector '(1 2 3))
  2006-09-10 23:15 (apply make-vector '(1 2 3)) Marius Vollmer
@ 2006-09-11  1:35 ` Kevin Ryde
  2006-10-02 20:08   ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2006-09-11  1:35 UTC (permalink / raw)
  Cc: bug-guile

Marius Vollmer <mvo@zagadka.de> writes:
>
> This doesn't happen for Scheme functions, probably only for (certain
> types of) primitives.

Slackness in the scm_tc7_subr_2o case of scm_apply perhaps (looking
only at null or not null for the list of args).


_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: (apply make-vector '(1 2 3))
  2006-09-11  1:35 ` Kevin Ryde
@ 2006-10-02 20:08   ` Kevin Ryde
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Ryde @ 2006-10-02 20:08 UTC (permalink / raw)
  Cc: bug-guile

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

The case of no args was also not caught (passed through to the 2o
func).  I made this change,

        * eval.c (SCM_APPLY): For scm_tc7_subr_2o, throw wrong-num-args on 0
        arguments or 3 or more arguments.  Previously 0 called proc with
        SCM_UNDEFINED, and 3 or more silently used just the first 2.


[-- Attachment #2: eval.c.apply_2o.diff --]
[-- Type: text/plain, Size: 672 bytes --]

--- eval.c.~1.405.2.5.~	2006-07-21 10:22:22.000000000 +1000
+++ eval.c	2006-10-02 12:18:26.000000000 +1000
@@ -4849,7 +4849,16 @@
   switch (SCM_TYP7 (proc))
     {
     case scm_tc7_subr_2o:
-      args = scm_is_null (args) ? SCM_UNDEFINED : SCM_CAR (args);
+      if (SCM_UNBNDP (arg1))
+	scm_wrong_num_args (proc);
+      if (scm_is_null (args))
+        args = SCM_UNDEFINED;
+      else
+        {
+          if (! scm_is_null (SCM_CDR (args)))
+            scm_wrong_num_args (proc);
+          args = SCM_CAR (args);
+        }
       RETURN (SCM_SUBRF (proc) (arg1, args));
     case scm_tc7_subr_2:
       if (scm_is_null (args) || !scm_is_null (SCM_CDR (args)))

[-- Attachment #3: Type: text/plain, Size: 137 bytes --]

_______________________________________________
Bug-guile mailing list
Bug-guile@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-guile

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-10-02 20:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-10 23:15 (apply make-vector '(1 2 3)) Marius Vollmer
2006-09-11  1:35 ` Kevin Ryde
2006-10-02 20:08   ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).