Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Constants defined n Ravel? 

Last post Thu, Aug 8 2013 12:11 AM by Martin Biehl. 2 replies.
Started by Martin Biehl 07 Aug 2013 10:48 PM. Topic has 2 replies and 576 views
Page 1 of 1 (3 items)
Sort Posts:
  • Wed, Aug 7 2013 10:48 PM

    Constants defined n Ravel? Reply
    Is there a way to define constants in Ravel? I have some numbers that I would like to define in one place for use in the code. They are not constraints so I do not want to define them as such since that would make it possible to change the values.
    • Post Points: 20
  • Thu, Aug 8 2013 12:05 AM

    • Bjoern L
    • Not Ranked
    • Joined on Mon, May 11 2009
    • Feldkirchen, Bavaria
    • Posts 4
    • Points 50
    Re: Constants defined n Ravel? Reply

    Martin,

    You can use macros to define constants. Simply define a macro of no arguments returning the constant value. To retrieve the value, call the macro. Here is an example:

    (macro PI () 3.141593)

    (define edge_circumference
      (transform (e) circular_edge
        (e 2 * (PI) * (radius e))))

     Kind regards, Björn

     

    • Post Points: 20
  • Thu, Aug 8 2013 12:11 AM

    Re: Constants defined n Ravel? Reply

    Thanks Bjoern for your quick reply.

    Kind Regards,

    Martin

    • Post Points: 5
Page 1 of 1 (3 items)
Sort Posts:
Started by Martin Biehl at 07 Aug 2013 10:48 PM. Topic has 2 replies.