1 В head страницы добавляем:
<script src="https://cdn.jsdelivr.net/npm/@webcomponents/webcomponentsjs@2/webcomponents-loader.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@1/src/zero-md.min.js"></script>Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.
| from dataclasses import dataclass, fields as datafields | |
| from ujson import dumps, loads | |
| # Note: ujson seamlessly serializes dataclasses, unlike stdlib's json | |
| @dataclass | |
| class Point: | |
| x: float | |
| y: float | |
| # Shallow dataclass can be rebuilt from dict/json: |
| //------------------------------------------------------------- | |
| // | |
| // Hypothesis: | |
| // | |
| // Promises/A is a Monad | |
| // | |
| // To be a Monad, it must provide at least: | |
| // - A unit (aka return or mreturn) operation that creates a corresponding | |
| // monadic value from a non-monadic value. | |
| // - A bind operation that applies a function to a monadic value |
Option<T> |
non-Option (T | undefined) |
|
|---|---|---|
| accessing property | userOption.map(user => user.age) |
userNullish?.age |
| calling a method | userOption.map(user => user.fn()) |
userNullish?.fn() |
| providing fallback | ageOption.getOrElse(0) |
ageNullish ?? 0 |
| filter | ageOption.filter(checkIsOddNumber) |
`ageNull |
| /*** | |
| * This gist provides a __FILE__ variable, which holds the path to the file | |
| * from which the currently running source is being executed. | |
| * | |
| * Usage example: alert(__FILE__); | |
| * | |
| * Thanks to http://ejohn.org/blog/__file__-in-javascript/ on which this gist | |
| * is based on. | |
| * | |
| * Tested in Mozilla Firefox 9, Mozilla Firefox 16, Opera 12, Chromium 18 |
| // This is a class that attempts to stop you accessing variables outside a lock. | |
| // | |
| // It does not do a perfect job, but can catch some common kinds of mistake, in | |
| // particular when you accidentally try to work with objects inside closures that | |
| // end up running later, outside the locked region (or in a different thread). | |
| // EXAMPLE | |
| val bank = ThreadBox(object { | |
| val accounts by arrayListOf(10, 0, 0, 0).guard() |
See this Nim Forum Topic where this started.
Well I have a working Aporia version on my Yosemite OS X 10.10.2 from the new-suggest branch of the repository.
BUT the lengths I had to go to get this working are plastered with stuff I did not understand :)