Coder Social home page Coder Social logo

Array - Multiple values about bc HOT 6 CLOSED

STSMHQ avatar STSMHQ commented on June 18, 2024
Array - Multiple values

from bc.

Comments (6)

STSMHQ avatar STSMHQ commented on June 18, 2024 1

I'm still studying it. As NuShell didn't reach yet the first ever stable level, I don't know if I should implement all of my workflow directly using it. Currently, I'm just exploring the data processing pipeline features that they have against a workflow using sed/awk and your bc-gh, for instance. All I'm doing is pretty much pick a JSON file, iterate over it, apply some editions/additions using your bc-gh and then save it again to a JSON file. Hope you like NuShell as much as I do and one day in the future, it can have the same popularity as zsh.

If in the future I implement something that I'm proud of, I'll happily share it with you, Gavin.

from bc.

gavinhoward avatar gavinhoward commented on June 18, 2024

Unfortunately, there is not any workaround, and that is on purpose. The bc language is just too restricted to go any further without serious work.

It is possible, yes. However, I believe that would be a mistake.

I once said this:

Good software design includes putting whatever complexity must exist where it best fits.

-- "Justifying a Backwards Design Decision for Yao

So one of the skills of a good programmer is knowing where complexity should go.

If you need multiple values in one array slot, it sounds like you need structs, objects, or some other compound data thing. That sort of complexity should live in a "proper" programming language.

So I suggest that you use a "proper" programming language with arbitrary-precision numbers, like Python.

That said, I don't want to just hang you out to dry with no solution!

You're using my bc because it was the best for the job until now, right? Can you tell me why that is?

You've mentioned that you use it for finances; unlike most other math, finances basically require base 10 math, so is that why my bc was best?

If so, I might have a solution for you.

Do you know Python?

If so, I could learn how to create a C extension for Python, and then I could use my bc's library form to create a Python extension to use my bc's library. That way, you could use Python, but still have the decimal-based math you need for finances, and I wouldn't have to do a ton of work to add multi-values to bc while also adding my bc to Python.

As an extra bonus, if you use Python, you could then have your files be output to JSON or another well-known format. And hey, I may even be able to help you convert your scripts to Python if you send them to me. (Do it through email, not this bug report!)

Will that work for you?

from bc.

STSMHQ avatar STSMHQ commented on June 18, 2024

Hi, @gavinhoward,

I'm using your bc tool for over a year to keep track of my expenses and everything related to my personal finances. The main reason behind this decision is what you just said, generally speaking, finances use base 10 math and bc-gh allows me to have arbitrary-precision numbers on it. The second big reason is you. The passion you put into your projects is truly amazing. I know that as long as you're alive and well, you'll keep this project running and that's a important thing for me. Also, your support as shown here in this issue is very, very good. To end, I'm a follower of your blog since the beginning of 2022.

I don't know Python. I could learn it but I don't like much its' syntax and the biggest part of its' design choices. I'll probably take this chance to improve my NuShell knowledge and try to integrate bc-gh into it. With NuShell, I know that I can work with well-known formats like JSON/YAML/TOML in order to be able to implement my desired workflow. Thank you for everything and keep up the excellent work.

from bc.

gavinhoward avatar gavinhoward commented on June 18, 2024

You flatter me! :) But more seriously, thank you for the compliments; I struggle to see worth in my code, and that helps a lot.

I'm sorry I couldn't help more. But feel free to ask any questions to help with your port to NuShell. I'm happy to help with that since I was not much help here!

from bc.

STSMHQ avatar STSMHQ commented on June 18, 2024

You flatter me! :) But more seriously, thank you for the compliments; I struggle to see worth in my code, and that helps a lot.

Your code and your blog posts truly make a difference to my life 💙

I'm sorry I couldn't help more. But feel free to ask any questions to help with your port to NuShell. I'm happy to help with that since I was not much help here!

You don't have to be sorry. I read the documentation of NuShell and I think I'm able to implement my current workflow with bc-gh on it pretty easily. Thank you for all your spent time and help offered. Have a nice rest of week!

from bc.

gavinhoward avatar gavinhoward commented on June 18, 2024

You're welcome.

Hey, when you finish your NuShell implementation, I would love it if you could email it to me; I'm almost done with my new language, and I'd love to use it as a test application.

from bc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.