Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ ¹ ² ³ °
 

You are not logged in. #1 20121220 06:15:16
LispTo start a little Lisp discussion, here are two functions I wrote: Code:(defun fibonacci (n) (labels ((fib (n f) (if (or (zerop n) (eq n 1)) (car f) (fib ( n 1) (cons (+ (first f) (second f)) f )) ))) (fib ( n 2) (1 1))) ) (defun ints (n) (labels ((f (n acc) (if (zerop n) acc (f ( n 1) (cons n acc)) ))) (f n nil)) ) The first one is for calculating the nth Fibonacci number, and the second for generating a list of the first n positive integers. Code:(mapcar #'fibonacci (ints 20)) Last edited by anonimnystefy (20121220 07:40:07) The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #2 20121220 20:37:36
Re: LispAnyone have an idea on what I could do next? The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #4 20121220 21:12:41
Re: LispNot yet. I could learn that, though... The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #6 20121220 21:42:43
Re: LispHow do I even start any work on graphics with Lisp? The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #7 20121220 22:02:52
Re: LispOur friend Mr Google will give you plenty of hits. Lisp programmers seem to be pretty generous with their code/ideas. You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei #8 20121220 22:04:24
Re: LispI tried Googling, but none of the things I tried worked... The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #10 20121221 06:20:17
Re: LispI use SBCL for CLisp. The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #11 20121221 11:33:33
Re: LispHi Bob The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #12 20121221 14:52:57
Re: Lisphi Stefy You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei #13 20121221 20:02:41
Re: LispHi Bob The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #14 20121222 10:23:52
Re: LispHi Bob The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #16 20121222 23:37:22
Re: LispHi Bob Code:(defun mandelbrot (size filename) (let ((img (make8bitgrayimage size size))) (declare (type 8bitgrayimage img)) (loop for i from 1 to (1 size) do (loop for j from 1 to (1 size) do ;these two loops go through all pixels of the image (labels ((mbset (x y nit) ;nit is the number of the iteration (if (or (> (+ (* x x) (* y y)) 2) (> nit 1000)) ;this bit of code checks if the modulo of z is >2 (setf (pixel img i j) (round(/ 255.0 (1+ nit)))) ;if it is, this bit sets the current pixel to the appropriate shade of grey (mbset (+ ( (* x x) (* y y)) (/ ( j (round (/ size 2.0))) 50.0)) (+ (* 2 x y) (/ ( j (round (/ size 2.0))) 50.0)) (1+ nit)) ;if not, this bit sends new information into the next iteration ) )) (mbset 0.0 0.0 0) ) ) ) (writejpegfile filename img) ) ) but it produces the picture below... Last edited by anonimnystefy (20121223 01:09:52) The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #17 20121223 00:31:27
Re: LispOk. A common mistake which you can easily fix: You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei #18 20121223 01:05:55
Re: LispHi Bob The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #19 20121223 01:07:55
Re: LispSorry. Was just about to reedit that load of rubbish.
I see no i in that line. You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei #20 20121223 01:16:29
Re: LispBob, you are brilliant! The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #21 20121223 02:21:08
Re: LispThat's a great fractal. Well done! You cannot teach a man anything; you can only help him find it within himself..........Galileo Galilei #22 20121223 02:34:47
Re: LispI am going with (i) first. The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment #23 20130518 14:21:56
Re: LispWould you give a link to download your compiler? Last edited by Agnishom (20130518 14:27:05) 'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.' 'God exists because Mathematics is consistent, and the devil exists because we cannot prove it' 'Who are you to judge everything?' Alokananda #24 20131115 23:24:04
Re: LispHi stefy; 'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.' 'God exists because Mathematics is consistent, and the devil exists because we cannot prove it' 'Who are you to judge everything?' Alokananda #25 20131116 05:12:09
Re: LispWell, I never learned it much, so I cannot say for sure, but what I used for learning was the book On Lisp which covers the basics. Just Google "onlisp.pdf". The limit operator is just an excuse for doing something you know you can't. “It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman “Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment 