Для запуска нужна только Babashka!
Установите, передайте .clj-файл в качестве аргумента (bb main.clj
).
Когда сервер запустится, откройте http://localhost:8000 в браузере. Приложение работает!
Для запуска нужна только Babashka!
Установите, передайте .clj-файл в качестве аргумента (bb main.clj
).
Когда сервер запустится, откройте http://localhost:8000 в браузере. Приложение работает!
import uuid | |
from aiohttp import web | |
CONTS = {} | |
async def handle(request: web.Request) -> web.Response: | |
k = request.query.get("cont") |
class Basic { | |
data class Var(val name: String) | |
class Let { | |
infix fun BE(value: Any): Binding = TODO() | |
} | |
class Binding { | |
infix fun MOD(other: Any): Binding = TODO() | |
} |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import Data.Char | |
import Text.Parsec | |
import Text.Parsec.String | |
data Machine = Machine ![Int] !Int ![Int] deriving Show |
> mirror = map reverse | |
> flip = reverse | |
> beside x = zipWith (++) x x | |
> above x = x ++ x | |
> beside = zipWith (++) | |
> above = (++) | |
> sq x = let y = mirror x in above (beside x y) (beside y x) | |
> display $ enlarge $ enlarge $ sq [" a", "b "] | |
aaaaaaaa | |
aaaaaaaa |
This machine uses two stacks: for data and for commands.
Each command can extend any of stacks.
Also the language provides a fold
function that uses command stack manipulations for recursion.
{-# LANGUAGE FlexibleContexts #-} | |
module Main where | |
import Control.Monad | |
import Control.Monad.State | |
import Data.Set | |
main :: IO () | |
main = print $ solution (1, 1) == allBoard |
#lang racket | |
(require 2htdp/image) | |
(require 2htdp/planetcute) | |
(define world | |
'((" k" | |
"T r ," | |
",,, t,." | |
"... ,,.." | |
"... ...." |
#lang racket | |
(require 2htdp/image) | |
(define (->color c) | |
(cond [(= c 0) 'indigo] | |
[(= c 1) 'palevioletred] | |
[(= c 2) 'moccasin] | |
[else 'white])) | |
(define (next-c c) (modulo (+ 1 c) 4)) |