Inicio / Guias
Guias
De una copia a algo que se ejecuta, en cinco pasos.
Esta seccion aun no esta traducida a tu idioma; se muestra en ingles. Las traducciones son bienvenidas.
Primeros pasos
Build it
Clone, then compile the CLI. Use -cc gcc: the default C backend fails on this checkout, and CI uses the same flag so the two cannot disagree.
git clone https://github.com/metif12/vlip cd vlip v -cc gcc -o vlip.exe vlip.v .\vlip.exe examples\01_basics.lipDefine something
A lambda takes a parameter list and a body. Define binds it. map applies it to each element.
(define (square n) (* n n)) (map square [1 2 3 4]) ;=> (1 4 9 16)Branch on values
cond takes clauses in order and runs the body of the first whose test is true. The else clause catches the rest.
(define (fizzbuzz n) (cond [(= 0 (mod n 15)) "FizzBuzz"] [(= 0 (mod n 3)) "Fizz"] [(= 0 (mod n 5)) "Buzz"] [else n])) (map fizzbuzz (range 1 16))Write a loop that is not a loop
An ordinary recursive function whose call is in tail position. The continuation stack does not grow, so depth is limited by memory rather than by the stack.
(define (fold-left f init xs) (if (null? xs) init (fold-left f (f init (car xs)) (cdr xs)))) (fold-left + 0 [1 2 3 4 5]) ;=> 15Or use loop
loop is a named let: it advances the variable for you. Same constant space, less to get wrong.
; a sum loop needs no stack at all (define (sum-to n) (loop i 0 (<= i n) (set! n (- n i)))) (sum-to 1000000) ; runs in constant space
Esta seccion aun no esta traducida a tu idioma; se muestra en ingles. Las traducciones son bienvenidas.
Adonde ir despues
The examples directory is the best next stop. Six programs, and they are the specification the interpreter is written against: if the interpreter and an example disagree, one of them is wrong and the example usually wins.
After that, the roadmap. It names what is broken, what is next, and which order those things have to happen in.
Esta seccion aun no esta traducida a tu idioma; se muestra en ingles. Las traducciones son bienvenidas.
Contribuir
Bug reports and pull requests are welcome, including translations. The contributing guide covers how to build, how to run the tests, and the branch layout.