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:
; version originale | |
(if (> 1 0) | |
(print "it's correct") | |
(print "broken")) | |
; définitions des traductions | |
(defmacro si (cond alors sinon) |
#! /usr/bin/env nix-shell | |
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (p: [p.aeson p.polysemy p.polysemy-plugin])" | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeApplications #-} |
module Adhoc where | |
data ClientIdentifier | |
= Admin | |
| User String | |
deriving (Eq, Show) | |
data Settings = Settings | |
{settingAllowList :: [ClientIdentifier]} | |
deriving (Show) |
#! /usr/bin/env nix-shell | |
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (p: [p.effectful p.effectful-th])" | |
{-# LANGUAGE BlockArguments #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE GHC2021 #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} |
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" |
<?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)); |
(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))) |
I hereby claim:
To claim this, I am signing this object:
nlet foo(count = 5) { | |
if(count != 0) { | |
cout << count << endl; | |
foo(count--); | |
} |
(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)))) |