unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* ERROR: Wrong number of arguments to #<procedure ......
@ 2012-07-12  0:30 Simon Huskier
  2012-07-12  1:48 ` Noah Lavine
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Huskier @ 2012-07-12  0:30 UTC (permalink / raw)
  To: guile-user

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

Dear Scheme users:

When I run the following piece of code, I encountered an error:
    *ERROR: Wrong number of arguments to #<procedure lattice->cartesian (x)>
*

;;;; function definition
> (define (eps-func p)
>    (let* ((p (lattice->cartesian))
>              (x (vector3-x p))
>              (y (vector3-y p))
>              (z (vector3-z p)))
> (if (> sin(* 2 pi x y z) 0)
>                 (make dielectric
>                         (epsilon 12))
>                 (make dielectric
>                         (epsilon 1)))))
> ;;;; function call
> (set! default-material (make material-function (material-func eps-func)))


I cannot figure out where it is wrong. The above code is only part of a
control file.

Some background information is as following:

(lattice->cartesian x)
where x is a vector3

vector3 is a datatype defined somewhere

3-vector functions
(vector3 x [y z])
    Create a new 3-vector with the given components. If the y or z value is
omitted, it is set to zero.
(vector3-x v)
(vector3-y v)
(vector3-z v)
Return the corresponding component of the vector v.

material-func [function]
A function of one argument, the position vector3

Thanks in advance.

Regards,

Simon

[-- Attachment #2: Type: text/html, Size: 2835 bytes --]

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

* Re: ERROR: Wrong number of arguments to #<procedure ......
  2012-07-12  0:30 ERROR: Wrong number of arguments to #<procedure Simon Huskier
@ 2012-07-12  1:48 ` Noah Lavine
  2012-07-12  1:51   ` Simon Huskier
  0 siblings, 1 reply; 3+ messages in thread
From: Noah Lavine @ 2012-07-12  1:48 UTC (permalink / raw)
  To: Simon Huskier; +Cc: guile-user

The error you are writing about is right here:

>> ;;;; function definition
>> (define (eps-func p)
>>    (let* ((p (lattice->cartesian)) <------
>>              (x (vector3-x p))
>>              (y (vector3-y p))
>>              (z (vector3-z p)))
>> (if (> sin(* 2 pi x y z) 0)
>>                 (make dielectric
>>                         (epsilon 12))
>>                 (make dielectric
>>                         (epsilon 1)))))

You call the function lattice->cartesian there with no arguments, but
it expects one argument.

Noah

> Regards,
>
> Simon



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

* Re: ERROR: Wrong number of arguments to #<procedure ......
  2012-07-12  1:48 ` Noah Lavine
@ 2012-07-12  1:51   ` Simon Huskier
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Huskier @ 2012-07-12  1:51 UTC (permalink / raw)
  To: Noah Lavine; +Cc: guile-user

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

Thanks Noah. Thank you all of you!

Jay Sulzberger suggest the following change, and it makes sense to me.
*
*

> ;;;; function definition
>
>> (define (eps-func p)
>>    (let* ((p (lattice->cartesian))
>>
>
Perhaps above should be

* (let* ((p (lattice->cartesian p)) *

Regards,

Simon

On Thu, Jul 12, 2012 at 9:48 AM, Noah Lavine <noah.b.lavine@gmail.com>wrote:

> The error you are writing about is right here:
>
> >> ;;;; function definition
> >> (define (eps-func p)
> >>    (let* ((p (lattice->cartesian)) <------
> >>              (x (vector3-x p))
> >>              (y (vector3-y p))
> >>              (z (vector3-z p)))
> >> (if (> sin(* 2 pi x y z) 0)
> >>                 (make dielectric
> >>                         (epsilon 12))
> >>                 (make dielectric
> >>                         (epsilon 1)))))
>
> You call the function lattice->cartesian there with no arguments, but
> it expects one argument.
>
> Noah
>
> > Regards,
> >
> > Simon
>

[-- Attachment #2: Type: text/html, Size: 3096 bytes --]

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

end of thread, other threads:[~2012-07-12  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-12  0:30 ERROR: Wrong number of arguments to #<procedure Simon Huskier
2012-07-12  1:48 ` Noah Lavine
2012-07-12  1:51   ` Simon Huskier

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).