lunes, 13 de octubre de 2014

My first post on Racket

In my eternal quest for weird programming languages...I came out finding Racket...which is basically the new name of "PLT-Scheme"...from the Lisp family...

Racket can be installed on Windows, Mac and it's pretty cool -:) And also comes with a nice IDE called DrRacket...

I gotta say...Racket is like nothing I have ever seen before...that's why I love it -:D

And here comes the most weird thing of all...Racket is...
  • Functional
  • Procedural
  • Modular
  • Object-Oriented
  • Logical
  • Reflective
  • Meta

Crazy, huh? Right now I'm reading an awesome book called "Realm of Racket"...

And after reading the first 61 pages ( more) I was able to translate my Fibonacci Haskell app into here goes the code...

#lang racket
(define (showFib num)
  (fib num 0 1))

(define (fib num a b)
  ( cond [(and (> a 0) (> num 1)) (append (cons (+ a b) '()) (fib (sub1 num) (+ a b) a))]
         [(= a 0) (append (append (cons a (cons b '())) (cons (+ a b) '())) (fib(sub1 num)(+ a b) b))]
         [(= 1 num) (append '())]))

Now...if we run it...we're going to see this...

Cool, huh? Works just as expected -:) Couldn't be happier -;)


Development Culture.

No hay comentarios: