This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-12
Channels
- # announcements (1)
- # babashka (124)
- # beginners (98)
- # calva (54)
- # cider (32)
- # cljdoc (5)
- # cljs-dev (131)
- # cljsrn (1)
- # clojure (107)
- # clojure-australia (2)
- # clojure-europe (2)
- # clojure-losangeles (1)
- # clojure-norway (3)
- # clojure-uk (28)
- # clojurescript (21)
- # conjure (86)
- # core-async (7)
- # cursive (3)
- # datascript (5)
- # datomic (28)
- # defnpodcast (2)
- # devcards (1)
- # exercism (47)
- # fulcro (22)
- # graalvm (29)
- # graphql (1)
- # malli (5)
- # nrepl (31)
- # off-topic (111)
- # re-frame (23)
- # reitit (4)
- # spacemacs (6)
- # tools-deps (10)
- # tree-sitter (1)
- # xtdb (6)
IDENTIFICATION DIVISION.
PROGRAM-ID. COLLATZ.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 N PICTURE 9999.
77 DIV-BY-2 PICTURE 9999.
77 MODULUS PICTURE 9.
77 STEPS-TAKEN PICTURE 9999.
LINKAGE SECTION.
77 N-PARAM PICTURE 9999.
77 STEPS-NEEDED-OUT PICTURE 999.
PROCEDURE DIVISION USING N-PARAM, STEPS-NEEDED-OUT.
MOVE N-PARAM TO N.
SET STEPS-NEEDED-OUT TO 0.
PERFORM UNTIL N <= 1
DISPLAY N
DIVIDE N BY 2 GIVING DIV-BY-2 REMAINDER MODULUS
IF MODULUS = 0 THEN
MOVE DIV-BY-2 TO N
ELSE
COMPUTE N = (N * 3) + 1
END-IF
ADD 1 TO STEPS-NEEDED-OUT
END-PERFORM.
DISPLAY N.
END PROGRAM COLLATZ.
I think i can see how i can make a single file be a sort of "function" using C style out-params
but the file handling, sql extensions, and object oriented systems still elude me slash aren't supported on Gnu cobol
Out of curiosity, why learning Cobol? And which version of that language? The last time I looked at it was in the 1980s, and I only ever looked at it because it was part of a course required for undergraduate degree. I did the minimum amount of time writing code in it that I could get by with, which was not much given my earlier experience with other programming languages. All I could see were the limitations.
New Jersey and other states are in the news because their unemployment systems, written in cobol, aren't keeping up and they are having trouble finding people to maintain them
Making $ is a perfectly valid reason to learn Cobol, and the one I guessed as most likely ๐
(iirc sean corfield, but that might be wrong and i don't want to bug them without a targeted question)
My experience is only what I mention above -- I suspect there are likely to be at least one or two others with much more experience than I have had.
Yup, twas me @emccue I did COBOL in my first job in very early '80s.
COBOL for an insurance company and then I worked for a compiler company and we ported a COBOL compiler to the Sun 4 (SPARC) and Motorola 88000 chips. It was mostly written in COBOL so it was a bootstrapped compiler.
COBOL came close to being the first ANSI OOP language. For a while it looked like our C++ effort would drag on and COBOL would get there first... but then they slipped too and we got over the line first (X3J16).
All my friends pinged me when they saw the New Jersey stuff about hiring COBOL devs ๐
Depending upon what features that version of COBOL was that you implemented a compiler in, that sounds very limiting. But then, I did not go looking for what data structures COBOL enabled when I learned it. The subset I learned was basically limited to records with fields that were strings or numbers.
@emccue We tended to have one program per file, for small to medium programs and PERFORM PARAGRAPH
to have procedures within a single file.
For larger systems, we built libraries (with LINKAGE SECTION
etc).
Im going off a Cobol for Dummies book published in 97 and "records with strings or numbers" is all i see in the "standard" as well
(I never learned OO COBOL so there may well be much better practice than we used to do back in the '80s)
though google led me to a MicroFocus (whoever they are) page where they described an OO system
Yeah, Microfocus were the king of COBOL compilers back in the day. They had a virtual machine, and their compiler could produce IM bytecode, C, assembler, or native binaries.
It was that compiler that I ported to SPARC and 88000 chips. The former was rebadged as Sun COBOL 1.0
MF led a lot of the innovation back then. Small company, very smart people. Their VM was very nice.
Allowed COBOL to run on pretty much anything.
I actually quite enjoyed writing COBOL, since it was my first programming job. I liked assembler too. Did a lot of that in my first job too.
So, you're learning it seriously enough to get hired by NJ (or another state) to work on their employment system? Or was that part a joke? ๐
they will get people and arrogantly throwing myself at that will definitely make the istuation worse
but i want to know enough that i could write a program in it and can read an existing codebase
Well, Pragmatic Programmer does say to learn a new language every year! ๐
since, at the end of the day, im not super young anymore but chances are there won't be all that many left pretty soon
The real mind blowing thing in COBOL is ALTER PARAGRAPH FOO TO PROCEED TO BAR.
which rewrites a GO TO
on the fly at runtime.
Not surprised they deprecated it. https://cobol.programmingpedia.net/en/tutorial/5584/alter-statement
We ran everything via JCL which was a scripting language. Everything had to be submitted as a background job. There was almost no interactive scripting. It was very primitive.
IBM had a very cool hierarchical database that we used a lot...
(I see that here https://www.tutorialspoint.com/cobol/cobol_data_types.htm)
Oh wow... happy memories ๐ Not.
what was the IBM database? is it still relevant for modern stuff or is it kinda abandonware
IMS. No idea if it's still around.
https://en.wikipedia.org/wiki/IBM_Information_Management_System if anyone is interested.
"The mix of Java and COBOL in the IMS environment is a good way to modernize the core applications on the mainframe."
Thomas Bauer, Computer Scientist
Fiducia & Gad IT AG
Read how to modernize the mainframe
My team (at the insurance company) wrote a mini-IMS database in assembler for use on the 8100 series which was a departmental minicomputer we used. That was fun. Got to write a lot of recursive routines in assembler!
The mainframe world is a strange place...
Even when I was at Sun Alliance in the early '80s, they already had production apps that had been running for decades.
Monolithic slabs of procedural code (at best). Usually patched left, right, and center over the decades because these were "critical" systems and no one would ever sanction a rewrite.
Dozens of files, many tens of thousands of lines long.
Millions of lines overall in each "stage" (Sun Alliance organized its teams into "stages" that each took care of a "generation" of COBOL monoliths).
Stage 4 was the "new projects" team when I was there. Stage 3 maintained the stuff that had gone into production in the last five years or so. Stage 2 dealt with the next oldest. Stage 1 with the real legacy stuff.
If you think millions of lines of COBOL running a business is scary, consider that there are lots of companies out whose businesses run on millions of lines of ColdFusion ๐
(I did CFML on and off for a decade and a half because I was working at Macromedia when they bought Allaire and I left after Adobe bought Macromedia and went freelance as a CF dev for a while)
My current employer was originally a CF shop when I joined a decade ago -- and still has two CF apps (that I'm steadily rewriting in Clojure -- I got rid of all the others over time).
And also it feels like clojures "data oriented situated systems" pitch kinda lends itself to "replace your cobol with this" pitches
It was originally a proprietary tag-based language that let you write dynamic web apps in a mix of HTML and <CF...>
tags.
Over time, it migrated to the JVM and added a JS-like scripting dialog with metaprogramming etc.
PHP was the main competitor, yeah.
Compare https://github.com/framework-one/fw1/tree/develop/examples/userManager with https://github.com/seancorfield/usermanager-example ๐
CFML calls classes "components". class extends=framework.one { ... }
(the class name is implied by the filename)
How we got from there (CFML land) to here (Clojure land): https://github.com/framework-one/cfmljure ๐
On the ALTER
example, I can only imagine Dijkstra's companion article to the well known "Go to considered harmful" that he might write. Perhaps "Run-time modifiable Go to considered abso-fricking-lutely insanely hard to reason about" ?
Anyone have any tutorials they can link on implementing a lazy stream library for collections? Iโm working on a project in fennel and theres some async tasks that would largely benefit from stream programming. Iโve found some patterns implementation to look into but itโs typically all about the observable pattern and Iโm not sure if thatโs a must or just a popular choice.
Documented it and hypothesized an interface here https://github.com/agzam/spacehammer/issues/51
I don't really have any resource to share but I've been working on this topic pretty hard and I still consider it to be an open problem. Most popular abstractions make serious tradeoffs (e.g RxJS observables don't support backpressure nor lazy sampling). If you have specific questions about what I've come up with for https://github.com/leonoel/missionary, feel free to ask.
Thanks! I think https://highlandjs.org/#backpressure supports backpressure but Iโm not sure what other tradeoffs it makes.
in the JVM land, https://www.reactive-streams.org/ is worth consideration too, as it's explicitly designed to be library agnostic