Hard Light Productions Forums

Off-Topic Discussion => General Discussion => Topic started by: Bobboau on January 22, 2008, 03:40:06 am

Title: does anyone here know scheme
Post by: Bobboau on January 22, 2008, 03:40:06 am
I have a class where it is used as the primary language and I'd like someone who is reasonably proficient with it so that I may pester them with mundane questions.
Title: Re: does anyone here know scheme
Post by: TrashMan on January 22, 2008, 07:24:16 am
SCHEME? I remember that one ...faintly..hm.. I might have my scrips lying somewhere...

I just hate it when they make you go trough 20 programing languages really fast... Just when you started to grasp it - BANG - here comes a new one, forget the old one. I know it's just to get understanding on how programing works and how it has evolved, but damn..what's the point in learning a language if I'm gonna forget about it 2 weeks from now.
Title: Re: does anyone here know scheme
Post by: Mika on January 22, 2008, 04:13:05 pm
I know something of a derivative of it. I hate the whole language, but I don't really have choice, so post your mundane questions so we can ponder them together.

Mika
Title: Re: does anyone here know scheme
Post by: Kosh on January 22, 2008, 07:14:04 pm
What class is it used for?
Title: Re: does anyone here know scheme
Post by: WMCoolmon on January 22, 2008, 07:17:02 pm
If you post them here, I'll take a look as well. There's a chance that I may need to take an entire class devoted to LISP. Dunno if I can do much more than offer ideas though.

I've been pestered with mundane questions on LISP before, but the guy didn't know near as much about programming as you do. :p
Title: Re: does anyone here know scheme
Post by: Bobboau on January 22, 2008, 09:41:32 pm
 mundane I mean really basic **** like how are objects represented, if I want to define a (3d) vector class for instance, how would I do that, and how would I access the x, y, and z components?

all the stuff I've seen I see nothing that is immediately parallel to a structure, especially with that dynamic typing going on.
Title: Re: does anyone here know scheme
Post by: Mika on January 23, 2008, 03:41:43 pm
Hi

Regarding vectors and referring to them, I think I know something about that stuff. But patience, I'll reply tomorrow about that since I have to use the laptop provided by the company and not the home computer.

Mika
Title: Re: does anyone here know scheme
Post by: Bobboau on January 23, 2008, 04:41:13 pm
well I didn't mean vectors specifically I meant any sort of structure (also, just to be clear, I was also referring to the 3d point not the resizeable array)
Title: Re: does anyone here know scheme
Post by: Kazan on January 23, 2008, 05:28:56 pm
SCHEME?!  :confused:

SCHEME?!

tell the professor to put the crackpipe down
Title: Re: does anyone here know scheme
Post by: Bobboau on January 23, 2008, 08:08:04 pm
it's a programing languages class, the idea was something along the lines of finding a language that was "interesting".

scheme has some very "interesting" syntax and paradigms.

and I can see it being useful as a small scale scripting language.
Title: Re: does anyone here know scheme
Post by: Mika on January 25, 2008, 10:50:16 am
Here is something I wrote some time ago, I'm not sure if it is exactly the same dialect though. Would it answer some of your questions?

------------------
(do
  ((i -1 (+ i 1)))
  ((= i 359))
  (do:something-clever-here)
  (raytrace:set-direction-vectors (gvector 0 1 0) (gvector 0 0 1))
  (do:something-clever-again)
  (analysis:save-data (string-append "c:/your_stuff_here/file" (number->string
  i) ".txt"))
  (print (string-append "Tilt degree: " (number->string i)))
)
-----------------------------

For vectors, would something like (list 1 2 3 4) do? And then applying list->vector? Though I'm sure there are some better ways than first creating a list object and transferring it to vector. But I recall having had to insert some 150 B-Spline control points into the software, and creating a surface out of that had several steps like control-point-grid->surface. I was pretty amazed that I indeed couldn't delete the control-point-grid after the "surface" was created.

Factorial function
-----------------------------------
(define fact
  (lambda (num) ; This I'm not sure, this could be because of the Scheme dialect I use
     (let ((val 1))
        (do
             ((i num (- i 1)))
             ((= i 0)
        (print val))
        (set! val (* val i))))))

-----------------------------------

Something about vectors:

(define V (vector 0 'a "b" '(a b c)))
;then running V will result in #(0 a "b" (a b c))
;Changing of the vector component
(vector-set! V 3 #\c)
; then running V will result in #(0 a "b" #\c)

(make-vector 3 '#(a "B")) ;running this would result in #(#(a "B") #(a "B")  #(a "B"))

I think I never even tried to do anything with matrices in Scheme.

BTW, does this help at all?

Mika
Title: Re: does anyone here know scheme
Post by: Mika on January 25, 2008, 11:05:43 am
Yeah, personally I hold Scheme as an example of how NOT to construct programming language. Even with the factorial example I had hard time following what it is actually doing. And I also say I so much love the amount of parentheses in the code. The personal favorite error when constructing a program are of course missing parentheses, when that happens the software the code runs usually goes down in a big boom.

Mika