Thread: Scheme

  1. #16
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Yeah is it just due to my blind dedication to C++, or is Scheme...ugly?
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  2. #17
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    It takes some getting used to, but it can be surprisingly easy to work with compared to C syntax. There's relatively little syntax in Scheme compared to C++, so it's good to learn as a beginner's functional language.

  3. #18
    Registered User
    Join Date
    Nov 2005
    Posts
    36
    Scheme is not my favorite language i prefer C or Java...

  4. #19
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Scheme syntax is much more readable than C syntax. It doesn't help (a) that he didn't use code tags, and (b) if you don't use Scheme much.

    (local [(define myvar 0)]
    This doesn't look like Scheme to me. At least it isn't revision 5. What is this from?

  5. #20
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    This is correct syntax in DrScheme, which is what I've been using for the past term. There's probably a few differences from the standard, I'll admit.

  6. #21
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I worked with Common Lisp for a bit, but I couldn't befriend the syntax - although I have to admit, it's a very powerful language.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  7. #22
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,212
    Yeah is it just due to my blind dedication to C++, or is Scheme...ugly?
    scheme looks better in code tags and with a bracket matching editor such as DrScheme

    Code:
    (define (nested-reverse l)
      (cond 
        ((null? l) '())
        ((list? (car l)) (append (nested-reverse (cdr l))
                           (list (nested-reverse (car l)))))
        (else (append (nested-reverse (cdr l)) (list (car l))))))
    This snippet reverses a list recursively. For instance,
    Code:
    (nested-reverse '(a b (c d (e f) (g h) i) j k))
    would return
    (k j (i (h g) (f e) d c) b a)

  8. #23
    aoeuhtns
    Join Date
    Jul 2005
    Posts
    581
    Quote Originally Posted by JaWiB
    Yeah is it just due to my blind dedication to C++, or is Scheme...ugly?
    If you don't like the syntax of Scheme, you could always try Haskell. It has order of operations and infix operators (gasp!). The most beautiful language out there, if you ask me.

    Factorial function definition:
    Code:
    factorial 0 = 1
    factorial n = n * factorial (n - 1)
    Of course, you get to stomach things like infinite-length lists. An infinite-length list of numbers 1,2,3,...

    Code:
    positives = repeatup 1
        where repeatup n = n : repeatup (n + 1)

  9. #24
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Scheme and Haskell are quite different. Scheme is still fundamentally an imperative language, although it has quite a few functional elements. Haskell is a pure functional language. It requires a different mindset to program in.

    And why so complicated on the 1,2,3... thing?
    Code:
    positives = [1..]
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help w/inheritance scheme
    By dudeomanodude in forum C++ Programming
    Replies: 10
    Last Post: 11-30-2008, 12:53 PM
  2. Apple's music protection scheme is hacked
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-27-2006, 04:33 PM
  3. Naming Scheme...
    By SgtMuffles in forum Windows Programming
    Replies: 6
    Last Post: 06-13-2006, 10:45 PM
  4. ping pong buffering scheme
    By cblix in forum Tech Board
    Replies: 0
    Last Post: 11-23-2005, 05:26 PM
  5. Post your IDE scheme!
    By nickname_changed in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 05-09-2005, 05:47 AM