NoBodyButMe / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

Scheme language detection fail #250

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The following code is scheme (GNU Guile) and the language detector fails to 
detect it correctly:

<pre class="prettyprint"><code>(define (cont-frac-rec numer denom k)
    (define (step i)
        (if (&gt; i k) 0
        (/ (numer i) (+ (denom i) (step (1+ i))))))
    (step 1))

(define (cont-frac-iter numer denom k)
    (define (step tally i)
        (if (&lt; i 1) tally
        (step (/ (numer i) (+ tally (denom i))) (1- i))))
    (step 0.0 k))

(define (cont-frac numer denom k)
    ; (cont-frac-rec numer denom k)
    (cont-frac-iter numer denom k)
)

(let ((phiInverse (cont-frac (lambda (i) 1.0) (lambda (i) 1.0) 20)))
        (if (or (&gt; phiInverse 0.6181) (&lt; phiInverse 0.6180))
        (display (string-append "FAIL: " (number-&gt;string phiInverse))) #t))
</code></pre>

Workaround is to specify the language in the class, which I am able to do due 
to issue 224.

Original issue reported on code.google.com by Sam.Hall...@gmail.com on 20 Oct 2012 at 5:59

GoogleCodeExporter commented 8 years ago
I am looking at the suggestions in 224, and will reconsider this use-case once 
that issue is settled.

Original comment by mikesamuel@gmail.com on 4 Feb 2013 at 10:50