Skip to content

Instantly share code, notes, and snippets.

Пример задач к контрольной работе

Арифметика

sh :: Double -> Double
sh x = undefined
final class AnyRefOption[T >: Null <: AnyRef] private(private val value: T) extends AnyVal {
def isEmpty = value == null
def isDefined: Boolean = !isEmpty
def get: T = value
def foreach[U](fn: T => U): Unit = {
if (isDefined) fn(value)
}
def let[U](fn: T => U) = if (isDefined) fn(value) else AnyRefOption(null)
@andiogenes
andiogenes / emacs.plugin.zsh
Last active December 13, 2022 08:37
Better Eshell experience with Oh My Zsh
# open eshell in terminal emacsclient
alias tesh="te --eval '(restart-eshell)'"
;; Enable Company in selected major modes
(let ((hooks '(java-mode-hook)))
(dolist (hook hooks)
(add-hook hook (lambda ()
(company-mode 1)))))
;;; Rebind 'GOTO beginning/end of buffer' to "C-M-v"
(defun edge-of-buffer ()
(interactive)
(if (and current-prefix-arg (eq current-prefix-arg '-))
(beginning-of-buffer) (end-of-buffer)))
(global-set-key (kbd "C-M-v") 'edge-of-buffer)
;; https://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Emacs-Sessions.html
(desktop-save-mode 1)
;;; Display a list of existing buffers in current window
(global-set-key (kbd "C-x C-b") 'buffer-menu)
;; List buffers in other window using "C-x 4-" prefix
(global-set-key (kbd "C-x 4 C-x C-b") 'list-buffers)
;;; Show directories first in Dired
(setq dired-listing-switches "-al --group-directories-first")
(defun graphviz-on-buffer ()
(interactive)
(shell-command-on-region (point-min) (point-max) "dot -Txlib"))
;;; Relative line numbers
(setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode)
;; Move toward logical lines when prefix arg (numeric, negative) is presented
(defun next-logical-line-if-prefix (&optional arg try-vscroll)
(interactive "^p\np")
(let ((line-move-visual (if current-prefix-arg nil line-move-visual)))
(with-no-warnings
(next-line arg try-vscroll))))