У гитхаба какая-то поехвашая подсветка схема-кода.
http://ompldr.org/vaHUwZA
У гитхаба какая-то поехвашая подсветка схема-кода.
http://ompldr.org/vaHUwZA
методы оптимизации памяти. http://itw66.ru/blog/c_plus_plus/491.html
типикал хаскелепроблемы -> http://juick.com/2277547
На лоре спросили:
/можно ли написать на Racket такую функцию, чтобы внутри неё (в её динамическом окружении) делений на 0 возвращало 0, а не прерывало вычисления/
Короче, да:
(define-syntax-rule (try-or-zero body ...)
(let/cc k (with-handlers ([exn? (λ _ (k 0))])
body ...)))
(define (testl l)
(if (null? l)
'()
(cons (try-or-zero (/ 1 (car l)))
(testl (cdr l)))))
(testl '(1 2 3 0 5))
The best productivity tip I've come across is the "Seinfeld technique" that I learned about from reading Hacker News. It involves doing something, no matter how small, on your project every single consecutive day, without any gaps or interruptions.
мемоизация на ракете.
nothing special.
; replace define with a memoized version
(define-syntax define-memoized
(syntax-rules ()
[(_ (f args ...) bodies ...)
(define f
; store the cache as a hash of args => result
(let ([results (make-hash)])
; need to do this to capture both the names and the values
(lambda (args ...)
((lambda vals
; if we haven't calculated it before, do so now
(when (not (hash-has-key? results vals))
(hash-set! results vals (begin bodies ...)))
; return the cached result
(hash-ref results vals))
args ...))))]))
; example, fibonacci with memoization
(define-memoized (mfib n)
(cond
[(< n 1) 1]
[else (+ (mfib (- n 1)) (mfib (- n 2)))]))
годнота, ведь:
http://colinm.org/language_checklist.html
Taking the wider ecosystem into account, I would like to note that:
[ ] Your complex sample code would be one line in: _______________________
[ ] We already have an unsafe imperative language
[ ] We already have a safe imperative OO language
[ ] We already have a safe statically-typed eager functional language
[ ] You have reinvented Lisp but worse
[ ] You have reinvented Javascript but worse
[ ] You have reinvented Java but worse
[ ] You have reinvented C++ but worse
[ ] You have reinvented PHP but worse
[ ] You have reinvented PHP better, but that's still no justification
[ ] You have reinvented Brainfuck but non-ironically
In conclusion, this is what I think of you:
[ ] You have some interesting ideas, but this won't fly.
[ ] This is a bad language, and you should feel bad for inventing it.
[ ] Programming in this language is an adequate punishment for inventing it.