- No mutable state
- no loops (for, while)
- no statements
- no mouse
- no primitives
- no else (only guards)
- no conditionals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Data.Monoid | |
| -- questo importa Monoid che, semplificato, definisce lo zero e la concatenazione: | |
| class Monoid a where | |
| mempty :: a | |
| mappend :: a -> a -> a | |
| --questo mi permette di definire whatever tipo come monoide | |
| newtype MyMonoid = ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class VersionTest | |
| { | |
| private readonly ITestOutputHelper _outp; | |
| public VersionTest(ITestOutputHelper outp) | |
| { | |
| _outp = outp; | |
| } | |
| [Fact] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f = 1: 1: zipWith (+) f (tail f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal interface Either<L, R> | |
| { | |
| Either<L, B> Bind<B>(Func<R, Either<L, B>> f); | |
| B Match<B>(Func<L, B> whenLeft, Func<R, B> whenRight); | |
| } | |
| internal sealed record Right<L, R> : Either<L, R> | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun my-dired--first-char-or-ask () | |
| (if (member (char-after (line-beginning-position)) `(?\s ,dired-marker-char)) | |
| (read-char "Which mark are you targeting? ") | |
| (char-after (line-beginning-position)))) | |
| (defun my-dired-swap-marks-ask () | |
| (interactive) | |
| (let ((mark (my-dired--first-char-or-ask))) | |
| (my-dired-swap-marks (string mark)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| content | |
| .lines() | |
| .filter(|line| line.to_lowercase().as_str().contains(query)) | |
| .collect() | |
| content | |
| .lines() | |
| .map(|line| line.to_lowercase().as_str()) | |
| .filter(|line| line.contains(query)) | |
| .collect() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main where | |
| type Point = Int | |
| type From = Point | |
| type To = Point | |
| type Segment = (From, To) | |
| type Graph = [Segment] | |
| hasPath :: Graph -> From -> To -> Bool | |
| hasPath [] _ _ = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private delegate IEnumerable<string> ManipulateHistory(IEnumerable<string> history); | |
| ManipulateHistory append(string tail) => | |
| history => history.Append(new[] { history.Last() + tail }); | |
| ManipulateHistory delete(int k) => | |
| history => history.Append(new[] { delete(history.Last(), k) }); | |
| string delete(string last, int k) => last.Substring(0, last.Length - k); |