Skip to content

Commit

Permalink
Merge pull request #3 from usernaimandrey/first-exercise
Browse files Browse the repository at this point in the history
firs exercise
  • Loading branch information
fey committed Dec 13, 2022
2 parents 9a94cd8 + 2f995f5 commit 62a0fc1
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 17 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/**/_build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/**/logs/
*.DS_Store

_build
*.byte
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
FROM hexletbasics/base-image:latest

RUN apt-get update

RUN apt-get install -y opam

RUN opam init -y --disable-sandboxing

RUN opam install alcotest.1.6.0 -y

RUN eval $(opam config env)

WORKDIR /exercises-ocaml

COPY . .

ENV PATH=~/.local/bin/:/exercises-ocaml/bin:$PATH
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ compose-build:
docker-compose build

code-lint:
# java -jar /opt/checkstyle.jar -c checkstyle.xml modules src
@ echo lint

# compile:
# @(for i in $$(find . -type f -name Main.java); do javac $$(dirname $$i)/*.java ; done)
clean:
@$$(find . -type d -wholename '*_build' -exec rm -r {} +)
@$$(find . -type f -name test.byte -delete)

# clean:
# @$$(find . -type f -name *.class -delete)
compose-clean:
docker-compose run exercises make clean

compose-bash:
docker-compose run exercises bash
Expand Down
3 changes: 3 additions & 0 deletions bin/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
eval $(opam config env)
ocamlbuild -pkg alcotest test.byte
./test.byte
19 changes: 19 additions & 0 deletions description.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---

title: 'Course in OCaml (okaml): free lessons, training online'

header: |
Code Basics - this is a completely free online programming course!
description: |
OCaml is an object-oriented language of general purpose functional programming. It was designed with safety in mind and the reliability of the program. Supports functional, imperative and object-oriented programming paradigms. The most widespread dialect of the ML language in practical work.
seo_description: |
OCaml (okaml) programming training from scratch, a free online course from the Hexlet community. OCaml (okaml) programming lessons for beginners.
keywords:
- code basics
- online courses
- free courses
- programming
- OCaml
20 changes: 20 additions & 0 deletions description.ru.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---

title: 'Курс по OCaml (окамл): бесплатные уроки, обучение онлайн'

header: |
Code Basics - это полностью бесплатные онлайн курсы по програмированию!
description: |
OCaml — объектно-ориентированный язык функционального программирования общего назначения. Был разработан с учётом безопасности исполнения и надёжности программ. Поддерживает функциональную, императивную и объектно-ориентированную парадигмы программирования. Самый распространённый в практической работе диалект языка ML.
seo_description: |
Обучение программированию на OCaml (окамл) с нуля, бесплатный курс онлайн от сообщества Хекслет. Уроки программирования на OCaml (окамл) для начинающих
keywords:
- code basics
- онлайн курсы
- бесплатные курсы
- програмирование
- OCaml
- окамл
26 changes: 24 additions & 2 deletions modules/10-basics/10-hello-world/description.ru.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
---

name: Привет, Мир!
name: Первая программа на OCaml
theory: |
Изучать язык программирования, по традиции, начинают с программы 'Hello, World!', которая выводит этот текст на экран.
Изучать язык программирования, по традиции, начинают с программы 'Hello, World!'.
<pre class='hexlet-basics-output'>
Hello, World!
</pre>
В языке OCaml эта программа будет выглядеть например так:
```ocaml
let message = "Hello, World!";;
let hello () = print_endline message;;
```
Текст `Hello, World!` появится на экране благодаря команде `print_endline message;;`.
Такая команда выводит на экран информацию, которая указана после директивы `print_endline`.
instructions: |
Наберите в редакторе код из задания символ в символ и нажмите «Проверить».
```ocaml
let message = "Hello, World!";;
let hello () = print_endline message;;
```
> Внимание: если вы напишете `heLLo, woRld!` вместо `Hello, World!`, то это будет считаться другим текстом, потому что заглавные и строчные буквы — это разные символы. Размер буквы называют *регистром*, и говорят: **регистр — важен!** Это касается почти всего в коде, поэтому привыкайте всегда обращать внимание на регистр.
tips:
- "Если в редакторе есть запись `(* BEGIN *)` и `(* BEGIN *)`, то код нужно писать между этими строчками."
4 changes: 4 additions & 0 deletions modules/10-basics/10-hello-world/index.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(* BEGIN *)
let message = "Hello, World!";;
let hello_world () = print_endline message;;
(*END*)
2 changes: 2 additions & 0 deletions modules/10-basics/10-hello-world/index.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
val message : string
val hello_world : unit -> unit
1 change: 0 additions & 1 deletion modules/10-basics/10-hello-world/index.ts

This file was deleted.

14 changes: 14 additions & 0 deletions modules/10-basics/10-hello-world/test.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
open Index


let test_hello_world () =
Alcotest.(check string) "greating string" "Hello, World!" (message)


let () =
let open Alcotest in
run "Utils" [
"greating string", [
test_case "greating run" `Quick test_hello_world;
];
]
3 changes: 0 additions & 3 deletions modules/10-basics/10-hello-world/test.ts

This file was deleted.

3 changes: 1 addition & 2 deletions modules/10-basics/description.ru.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
name: Основы
description: |
Описание
OCaml – Был разработан с учётом безопасности исполнения и надёжности программ. Появился в 1996 году под названием Objective Caml и только 2011 был переименован в OСaml. В этом модуле мы познакомимся с основыми OСaml и напишем первую программу.
8 changes: 4 additions & 4 deletions spec.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---

language:
docker_image: "hexletbasics/exercises-typescript"
extension: ts
exercise_filename: index.ts
exercise_test_filename: test.ts
docker_image: "hexletbasics/exercises-ocaml"
extension: ml
exercise_filename: index.ml
exercise_test_filename: test.ml

0 comments on commit 62a0fc1

Please sign in to comment.