Comments (2)
Pattern matching on bitstrings may be possible using typedarrays and buffers.
example 1
<<"Hello, ", place::binary>> = "Hello, World"
let [place] = Patterns.match(Patterns.BitString("Hello, ", Patterns.BitString.binary()))
example 2
@png_signature <<137::size(8), 80::size(8), 78::size(8), 71::size(8),
13::size(8), 10::size(8), 26::size(8), 10::size(8)>>
<<@png_signature, rest::binary>>
const png_signature = BitString(BitString.integer(137), ...)
let [rest] = Patterns.match(Patterns.BitString(png_signature, Patterns.BitString.binary()))
example 3
pixels = <<213, 45, 132, 64, 76, 32, 76, 0, 0, 234, 32, 15>>
for <<r::8, g::8, b::8 <- pixels >>, do: {r, g, b}
let pixels = BitString(BitString.integer(213), ...)
Kernel.SpecialForms._for([
Patterns.BitString(Patterns.BitString.integer(), Patterns.BitString.integer(), Patterns.BitString.integer()), pixels
],
(r, g, b) => Kernel.SpecialForms.tuple(r, g, b)
)
from elixirscript.
Fixed in master
from elixirscript.
Related Issues (20)
- Track the modules a module uses
- Build failure with macOS 10.13 and Xcode 9 HOT 2
- ElixirScript Test Assertions HOT 1
- Create compiler manifest HOT 2
- Create manifests function in Mix compiler
- Create clean function in mix compiler HOT 1
- Use manifest to see if a module should be compiled or not HOT 1
- Regex functions throw errors HOT 3
- Is it possible to compile quoted or string? HOT 3
- Enum.map does not work in 0.32 HOT 2
- comprehensions/generators HOT 1
- in-browser Elixir parser / interpreter HOT 3
- Beginner Tutorial HOT 2
- FFI - Support npm modules directly
- Elixir + Wasm HOT 9
- Pragmatic question: working with JS Object HOT 3
- Elixir Script as ClientLibrary Framework to Interface with Elixir/Phoenix
- Still alive? HOT 2
- String.slice(str, 0, -1) raises FunctionClauseError HOT 1
- Inactive project HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elixirscript.