2 ms·
BTW if we remove error handling, I think ABS' code would look like: ip = `curl -s 'https://api.ipify.org?format=json'`.json().ip total = ip.split('.').
by odino 5y ago
BTW if we remove error handling, I think ABS' code would look like:
ip = `curl -s 'https://api.ipify.org?format=json'`.json().ip
total = ip.split('.').map(int).sum()
if total > 100 {
echo("The sum of [$ip] is a large number, $total.")
}
I would suggest implementing decorators in NGS. Not because you will need them, but because they're easily the most fun part I had to write in ABS :) That, and seeing stdin() working for the first time on my terminal!
- ilyash 5y agoLooks pretty close :) What happens in ABS if curl fails in this example? Or JSON parsing fails? In NGS, it's an exception with a stack trace. > fun part NGS is mostly use-cases oriented - https://github.com/ngs-lang/ngs/wiki/Use-Cases https://github.com/ngs-lang/ngs/wiki/Use-Cases Decorators are not implemented yet because there are other things higher up the list. Currently working on deeply nested data structures because it's needed for our use case for FHIR - https://github.com/ngs-lang/ngs/wiki/Deep-Data-Structures-Manipulation-Design https://github.com/ngs-lang/ngs/wiki/Deep-Data-Structures-Ma...