2 Replies - 2454 Views - Last Post: 03 June 2012 - 02:02 AM

#1 nacholibre  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 76
  • Joined: 19-September 09

Scheme recursive function help.

Posted 03 May 2012 - 08:38 PM

I have a recursive function i have to emplement with sudo code as such

function( c y)
int x = 4
int y= 5
if z = x return g
if(m = j) return f
for(.....){
i = p
sol<- function( p q)
q = 5
}
return x




All the variables and names i used here are random just to show how the C sudocode looks.
I dont know how to implement this correctly. there is no return in scheme so this recursive call is correctly excuted.
can someone show me how to do this? I am working on AI project and my issue is scheme and not the algo! Due in 1h. thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Scheme recursive function help.

#2 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 644
  • Joined: 03-April 12

Re: Scheme recursive function help.

Posted 03 May 2012 - 09:48 PM

A bit too randomly selected variable names. The algorithm is not undersandable.

Also, for-loop in scheme? Doable, but odd especially with recursive call in the loop.
Was This Post Helpful? 0
  • +
  • -

#3 Tayacan  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 145
  • View blog
  • Posts: 275
  • Joined: 18-January 11

Re: Scheme recursive function help.

Posted 03 June 2012 - 02:02 AM

Your pseudo code doesn't really make sense, as turboscrew said - you pass y as a parameter, then you redefine it to something else, then you try to use the variables z and g that you never defined...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1