Anyone ever program in LISP?

Discussion in 'OT Technology' started by Spiral Out, Mar 30, 2004.

  1. Spiral Out

    Spiral Out Active Member

    Joined:
    Mar 30, 2002
    Messages:
    12,287
    Likes Received:
    0
    Location:
    Florida
    I have a mini project to do in my Comparative Programming class. It is definitely one of the more interesting languauges I have used. You learn recursion real fast...:eek3: :bigthumb:
     
  2. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    i've done some scheme which i understand is a dialect of lisp. god i hated that. give me c any day over that.
     
  3. panzerfaust

    panzerfaust New Member

    Joined:
    Oct 13, 2003
    Messages:
    1,604
    Likes Received:
    0
    Location:
    Far far away
    one more for scheme, what do you need to do?
     
  4. Spiral Out

    Spiral Out Active Member

    Joined:
    Mar 30, 2002
    Messages:
    12,287
    Likes Received:
    0
    Location:
    Florida
    5 functions:
    (last L) 'redefine
    (butlast L) 'redefine
    (palindrome L) 'same forwards and backwards
    (in-to-pre) '(a + b) -> (+ a b)
    (pre-to-in) '(+ a b) -> (a + b)

    So far I have everything except the intopre and pretoin :bigthumb:
     
  5. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    yes, and i was tempting suicide after playing with it.

    i swore to god ill never program in lisp again.

    it brings back horrible memories... :wtc: :wtc:
     
  6. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    Same thing here when I was playing with scheme. It was hell.
     
  7. panzerfaust

    panzerfaust New Member

    Joined:
    Oct 13, 2003
    Messages:
    1,604
    Likes Received:
    0
    Location:
    Far far away
    I'll do the in-to-pre for you however I can't check if it works because I don't have access to my linux box and I don't feel like downloading dr. scheme:
    (define infix-to-prefix
    (lambda (expr)
    (let ((ih infix-to-prefix-helper))
    (ih (map (lambda (x) (if (pair? x) (ih x) x)) expr)))))

    (define infix-to-prefix-helper
    (lambda (expr)
    (if (infix-operator? (cadr expr))
    (cond ((eq? (cadr expr) 'some_weird_operator)
    (append (list 'the_weird_operator (car expr)) (cddr expr)))
    (else
    (append (list (cadr expr) (car expr)) (cddr expr))))
    expr)))


    Note that I haven't done this in a while so the accuracy of this is questionable until tested.
     
  8. Spiral Out

    Spiral Out Active Member

    Joined:
    Mar 30, 2002
    Messages:
    12,287
    Likes Received:
    0
    Location:
    Florida
    Doesn't work. Thanks for trying...
     
  9. panzerfaust

    panzerfaust New Member

    Joined:
    Oct 13, 2003
    Messages:
    1,604
    Likes Received:
    0
    Location:
    Far far away
    what's wrong with it?
     
  10. Spiral Out

    Spiral Out Active Member

    Joined:
    Mar 30, 2002
    Messages:
    12,287
    Likes Received:
    0
    Location:
    Florida
    It doesn't recognize expr and it is defun not define. But thanks for trying...:)
     
  11. panzerfaust

    panzerfaust New Member

    Joined:
    Oct 13, 2003
    Messages:
    1,604
    Likes Received:
    0
    Location:
    Far far away
    Sorry it doesn't work. Apparently lisp is a bit different than Scheme.
     
  12. crotchfruit

    crotchfruit Guest

    i had to write a scheme interpreter in scheme once :eek3:
     
  13. Penguin Man

    Penguin Man Protect Your Digital Liberties

    Joined:
    Apr 27, 2002
    Messages:
    21,696
    Likes Received:
    0
    Location:
    Edmonton, AB
    You poor man... You're lucky you survived :hug:
     
  14. Spiral Out

    Spiral Out Active Member

    Joined:
    Mar 30, 2002
    Messages:
    12,287
    Likes Received:
    0
    Location:
    Florida
    No problem. I think I am going to e-mail the prof about the last two...
     
  15. panzerfaust

    panzerfaust New Member

    Joined:
    Oct 13, 2003
    Messages:
    1,604
    Likes Received:
    0
    Location:
    Far far away
    sounds like CS61A, been there.
     
  16. ChosenGSR

    ChosenGSR Mama always said you'd be the chosen one

    Joined:
    Oct 24, 2001
    Messages:
    50,994
    Likes Received:
    218
    Location:
    HoCo, MD
    I wanted to die when I did list for a few projects.
     
  17. tempus

    tempus Going quietly insane. OT Supporter

    Joined:
    Feb 25, 2004
    Messages:
    1,905
    Likes Received:
    0
    Location:
    Metrowest
    I did a little scheme programming back in college. Can't say I'd ever want to try my hand at it again, though. :p
     

Share This Page