Welcome to Funny Games

Play top FREE games daily
Register Now

Scheme Query

Discussion in 'Programming Room' started by gwarhammer, Jan 1, 2009.

  1. gwarhammer

    gwarhammer Cpt on the Ship of Fools

    I realise that a lot of people will probably be against use of shceme in general, but I like it, so:

    Is anyone able to tell me how, in Scheme ( I use the R5RS version of scheme, PLT in Windows, scm in linux, if it helps), can I create a function that will accept an unspecified number of parameters? For example, a function that could be binary, such as (* 2 3) or more, (* 2 3 4 5 ...) (I think that is still valid Scheme)? I've tried reading through the relevant chapter in SICP, but it didn't help much.

  2. Nollog

    Nollog n00b

    What "Scheme" is is escaping me...

    It seems to be a programming language though, so the easiest way would be to take in just one parameter, and split it up with a string splitter if you know the format of each part.
    For example, using your binary example you would split the one parameter into groups of single characters.
  3. gwarhammer

    gwarhammer Cpt on the Ship of Fools

    It's a derivative of Lisp and (I think) Pascal or C. Something like that, anyway.

    The closest way Scheme lets you do that, at least in the educational version we got taught with, is by passing it as a list, and then having a function to loop over it recursively passing (cdr list) as the next input or using (set-car! '()), which just looks horrible.
    I know it can be done, I just haven't worked out how. But thanks anyway.
  4. tobbySept

    tobbySept n00b

    Hi at forums.funny-games.biz review

    Excellent site forums.funny-games.biz and I am really pleased to see you have what I am actually looking for here and this this post is exactly what I am interested in. It's taken me literally 2 hours and 55 minutes of searching the web to find you (just kidding!) so I shall be pleased to become a regular visitor :)

Share This Page