I hereby claim:
- I am kephas on github.
- I am kephasp (https://keybase.io/kephasp) on keybase.
- I have a public key whose fingerprint is F9B7 AA0C 0DA1 EF01 E495 C5E2 C5ED 7720 D9D5 0D8A
To claim this, I am signing this object:
(defmacro while (cond &body body) | |
(with-gensyms (cond-var) | |
`(do ((,cond-var ,cond ,cond)) | |
((not ,cond-var)) | |
,@body))) |
(defmacro nlet (name bindings &body body) | |
"This is the LET from RnRS with a name, that creates a local function." | |
`(labels ((,name ,(mapcar #'first bindings) ,@body)) | |
(,name ,@(mapcar #'second bindings)))) | |
(nlet foo ((count 5)) | |
(unless (= 0 count) | |
(print count) | |
(foo (1- count)))) |
nlet foo(count = 5) { | |
if(count != 0) { | |
cout << count << endl; | |
foo(count--); | |
} |
I hereby claim:
To claim this, I am signing this object:
; the most straightforward imperative implementation of the while | |
; control structure | |
(defmacro while1 (cond &body body) | |
(with-gensyms (cond-var) | |
`(do ((,cond-var ,cond ,cond)) | |
((not ,cond-var)) | |
,@body))) | |
; a functional implementation relying on TCO | |
(defmacro while2 (cond &body body) |
(ql:quickload "hunchentoot") | |
(use-package :hunchentoot) | |
(start (make-instance 'acceptor :port 8080)) | |
(define-easy-handler (greet :uri "/hello") (name) | |
(format nil "<html><body><h1>Hello ~a!</h1></body></html>" name)) |
#lang racket | |
(define digits12 "0123456789AB") | |
(define digits12-list (string->list digits12)) | |
(define (digit12->int digit) | |
(let loop ((digits digits12-list) | |
(result 0)) | |
(if (char=? digit (first digits)) | |
result |
(defun read-only-chars (stream chars) | |
(with-output-to-string (result) | |
(loop while (find (peek-char nil stream) chars) | |
do (princ (read-char stream) result)))) | |
(set-dispatch-macro-character #\# #\! (lambda (stream subchar arg) | |
(parse-integer (remove #\_ (read-only-chars stream "01_")) :radix 2))) |
<?php | |
function creer_doublon($max) { | |
$start = 1; | |
$nombres = range(1, $max); | |
array_push($nombres, rand(1, $max)); | |
shuffle($nombres); | |
return $nombres; | |
} | |
print_r(creer_doublon(10)); |
checkUserForPromotion :: User -> Either String User | |
checkUserForPromotion user = | |
case (user.age > 18, user.country, length user.purchases > 5) of | |
(True, France, True) -> Right (user { status = Vip }) | |
(False, _, _) -> Left "trop jeune" | |
(True, _, False) -> Left "pas assez d'achats" | |
(True, _, True) -> Left "pas français" |