chaos


7 points by chaos over 2 years ago | link | top
cached 23 days ago
patch for ac.scm:

    1089a1090,1094
    > (xdef 'regexp regexp)
    > (xdef 'r-match regexp-match)
    > (xdef 'r-match-pos regexp-match-positions)
    > (xdef 'r-replace regexp-replace)
    > 

    arc> (= r (regexp "(-[0-9]*)+"))
    #rx"(-[0-9]*)+"
    arc> (r-match r "a-12--345b")     
    ("-12--345" "-345")
Just add what you need.

5 points by chaos over 2 years ago | link | parent | top
cached 11 days ago
heh, thanks :) I'll put them in next time.

4 points by chaos over 2 years ago | link | parent | top
cached 7 days ago
blog.arc seems to work with v360. :)

3 points by chaos over 2 years ago | link | top
cached 23 days ago
Because I'm reddit-damaged:

    (def unfold (f x)
      (let res (f x)
        (if res
            (cons (car res) (unfold f (cdr res)))
            ())))

    (def romanize (i)
      (let r '((M 1000)(CM 900)(D 500)(CD 400)(C 100)(L 50)(XL 40)(X 10)(IX 9)(V 5)(IV 4)(I 1))
        (unfold 
         (fn ((i . ((r n) . rst)))
             (if (is i 0)
                   ()
                 (>= i n)
                   (cons r (cons (- i n) `((,r ,n) . ,rst)))
                   (cons "" (cons i rst))))
         (cons i r))))
    (apply string (romanize 999))

3 points by chaos over 2 years ago | link | parent | top
cached 13 days ago
There is also withs:

    (withs (x 1 y 2) (withs (x y y x) (list x y)))

3 points by chaos over 2 years ago | link | top
cached 12 days ago

    (def foo () 'bar)
    (foo)
or

    (fn () 'bar)

3 points by chaos over 2 years ago | link | top
cached 11 days ago
Revision 12, synchronized with git and added a simple bayesian classifier.

3 points by chaos over 2 years ago | link | top
cached 9 days ago
My thoughts on Prolog:

Why, oh why, didn't I take Werner Hett's (aka Mr. Ninety-Nine_Prolog_Problems) Prolog/logic programming course when I had the opportunity. :/ Maybe then I could actually judge the language.

When used in small doses (and I think that's how it would be used, when embedded in other languages) it can be incredibly elegant, readable and short.


2 points by chaos over 2 years ago | link | top
cached 23 days ago
Maybe I'm the last one to notice withs as let* replacement, maybe not.

Simulated Annealing: http://dpaste.com/hold/33337/


2 points by chaos over 2 years ago | link | top
cached 13 days ago

    (type 2.0) -> int
Choosing the best possible type for numbers is imho a good thing. And it's (probably) taken directly from mzscheme.

    (type 2.1) -> num
    (integer? 2.0) -> #t