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.

Best,
@iamnarendrasingh


(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)
    (cond 
        ((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.


(Dr. Gareth S. Bestor) #12

With the arrival of a brand spankin' new 2019 year, the 1st Annual ODK Name-That-Function Competition must regrettably draw to a close. Our expert panel of judges (moi) has carefully reviewed all submitted entries (all 1 of them...:roll_eyes:), but unfortunately none of those received were entirely correct. After careful deliberation behind closed doors [during which time the principal prize was consumed], the panel has decided to award the closest received entry, that of @jvp, a consolation prize of a gift card, good for 1 beer, redeemable at the Tui Brewery in Mangatainoka. This prize is good for 10 years and may be redeemed at any time, subject to prior notice of redemption of 2 working days.

For reference, the closest submitted 'winning' entry was:

concatenating lists e and l

The official correct answer is:

appending element e to end of list l

Have a happy new 2019 year! And look out for the 2nd Annual ODK Name-That-Function Competition... :wink:


(James) #13

YES!!!! I WON!!!!

I knew the Ph.D. would eventually pay off. I can't believe it's taken me 25 years to finally find value from lisp (other than emacs configuration, of course).

I'm looking forward to meeting you at Tui. I need more "kiwi tooker for my puku"...whatever that means. Sheesh, I barely won the lisp competition (even though I was competing only against myself!), and now you want me to learn speak New Zealander!?! I think that warrants a second beer!


(Dr. Gareth S. Bestor) #14

after about 8 or 9 beers it'll come naturally... :wink:


(James) #15

Brilliant! Why didn't I think of that when I was learning swahili? I need you as a life mentor... :grin: