Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Divisible by 3 or 5, in lisp

Name: Anonymous 2007-08-12 17:20 ID:RyfBwU/E

(lambda (n) (or (= 0 (mod n 3)) (= 0 (mod n 5))))

how on earth do you write this in lisp, I mean better than I have here.. surely it must be possible?

Rube Goldberg devices are definitely acceptable if it makes the final code better.. hope you have some ideas /prog/

Name: Anonymous 2007-08-12 23:42 ID:dvYoKBJB

>>6
no shit dude. what you're doing is essentially
(define (f n) (or (not (divisible n 3)) (not (divisible n 5))))

but you use builtin syntax, that's why it looks shorter.

(spoiler: builtin syntax for that stuff is only useful in the rare cases you need to write silly code examples for a prog forum)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List