Stories
Slash Boxes
Comments

SoylentNews is people

The Fine print: The following are owned by whoever posted them. We are not responsible for them in any way.

Journal by turgid

Which LISP should I learn? Years ago I read about Scheme and wrote some hello world level code. I learned about lambda functions and currying. I also looked at racket. A few years ago, much of my day job involved the JVM and I was getting sick of Java so I got a book on Clojure, which is a very nice language, but I never wrote any.

A few days ago I downloaded and built the latest version of DrRacket.

Should I go straight to Haskell? Or what about other functional languages? Is Erlang worth a look?

I need something stimulating to distract my brain from the mundane nature of everyday life, and mediocre programming languages.

Display Options Threshold/Breakthrough Reply to Comment Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 3, Interesting) by turgid on Wednesday December 01 2021, @10:33PM (11 children)

    by turgid (4318) Subscriber Badge on Wednesday December 01 2021, @10:33PM (#1201294) Journal

    About a million years ago I had several ideas for stuff and then over the years whenever I've had time I've tried to do bits and pieces of them. Some years ago I set about writing my own graphics primitives (in C) to be rendered using SDL (well, it's simple and cheap). I wrote pixels, lines, circles, ellipses, boxes, colour gradients and all sorts. I even implemented display lists so that I could have objects to render and move the mouse about and it would know which object it was over, click to drag and so on. On my travels I wrote some code to do the Mandelbrot set. I thought it would be a fun thing for Turgid jr. to see being written. He was about 8 at the time. I planned to make it zoomable with the mouse but never got around to it. And did I tell you about my home-made 3D graphics? Oh boy... with multi-threading?

    Starting Score:    1  point
    Moderation   +1  
       Interesting=1, Total=1
    Extra 'Interesting' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   3  
  • (Score: 2) by DannyB on Thursday December 02 2021, @03:22PM (2 children)

    by DannyB (5839) Subscriber Badge on Thursday December 02 2021, @03:22PM (#1201517) Journal

    I've mentioned this on SN before.

    Back in ancient times long past, there were these things called "flip phones" or "candy bar phones". (Paleontologists label this as the "pre smart phone era")

    https://soylentnews.org/comments.pl?cid=1134316&sid=42871 [soylentnews.org]

    I remember J2ME. (Java "lite" on all of the billions of mobile phones in the pre smartphone daze.)

    It didn't have any floating point. I was building my own "asteroids" clone. (And did successfully build it. Gave it to a few friends. Once that accomplishment achieved, I moved on.)

    I needed trig functions. I wanted to draw the ship and rocks as sprites sub classed from a common super class. Each line vector figure (ship or rock) had a series of points relative to a "center" point. It was the center point of the sprite that moved on each frame update. In my game, the rocks rotated, unlike original asteroids. These points around the center point were expressed in polar (r-theta) form. Just draw a line from the first point to the last, and then back to the first, thus drawing a closed figure. (Ship or rock)

    I need to convert from polar form to x-y coords, and then offset to the x-y center of the sprite before drawing on screen.

    But J2ME only had long integers and no trig functions (or log, power, etc)

    There was some library that had the name "bear" in it. This used a 64-bit long, dividing it into 32-bit mantissa and fraction. Trig functions did a few taylor series terms, and that was more than good enough.

    Wow, those were ye olden daze. And it was after the year 2000. Wow, I'm getting old.

    Be sure to see some replies after that posting.

    See also:
    https://soylentnews.org/comments.pl?noupdate=1&sid=40718&page=1&cid=1080994#commentwrap [soylentnews.org]
    about drawing vector graphics on a scope, which in subsequent replies brings up the J2ME asteroids game again. It also shows a way to write a Factorial function without iteration. And how to do Trig functions when you have only integers but no floating point.

    --
    Young people won't believe you if you say you used to get Netflix by US Postal Mail.
    • (Score: 2) by turgid on Thursday December 02 2021, @05:11PM (1 child)

      by turgid (4318) Subscriber Badge on Thursday December 02 2021, @05:11PM (#1201553) Journal

      I wrote fixed-point trig functions once and used them to calculate pi.

      • (Score: 3, Interesting) by DannyB on Thursday December 02 2021, @05:45PM

        by DannyB (5839) Subscriber Badge on Thursday December 02 2021, @05:45PM (#1201561) Journal

        I wrote a Java function to calculate PI to arbitrary precision, using only BigInteger, no trig, only add, subtract, multiply and divide. It was an efficient algorithm based on some efficient formula. I think I saw it years ago on Hacker News.

        I tried to post that function here, but alas SN just won't allow it.

        Then I built a very similar function that used Java's BigDecimal.

        Someone, not myself, wrote a set of Trig and other functions for the BigDecimal class. BigDecimal is excellent for business numeric values such as money, but not quite like floating point. With BigDecimal you must specify precision limits, rounding modes, etc. There are no defaults. You must specify them.

        --
        Young people won't believe you if you say you used to get Netflix by US Postal Mail.
  • (Score: 2) by DannyB on Thursday December 02 2021, @08:14PM (7 children)

    by DannyB (5839) Subscriber Badge on Thursday December 02 2021, @08:14PM (#1201616) Journal

    <no-sarcasm>
    There is some programming you do for fun. There is other programming that pays the bills.
    </no-sarcasm>

    Another fun project (annually, which I just had lots of fun doing) is writing code to do electronic filing as per specification IRS Pub. 1220 (Rev. 10-2021) to communicate with mainframes in an archaic fixed record format designed in the days when dinosaurs roamed the earth.

    --
    Young people won't believe you if you say you used to get Netflix by US Postal Mail.
    • (Score: 3, Funny) by DannyB on Thursday December 02 2021, @10:33PM (4 children)

      by DannyB (5839) Subscriber Badge on Thursday December 02 2021, @10:33PM (#1201661) Journal

      Well here is a first, for me anyway.

      IRS Pub 1220 (Rev. 10-2021). Available here:

      https://www.irs.gov/pub/irs-pdf/p1220.pdf [irs.gov]

      There is an error!

      ERROR on IRS Pub 1220 (Rev. 10-2021)
              Page 113 of PDF
                      Record B, Form 1099-NEC
                              Positions 548-722 Blank 173 length
                                      WRONG: the length is 175 not 173!

      It pays to be a geek and pay attention to detail.

      --
      Young people won't believe you if you say you used to get Netflix by US Postal Mail.
      • (Score: 0) by Anonymous Coward on Friday December 03 2021, @05:18AM (3 children)

        by Anonymous Coward on Friday December 03 2021, @05:18AM (#1201745)

        They make errors in the length calculation all the time. The specification says, or at least used to say, that the "length" column is "advisory" and that you should only rely on the position. However looking at this year's with my experience in the past, I vaguely remember there being a different layout in that same area with more length 1 records. Perhaps they changed them all to blanks this year or in the past and just copy-pasted the 173 instead of adding the two 1s as well. Perhaps you could check the IRS's test files to see what they do.

        • (Score: 3, Insightful) by DannyB on Monday December 06 2021, @03:40PM (2 children)

          by DannyB (5839) Subscriber Badge on Monday December 06 2021, @03:40PM (#1202513) Journal

          If you go with 173 instead of 175 then your total record length is 748 instead of 750, and all your other field positions are wrong. If you assume that it is length which is wrong, then all other field positions line up, record length if 750 and everything else fits correctly. So the preponderance of the evidence is that there is a single small mistake, instead of all other field positions and the record length being wrong for the "B" record.

          --
          Young people won't believe you if you say you used to get Netflix by US Postal Mail.
          • (Score: 0) by Anonymous Coward on Monday December 06 2021, @10:22PM (1 child)

            by Anonymous Coward on Monday December 06 2021, @10:22PM (#1202600)

            Maybe I am misreading you, but where did I suggest the alternative?

            • (Score: 0) by Anonymous Coward on Monday December 06 2021, @11:36PM

              by Anonymous Coward on Monday December 06 2021, @11:36PM (#1202612)

              I think I got it. That last sentence is missing its introductory phrase of "if you really cared" that I could have sworn I added.

    • (Score: 1, Funny) by Anonymous Coward on Sunday December 05 2021, @10:39AM (1 child)

      by Anonymous Coward on Sunday December 05 2021, @10:39AM (#1202326)

      You know, you're on to something. That format is just screaming out in the hope that you implement it in COBOL. Two birds with one stone, that is. You can add COBOL experience (I hear it is in high demand /s) and IRS/financial software experience to your resume. What better way to make yourself seem too old and too expensive to hire at the same time?

      • (Score: 1, Funny) by Anonymous Coward on Saturday December 18 2021, @05:13PM

        by Anonymous Coward on Saturday December 18 2021, @05:13PM (#1206170)

        Cobol is a form of Ransomware?