<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>elisp &#8211; Diary of an Emacs tragic</title>
	<atom:link href="https://emacstragic.net/tag/elisp/feed/" rel="self" type="application/rss+xml" />
	<link>https://emacstragic.net</link>
	<description>Jason Lewis</description>
	<lastBuildDate>Sun, 24 Mar 2013 11:18:10 +0000</lastBuildDate>
	<language>en-AU</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://emacstragic.net/wp-content/uploads/2018/12/cropped-jason-lewis-profile-picture-square-150x150.jpg</url>
	<title>elisp &#8211; Diary of an Emacs tragic</title>
	<link>https://emacstragic.net</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">38469313</site>	<item>
		<title>Project Euler No. 2 in Emacs elisp</title>
		<link>https://emacstragic.net/uncategorized/project-euler-no-2-in-emacs-elisp/</link>
					<comments>https://emacstragic.net/uncategorized/project-euler-no-2-in-emacs-elisp/#respond</comments>
		
		<dc:creator><![CDATA[Jason]]></dc:creator>
		<pubDate>Sun, 24 Mar 2013 11:18:10 +0000</pubDate>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[elisp]]></category>
		<category><![CDATA[Project Euler]]></category>
		<guid isPermaLink="false">http://emacstragic.net/?p=755</guid>

					<description><![CDATA[My second Project Euler solution. Project Euler No. 2 This was a little tougher to solve than No. 1. I decided to use recursion to solve it, and as I haven&#8217;t had to write anything that used recursion since I was at Uni, it took me a while go remember how to do it. Also, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>My second Project Euler solution.<br />
<a href="http://projecteuler.net/problem=2" title="Project Euler No. 2 - Even Fibonacci Numbers">Project Euler No. 2</a><br />
This was a little tougher to solve than No. 1. I decided to use recursion to solve it, and as I haven&#8217;t had to write anything that used recursion since I was at Uni, it took me a while go remember how to do it. Also, it was an elisp learning exercise.<br />
Things I learnt:</p>
<ol>
<li>successive statements inside an if statement need to be inside a progn.</li>
<li>passing in the evens variable was the way to solve this without needing a static variable. Thanks to spacebat for that one. Apparently that is the functional programming way of doing things.</li>
</ol>
<pre lang=lisp>
;; Project Euler no 2. Calculate the sum of all even terms in the
;; fibonacci sequence of numbers that do not exceed 4,000,000
(defun fibonacci (x y)
  "calculate the next number in the fibonacci sequenece"
  (+ x y))
(defun fibonacci-sum  (fib1 fib2 target &optional evens)
  "find the next fibonacci number bigger than target, given fib1 and fib2"
  (unless evens
    (setq evens 0))
  (let ((fib3 (fibonacci fib1 fib2 ))
        )
    (if (<=  fib3 target)
        (progn (if (zerop (mod fib3 2))
                   (setq evens (+ fib3 evens)))
               (message (format "fib3 is: %d, evens: %d" fib3 evens))
               (setq fib3  (fibonacci-sum fib2 fib3 target evens)))
      (format "fib3: %d > %d target, evens = %d" fib3 target evens)
      )
    )
  )
(fibonacci-sum 0 1 4000000)
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://emacstragic.net/uncategorized/project-euler-no-2-in-emacs-elisp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">755</post-id>	</item>
		<item>
		<title>Indenting of comments in emacs-lisp mode</title>
		<link>https://emacstragic.net/uncategorized/indenting-of-comments-in-emacs-lisp-mode/</link>
					<comments>https://emacstragic.net/uncategorized/indenting-of-comments-in-emacs-lisp-mode/#respond</comments>
		
		<dc:creator><![CDATA[Jason]]></dc:creator>
		<pubDate>Fri, 26 Oct 2012 01:53:34 +0000</pubDate>
				<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[elisp]]></category>
		<guid isPermaLink="false">http://emacstragic.net/?p=575</guid>

					<description><![CDATA[Emacs-lisp mode indents comments based on the number of semi-colons prefixing them. One semi-colon indents to column 40. Two semi-colons indent to the same level as the block you are in. Three semi-colons indent to wherever you place it and don&#8217;t move if you press &#60;TAB&#62; ;;; column: ;;;34567890123456789012345678901234567890123456789 ; one semi-colon (when (some case) [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Emacs-lisp mode indents comments based on the number of semi-colons prefixing them.<br />
One semi-colon indents to column 40.<br />
Two semi-colons indent to the same level as the block you are in.<br />
Three semi-colons indent to wherever you place it and don&#8217;t move if you press <code>&lt;TAB&gt;</code></p>
<pre LANG=lisp>
;;; column:
;;;34567890123456789012345678901234567890123456789
                                        ; one semi-colon
(when (some case)
  ;; two semi-colons indents to the appropriate level
  (second line)
  )
;; two semi-colons indents to the appropriate level
      ;;; I want this comment to stay right here
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://emacstragic.net/uncategorized/indenting-of-comments-in-emacs-lisp-mode/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">575</post-id>	</item>
	</channel>
</rss>
