tiflolinux.org - GNU Social
  • Login

Bienvenido

  • Public

    • Public
    • Network
    • Groups
    • Popular
    • People

Conversation

Notices

  1. Jeko (jeko@framapiaf.org)'s status on Wednesday, 01-Jun-2022 00:10:28 CEST Jeko Jeko

    Hey #schemers !
    I have two numbers in strings with comma as decimal separator (e.g. "0,46" and "0,098")

    Any idea how I can get their sum in simpler way than this :
    (use-modules (ice-9 string-fun))
    (+ (string->number (string-replace-substring "0,24" "," ".")) (string->number (string-replace-substring "0,098" "," ".")))

    Feels heavy…

    Thx!

    #guile #scheme

    In conversation Wednesday, 01-Jun-2022 00:10:28 CEST from framapiaf.org permalink
    • Ekaitz Zárraga 👹 repeated this.
    • Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Wednesday, 01-Jun-2022 00:10:27 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
      in reply to

      @jeko I don't think there's another simple way. In other languages you can use the locales for that, but I don't think it's the case in Scheme.

      In conversation Wednesday, 01-Jun-2022 00:10:27 CEST permalink
    • Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Wednesday, 01-Jun-2022 00:11:11 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
      in reply to

      @jeko Of course this is something impossible to find a search engine so... that's why I don't use guile/scheme that much... too many problems that I can't find a solution about.

      In conversation Wednesday, 01-Jun-2022 00:11:11 CEST permalink
    • Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Wednesday, 01-Jun-2022 11:33:13 CEST Ludovic Courtès Ludovic Courtès
      in reply to

      @jeko Try ‘locale-string->inexact’ from (ice-9 i18n) in a French locale:

      (locale-string->inexact "3,14" (make-locale LC_ALL "fr_FR.utf8"))
      ⇒ 3.14

      In conversation Wednesday, 01-Jun-2022 11:33:13 CEST permalink
    • Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Wednesday, 01-Jun-2022 11:48:13 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
      in reply to
      • Ludovic Courtès

      @civodul @jeko Oh my god. It's here:
      https://www.gnu.org/software/guile/docs/docs-2.0/guile-ref/Number-Input-and-Output.html#Number-Input-and-Output

      Impossible to find... :S

      In conversation Wednesday, 01-Jun-2022 11:48:13 CEST permalink

      Attachments

      1. No result found on File_thumbnail lookup.
        Guile Reference Manual: Number Input and Output
        Guile Reference Manual: Number Input and Output
    • Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Wednesday, 01-Jun-2022 12:17:32 CEST Ludovic Courtès Ludovic Courtès
      in reply to
      • Ekaitz Zárraga 👹

      @ekaitz_zarraga @jeko You’re looking at the 2.0 manual; this API hasn’t changed, but check out:
      https://www.gnu.org/software/guile/manual/html_node/Number-Input-and-Output.html

      :-)

      In conversation Wednesday, 01-Jun-2022 12:17:32 CEST permalink

      Attachments


    • Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Wednesday, 01-Jun-2022 12:17:32 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
      in reply to
      • Ludovic Courtès

      @civodul @jeko AGAIN: Impossible to find it properly AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

      In conversation Wednesday, 01-Jun-2022 12:17:32 CEST permalink
    • Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Wednesday, 01-Jun-2022 12:41:19 CEST Ludovic Courtès Ludovic Courtès
      in reply to
      • Ekaitz Zárraga 👹

      @ekaitz_zarraga @jeko Re “impossible to find”, there’s a function index, accessible by typing ‘i’ in an Info reader, and on-line at https://www.gnu.org/software/guile/manual/html_node/Procedure-Index.html

      Ideas on how to improve on that are much welcome!

      In conversation Wednesday, 01-Jun-2022 12:41:19 CEST permalink

      Attachments


    • Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Wednesday, 01-Jun-2022 12:41:19 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
      in reply to
      • Ludovic Courtès

      @civodul @jeko that's useful to find a function you know but you don't know what it does, but it's not useful to learn how to do something.
      Get what I mean?

      In conversation Wednesday, 01-Jun-2022 12:41:19 CEST permalink
    • Ludovic Courtès (civodul@toot.aquilenet.fr)'s status on Wednesday, 01-Jun-2022 15:15:58 CEST Ludovic Courtès Ludovic Courtès
      in reply to
      • Ekaitz Zárraga 👹

      @ekaitz_zarraga @jeko Then again, I’m an old fart, which is why I’m used to searching for info in manuals rather than in a search engine. :-)

      (Searching for Guile stuff in a search engine is never going to work as efficiently for Guile as it does for JavaScript or C++ anyway…)

      In conversation Wednesday, 01-Jun-2022 15:15:58 CEST permalink
    • Ekaitz Zárraga 👹 (ekaitz_zarraga@mastodon.social)'s status on Wednesday, 01-Jun-2022 15:15:58 CEST Ekaitz Zárraga 👹 Ekaitz Zárraga 👹
      in reply to
      • Ludovic Courtès

      @civodul @jeko yeah... I guess I have to learn to use the info pages better...

      In conversation Wednesday, 01-Jun-2022 15:15:58 CEST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

tiflolinux.org - GNU Social is a social network, courtesy of tiflolinux.org. It runs on GNU social, version 2.0.1-beta0, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All tiflolinux.org - GNU Social content and data are available under the Creative Commons Attribution 3.0 license.