0 Replies - 1188 Views - Last Post: 26 September 2009 - 09:36 AM

#1 Jaakuuta   User is offline

  • D.I.C Head
  • member icon

Reputation: 1
  • View blog
  • Posts: 163
  • Joined: 02-July 09

[Scheme] Quadratic Expression Combinator

Posted 26 September 2009 - 09:36 AM

Description: Requires the following combinators: Partial Application Combinator Composition Combinator Fork Combinator Substitute the variables a, b, and c with whatever coefficients are actually used in the expression.This combinator will generate a quadratic expression of the form ax^2 + bx + c without using any bound variables.
;f(x) = ax^2 + bx + c
(define f
  (compose (par + c)
    (fork +
      (par * b)
      (compose (par * a) square)
    );end fork
  );end compose
);end define


Is This A Good Question/Topic? 0
  • +

Page 1 of 1