LISP support?

(Dr. Gareth S. Bestor) #1

Hurrah! Finally, someone else who knows LISP! :tada: Alas, I fear you'll find we are an endangered species these days (especially around here! haha), but I cant wait to see some LISP-based ODK tooling :grin:

Introduce yourself here!
(James) #2

You're not alone. There are a few of us old farts around who know lisp...although in my case I haven't used it in 15 years or more so it's more accurate to say "knew".

(Dr. Gareth S. Bestor) #3

I believe the world would probably be a better place if we solved all our problems recursively... :slight_smile:

(James) #4

I think we already are!....but the stack limit is set too restrictive so gives the behavior of repeating the same mistakes again and again. Perhaps we should request the UN to allocate more memory and increase the stack limit.

(Narendra) #5

I do agree with @jvp And @Xiphware. And after seeing your post i feel you both are magician... For me.


(Hélène Martin) #6

Don't you make all your calls tail recursive and/or have an interpreter with tail call optimization?! :wink:

In a past life, I taught high schoolers functional programming concepts in Scheme (Lisp dialect) and they really enjoyed it (course page for the curious)! And I've also taught algebra in Racket (Scheme-derived) to middle schoolers with the excellent Bootstrap curriculum. So it's not dead yet. :blush:

(Dr. Gareth S. Bestor) #7

Cool!!! :+1: I likewise taught a course around Scheme, at Vassar. Its pretty awesome to teach functional programming to a bunch of open minds that haven't yet been utterly indoctrinated with the procedural programming paradigm, eh! :slight_smile: Alas, these days it seems to be all about teaching the latest flavor-of-the-month website programming language (for which I've yet to see any make extensive use of recursive function calls... sigh).

OK guys (and gals), and in the spirit of The Big Bang Theory... I'll buy a beer for the first person who responds explaining what x actually does!

(defun x (e l)
        ((null l) (cons e '()))
        (t (cons (car l) (x e (cdr l))))

[and no cheating using lisp-online ]

hehe :sunglasses:

(James) #8

Unfortunately I'm living in Africa right now and all I get is "invalid option" when I try tail recursion. Perhaps the government hasn't invented that yet here. :wink:

(James) #9

One of the coolest things I learned in college was functional programming (scheme, fp and lisp) which served as a pathway toward parallel and distributed computing. It felt so freeing and opened up new ways of thinking about (and optimizing) computations. It felt like when you go from 2D to 3D, or from B&W to color. Suddenly new possibilities exist where before you couldn't see them.

Now, to your lisp problem, I nearly sprained my brain looking at this one. It's been so long! It looks to me like it's concatenating lists e and l?

(Dr. Gareth S. Bestor) #10

Close, but no cigar. So the beer is still up for grabs folks! :slight_smile:

Hint, from CAR and CDR:

the expression (car (cons x y)) evaluates to x, and (cdr (cons x y)) evaluates to y... the car operation returns the first element of the list, while cdr returns the rest of the list.

(James) #11

I just want to confirm that I haven't given up on that beer, or the new found cigar that you mentioned. :wink: I'll come back to this but have been swamped with farmer payment and insurance issues at the end of this season and then will be able to really dust the cobwebs off and make a run at the frosty beverage competition.