Comments (5)
Hi @ilyash-b, could you provide more info on this?
from ngs.
Hi @antonio-pedro99!
In general, ensure(original, pattern)
returns a value which would match the pattern. The operation to make the original conform to the pattern should be minimal and obvious.
my_arr = [1,2,3]
my_arr =~ Has(1) # true
my_arr =~ Has(4) # false
ensure(my_arr, Has(4)) # [1,2,3,4]
from ngs.
I did not understand this
ensure(my_arr, Has(4))
Returning 1, 2, 3 + the element that is not present.
from ngs.
Not sure I understand your comment. I'll try to explain slightly different and see if it works.
ensure(x, pattern)
should return a value that would match the pattern
. In other words, ensure(x, pattern) =~ pattern
should succeed.
- If
x =~ pattern
whenensure()
is called, it just needs to returnx
- Otherwise,
ensure()
should minimally transform (a copy of)x
so that returned value matches thepattern
In the example of ensure(my_arr, Has(4))
, where 4
is not in my_arr
that minimal transformation would be to return a new value with all the elements of my_arr
with the item 4
appended.
from ngs.
In dev
from ngs.
Related Issues (20)
- Exception when doing [] =~ Pfx("abc") HOT 1
- Intuitive syntax for calling external programs preserving output HOT 6
- ngs -pl 'Set()' fails HOT 1
- Time substraction not implemented
- Substracting or Adding Int and Real fail HOT 1
- Implement Avg HOT 1
- Create NGS pitfalls wiki page HOT 1
- Installing on Termux, unrooted HOT 3
- Tables - hidden columns
- Consider adding .=(a:Arr, field:Str, mapper:Fun)
- Add to nixpkgs?
- Build failure: `syntax.leg: error: too few arguments to function 'yyPush'` HOT 19
- malloc.c:71:1: warning: non-void function does not return a value in all control paths [-Wreturn-type] HOT 3
- upgrade peg/leg to 0.1.19 (latest stable at the moment)
- malloc.c:22:87: error: use of undeclared identifier 'MAP_ANONYMOUS' HOT 5
- Manpages should go in share/man HOT 2
- Documentation belongs in share/doc HOT 1
- Remove /usr/local and /opt/homebrew HOT 4
- Documentation: Comparison with PowerShell / NuShell HOT 3
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 ngs.