https://github.com/msantos/wat
A simple example of an Erlang NIF for creating mutable variables
https://github.com/msantos/wat
Last synced: about 1 month ago
JSON representation
A simple example of an Erlang NIF for creating mutable variables
- Host: GitHub
- URL: https://github.com/msantos/wat
- Owner: msantos
- Created: 2009-11-28T15:00:23.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-08-21T14:01:41.000Z (almost 15 years ago)
- Last Synced: 2024-12-13T03:34:10.593Z (6 months ago)
- Language: C
- Homepage: http://listincomprehension.com/2009/11/simple-mutable-variables-using-erlang.html
- Size: 86.9 KB
- Stars: 4
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
wat is an example of how to use the Erlang native implemented
functions.Since nif's already decrease the reliability of the erlang VM, why
not push the boundaries a bit further and create a mutable data
store?USAGE
Erlang R13B03 (erts-5.7.4) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.7.4 (abort with ^G)
1> wat:init(1024).
ok
2> wat:get(20).
0
3> wat:set(20,5).
5
4> wat:get(20).
5
5> wat:add(20,10).
15
6> wat:get(20).
15
7> wat:init(10).
ok
8> wat:get(20).
{error,out_of_bounds}
9>