« first day (1092 days earlier)      last day (1555 days later) » 

12:07 AM
Actually, if the strand notation would be given higher precedence, functions returning functions also could, making the language visually similar to traditional APL (except operator chains being evaluated in reverse order)
@dzaima Strand can work because types are dynamically checked at run-time, starting from the end of a line of code.
 
 
2 hours later…
2:10 AM
@KritixiLithos yes, I did a bit of work on slex! ;o
 
2:34 AM
CMC/CMQ: Can you raise SIGSEGV in APL?
 
 
1 hour later…
3:57 AM
0
Q: Preserving large numbers when converting to characters in APL

Jaden RanzenbergerI have the following number in APL 1200000002341 When I do the following k←1200000002341 k←⍕k The value of k becomes 1.2E12. How do I preserve the intricacies of the number when converting to character form?

 
 
2 hours later…
6:09 AM
Random fact: one side effect of APL bounty hunting is that I get unusually many Necromancers.
 
 
1 hour later…
7:10 AM
@Bubbler but strands still can't contain functions. aka (⊃a)2 would sometimes be a function applied to 2, and sometimes an array of the gotten item and 2
 
7:34 AM
@Bubbler Yes, in 6 bytes.
 
@dzaima IMO, it's the same in regular APL.
Like, the difference of (1 1)2 and (1+÷)2
 
@Bubbler eh, yeah. just that now understanding the correct interpretation of anything dealing with variables without context is pretty much impossible
making dzaima/apl do this wouldn't be that hard, but until next weeks tuesday I don't plan on having free time
 
7:49 AM
@dzaima Maybe, but the types actually used will be mostly simple, so I don't see an immediate problem.
@Adám 6 bytes? How? Is it related to a system function?
 
8:42 AM
⎕←⍎⍣¯1⊢⍬
 
@Adám
VALUE ERROR
 
@SirBogman Hi. Interested in APL too, or just J?
 
9:42 AM
@Adám Is there a way to get raw stdin? (to catch a Ctrl+E for example on the terminal, for example)
 
10:15 AM
@rcabaco I think you can use ⎕ARBIN.
 
10:38 AM
@Adám Keep getting a DOMAIN ERROR. How would i use ⎕ARBIN for stdin?
Also have to look at ⎕SM
 
 
1 hour later…
11:45 AM
@rcabaco I'm not an expert on the matter, and the in-house expert isn't working today. I'll ask him tomorrow.
 
12:18 PM
@Adám - (My brain does weird things before I'm completely awake...) Does APL - or specifically Dyalog - have built-ins for treating vectors as polynomials in one variable? Writing functions for addition and subtraction are almost trivial; multiplication and division ... aren't.
 
@JeffZeitlin Try APLcart
 
(That's odd... I can get to it with Chrome, but Firefox refuses to connect - "The authenticity of received data could not be verified")
 
@JeffZeitlin Works on FF for me. Maybe clear your cache?
 
@Adám - This is literally a brand-new installation of FF - never used before. It's more likely our stupid netnanny software coupled with Group Policy setting that are truly fecal.
Our network is so "secure" that the Feds have taken lessons from us.
But if I don't use https:, FF will connect.
 
 
1 hour later…
1:42 PM
@Adám - OK, I'm looking over Lesson 2 now. I get dfns (after our chat yesterday), and tradfns are how I learned APL lo these many years ago. I'm not sure I see how 'tacit' fns are a Thing.
 
@JeffZeitlin Watch the live webinar tomorrow.
 
@Adám What time will that be? I'll take it UTC or (US)EST.
 
Sixteen, EST5EDT, so 11:00 AM my time. OK. How long do they usually last?
Oh, it even says 11AM in NYC... :)
 
@Adám what is the webinar on?
 
2:02 PM
@TomCockram "WEBINAR -Train Spotting in Dyalog APL
Join Richard Park for our first webinar of 2020 on Thurs 23rd January at 16:00 UTC where he discusses the origins of the train syntax for tacit programming in #DyalogAPL"
 
@TomCockram ^
 
@Adám is ⎕SM still supported or is it there for legacy reasons? I ask because RIDE doesn't seem to support it.
 
@JeffZeitlin This one's looking like maybe 30-40 mins, maybe less - definitely under an hour!
 
@RichardPark OK, cool - just wanted to make sure I could accommodate lunch.
 
@JeffZeitlin The longer I talk the longer you starve? Too much power for one man
 
2:14 PM
@RichardPark - No, just that since I'm in a User Support rôle, I can't just take my lunch break at any old random time; we have to have coverage on the Support Desk.
 
P←2 2⍴'abcd'
B←2 2⍴'AAA' 'BBB' 'CCC' 'DDD'
P{⍺@2⊢⍵}¨B. ← How can I achieve this without the dfn?
 
@RichardPark - But if I know that I need to adjust my break time, I can almost invariably reach an accommodation with co-workers, and the supervisor will allow it, as long as we have mandated levels of coverage.
 
@JamesHeslip P⊣@2¨B
 
@Adám Can you explain this please? I don't really follow.
 
2:30 PM
@Adám - The APLWiki doesn't mention it, but is Dyalog the same Dyadic Systems that released an APL for the Convergent Technologies "Miniframe" UNIX SVR4-based system?
 
@JamesHeslip Slightly more explicity version: P(⊣@2⊢)¨B
P{⍺@2⊢⍵}¨B
P({⍺}@2⊢{⍵})¨B
@JamesHeslip Oops disregard everything I just wrote
 
@JeffZeitlin Yeah, basically. But the company was taken over by a triumvirate of customers, changing the company name to match the main product.
 
2:46 PM
/me nods. Just an interesting bit of history that was mentioned; I had connections with CT (Dad was their top tech guy).
 
3:18 PM
I'm interested in APL but I've never used it and don't know much about it.
 
@SirBogman I'll be happy to tell you more about it, and even give you quick intro course if you're interested.
APL is very different. It has a powerful, yet simple array model, and uses its arrays to represent everything, leading to very few data types. It has a large vocabulary of mnemonic symbols for all core functionality, and has no reserved words. It allows, but doesn't enforce, many programming paradigms, from the procedural to the functional style, including both tacit (points-free) programming and OOP.
 
As a bit of historical information, it developed out of a mathematical notation that Kenneth Iverson designed - but I don't recall why.
 
Iverson was unhappy with the traditional mathematical notations being ambiguous and unsuitable for description of many algorithms and processes, while also having way too many rules to remember.
The inlining of his alternative mathematics, "Iverson Notation", makes for a general-purpose language, which is especially popular among domain experts that just need to get the computer to do things for them with having to worry much about machine internals and "programming". It is strongest in mathematical subjects, especially related to linear algebra, but is also used in data munging and exploration, database-like operations, production planning and control, simulation, etc. etc.
 
3:35 PM
One of the things that attracted me to APL after my brief exposure to it in a "survey of programming languages" course in college was that it was evident from that brief exposure that even in its older forms, it was a good strong basis for building what came to be called "domain-specific languages".
 
That's very true, and that's another common usage. E.g. the powerful database system FlipDB and the statistical analysis package TamStat both uses APL-based DSLs.
 
(Now to convince the detractors that it's not a "write-only language"...)
I also seem to remember an implementation of Conway's "LIFE" that didn't require very many lines of APL...
 
3:55 PM
@JeffZeitlin That was a long time ago. Now Conway's Game of Life doesn't require very many characters of APL:
⋄ GoL←{≢⍸⍵}⌺3 3∊¨3+0,¨⊢
⋄ ⎕←⊂glider←↑⍬(0 1 1 1 0)(0 1)(0 0 1 )⍬
⋄ ⎕←⊂GoL glider
 
@Adám
┌─────────┐
│0 0 0 0 0│
│0 1 1 1 0│
│0 1 0 0 0│
│0 0 1 0 0│
│0 0 0 0 0│
└─────────┘
┌─────────┐
│0 0 1 0 0│
│0 1 1 0 0│
│0 1 0 1 0│
│0 0 0 0 0│
│0 0 0 0 0│
└─────────┘
 
@JeffZeitlin Any programming language can be written in a "write-only" style. There's no reason to do so for APL other than for code golf.
 
How does APL compare to J, other than the larger set of characters used? I'm definitely not an expert but I'm getting comfortable with hook, forks, etc. in J.
 
As I recall, J was designed to be essentially APL-that-didn't-require-the-funny-characters.
 
I would expect J to be easier to type, but not necessarily easier to read, if I learned what the APL characters meant.
 
4:01 PM
Not only that. APL lives on with basically a 50 years+ backwards compatibility of code, while J had the chance to smooth out some historic warts. I personally find APL much much easier to parse in the head, as every symbol stands on its own, while J uses bi-glyphs and even some tri-glyphs with terrible overloading of . and :. Lately, APL has gained many of the more powerful built-ins from J, and also tacit programming ability.
 
Interesting
Is Dyalog your preferred dialect?
 
Yes. (But I'm heavily biased.)
Newer APL implementations tend to follow Dyalog's lead.
@SirBogman Forks work exactly as in J, while the f g hook is simply ⊣ f g in APL (equivalent to J's [ f g). Instead, the "2-train" in APL (f g) is an atop, for which J needs the ugly and non-syntactic Cap ([: f g).
 
That looks nice. I am not a fan of the cap.
 
APL also has the Beside operator ("conjunction" in J lingo) which makes hook-like things easy: X f∘g Y is X f g Y and together with commute you can make f∘g⍨Y which is Y f g Y.
 
That looks nicer than X (f g) Y and (f g)~Y, which I think are the same things in J.
 
4:13 PM
Right.
 
Concerning 'Beside'... X f∘g Y is X f g Y, as you said, which is interpreted as X f ( g Y ), correct? As in, apply g to Y, then apply f to X and that result?
 
Yes.
 
So g must be a monadic function/operator?
 
Correct. (And function it is.)
 
Right. Operator is something different in APL.
Is there a way to do a composition where g is dyadic? e.g. X f g Y where I want to take X g Y and apply f to X and that result?
i.e., X f (X g Y)
 
4:17 PM
Is function/operator precedence different than J? It took some time to get used to everything having essentially the same precedence in J.
 
@SirBogman Exactly as in J.
 
APL 'precedence' was described to me as "right to left".
As opposed to having some functions bind more tightly than others.
 
@JeffZeitlin X(⊣ f g)Y
@JeffZeitlin Basically, but operators do come before functions, and stranding before that (in Dyalog).
 
@SirBogman - I've been working my way through the "Bookmarked Conversations" from this chatroom; they're actually a pretty good base for a book: "Learning APL: A Conversational Approach" :)
( @Adám - You might actually want to think about that...)
2
 
Interesting
 
4:26 PM
@JeffZeitlin You could easily write your own composition operator to do this though:
⋄ JZ←{⍺ ⍺⍺ ⍺ ⍵⍵ ⍵}
⋄ ⎕←2+JZ⍴3
 
@Adám
5 5
 
@JeffZeitlin i don't think it'd fit a book format, though a non-SE one might be interesting
 
Ah. Yes, that dop is definitely a clear way to do that.
 
In J, lots of operators have monad/dyad versions that mean different but somewhat similar things. Does APL do this too or use more unique symbols?
 
Incidentally, why "D-function" and "D-operator" for the squigglybracket functions/operators?
 
4:29 PM
@SirBogman ⍞←3/4 5 ⋄ ⍞←+/4 5
⍞←3 4
 
@RichardPark 3 4
 
@SirBogman - J inherited that aspect of APL
 
⍞←3/4 5
 
@RichardPark 4 4 4 5 5 5
 
⍞←+/4 5
 
4:30 PM
@RichardPark 9
 
@JeffZeitlin Originally it came from Direct Function or Dynamic Function.
 
_/me nods. Makes sense.
I'd actually guessed at 'dynamic'.
 
But dynamic is a bad fit, since dfns have lexical scoping while tradfns have dynamic scoping.
Iverson invented something he called "direct definition" which was one of the inspirations for dfn syntax.
A direct function (dfn, pronounced "dee fun") is an alternative way to define a function and operator (a higher-order function) in the programming language APL. A direct operator can also be called a dop (pronounced "dee op"). They were invented by John Scholes in 1996. They are a unique combination of array programming, higher-order function, and functional programming, and are a major distinguishing advance of early 21st century APL over prior versions. A dfn is a sequence of possibly guarded expressions (or just a guard) between { and }, separated by ⋄ or new-lines, wherein ⍺ denotes the left...
 
4:53 PM
@Elronnd i also know that some other hdf'ers golf/used to golf, there's quite an overlap between the two communities
@Bubbler so for example with functions that return functions, f←{cond:+⋄-} would have to be used like 10(f)3?
 
Looks like it's similar enough to J that I could be comfortable trying it out. Is there a good reference for all of the characters?
 
@SirBogman - if you install the Dyalog APL, the Help files and other documentation that come with it will tell you everything you need/want to know.
@SirBogman - Dyalog is also a good terp to work with for getting familiar with APL.
 
@Deadcode i ended up finishing it (barely beats bubbler's solution), but a simple approach by enumerating all possible strings that match the regex, and checking if the string belongs to it, is almost half as short, so i didn't post it
also i'm pretty sure you can get a short-ish solution in apl to codegolf.stackexchange.com/questions/161108 by brute-forcing using ⎕r
 
@KritixiLithos as far as i understood it, no, just 10 f 3 would work. afaict Bubbler's idea is just like regular APL, just that functions now are a primitive type, but still have the same syntax
 
5:24 PM
(for reference, f←{cond:+⋄-} ⋄ 3(f 1)4 in dzaima/APL already works just fine because i've been too lazy to make dfns error when not returning arrays :p)
@dzaima still went ahead. Just made Fun extend Value and changed the "[FM←]|FN" pattern for monadic calls to "[FM←]|F[FN]", no dyadic/monadic distinction
hehe. Some things are broken (maybe rightfully so - ⎕NC is equal for both arrays & fns), but ¯\_(ツ)_/¯
hm, this also works. seems ⋄-arrays prefer value arrays over function arrays, so those just never get created in this model.
 
5:50 PM
@mabel Hello. Interested in APL?
@KritixiLithos I think there was a special "conference edition" interpreter that could do that.
 
@Adám - Does Dyalog support polar notation (0ad0 or 0ar0)for complex numbers, or just rectangular (0J0) notation?
 
@JeffZeitlin Only rectangular, but it is fairly easy to define:
⋄ ar←⊣ׯ12○⊢
⋄ ⎕←2 ar 3
 
@Adám
¯1.979984993J0.2822400161
 
6:06 PM
OK, that's a tacit function; if I'm reading it properly, you're multiplying the left argument by e-to-the i times the right argument.
 
@JeffZeitlin Correct.
 
And "cis" would therefore also be a valid name for that function, so that you could write (e.g.) 2 cis 3, matching a "conventional" notation for polar-form complex numbers.
(and here's me thinking that I'd have had to write it as a tradfn...)
 
And for degrees:
⋄ ad←{⍺ׯ12○○⍵÷180}
⋄ ⎕←2 ad 30
 
@Adám
1.732050808J1
 
Got it!
Only downside, really, being that the spaces are necessary; I couldn't write 2ad30; the best I could hope for would be a complaint that there's no (niladic) function ad30
 
6:15 PM
@JeffZeitlin Technically, you can remove the first space, but I wouldn't recommend it, as relying on that behaviour prevents extending the language.
@JeffZeitlin Another downside is that vectors of complex numbers either need parentheses, (2 ar 3)(4 ar 5), or vectorising 2 4 ar 3 5
 
Yes, but the need for parens looks like it's mostly a "knock-on" effect of needing the spaces.
Because in the rectangular notation, I don't need to parenthesize - 1J1 2J2 0J3.14159265
 
@JeffZeitlin How about:
⋄ R←⊣/¨×¯12○⊢/¨
⋄ ⎕←R(2 3)(4 5)
 
@Adám
¯1.979984993J0.2822400161 1.134648742J¯3.835697099
 
Optionally R(2,3)(4,5) of course.
 
OK, that one I'm not quite following.
The circle function is the same as before - e-to-the i times right-argument, but I'm not 'getting' the rest of it'
 
6:29 PM
@JeffZeitlin ⊣/¨ is "left-most element of each"
 
Ah. And you're applying the circle function to the rightmost element of each
 
6:45 PM
It's really a bit sad that there's no way to define a "left-adic" function, so that for example one could name the ar function from earlier as cis instead, and define a "left-adic" function degrees, letting us write 3 cis 30 degrees.
 
@JeffZeitlin Parsing would become… difficult. But how about:
⋄ cis←{⍺ׯ12○(⍵~d)×(○÷180)*⍵∊⍨d←⊂'degrees'}
⋄ ⎕←3 cis 3
⋄ ⎕←3 cis 30'degrees'
 
@Adám
¯2.96997749J0.4233600242
2.598076211J1.5
 
@JeffZeitlin Or this:
⋄ cis←{⍺ׯ12○(○180÷⍨⍎)⍣(80=⎕DR⍵)⊢⍵}
⋄ ⎕←3 cis 3
⋄ ⎕←3 cis '30'
 
7:01 PM
@Adám
SYNTAX ERROR
 
⋄ cis←{⍺ׯ12○(○180÷⍨⍎)⍣(80=⎕DR⍵)⊢⍵}
⋄ ⎕←3 cis 3
⋄ ⎕←3 cis '30'
 
@Adám
¯2.96997749J0.4233600242
2.598076211J1.5
 
@Adám OK, both of those last two left me a little lost.
 
@JeffZeitlin Not so much the code that's interesting, but rather the "notation" it affords you.
Actually, the last one allows 3cis'30' without spaces!
 
@Adám Oh, I definitely like the notational conveniences, but I also like understanding what's going on! :)
 
7:05 PM
@JeffZeitlin Sure. Which part(s) seem to be problematic for you?
 
@Adám I'll get back to you; just had a trouble-ticket-by-appointment come around. But the problems are around those dieresis functions and epsilon.
 
@JeffZeitlin OK, cool. ttyl.
 
7:40 PM
@Adám - OK, got that ticket CLOSED! :D (Been tearing out what's left of my hair for close to two months on this; the problem turned out to be our idiotic Group Policy settings...)
 
@JeffZeitlin OK, so and ? You know by now, right?
 
OK, dieresis-tilde is commute - take the function to the left, swap the arguments around, and apply. 3 rho d-t 2 is actually 2 rho 3.
 
Wait, you can't type APL characters here?
 
I'm not sure how epsilon works, and the enclose confused me.
Back in lazy mode.
Hold on...
 
is simply membership:
⍞←3 1 4 1 5∊2 7 1 8
 
7:44 PM
@Adám 0 1 0 1 0
 
OK, just switched to the Dyalog IME on this winbox.
 
⊂'degrees' simply encloses the charvec in a scalar.
 
So in cis←{⍺ׯ12○(⍵~d)×(○÷180)*⍵∊⍨d←⊂'degrees'}, you're checking to see if the string degrees is a member of the right argument, presumably a vector of a number and the word degrees if we're looking for that.
So that will return 0 or 1.
 
Yes.
And a number raised to the power 0 or 1 will give 1 or the number itself. This chooses the multiplication factor for rads→rads or degs→rads.
 
OK, now I see what that is.
Then, you delete degrees from the right argument (if it's there), and multiply it by the selected conversion factor.
 
7:50 PM
Right. Simplez.
 
That result becomes the imaginary part of the final answer, and the left argument becomes the real part
Or rather, the left argument becomes the multiplier of both.
because that's how polar complex numbers work.
 
Yeah.
 
8:14 PM
Now, in cis←{⍺ׯ12○(○180÷⍨⍎)⍣(80=⎕DR⍵)⊢⍵}, you're checking to see if the right argument is a character vector; this will return 1 or 0. But the ⊢ takes its right argument, so I'm not clear on why the test has any effect.
 
@JeffZeitlin is the power operator which applies the left-operand-function right-operand-array times. is there to prevent that number from stranding with .
 
Ah. So if it's not a character vector, you don't multiply pi by unquote-and-divide-by-180.
 
Right.
 
And the whole power (⍣) expression drops out, leaving the multiply by 0J1
 
Yup.
 
8:26 PM
But if it is a character vector, you unquote ⍵ (obtained from the right-tack function) and multiply. That is, the whole thing from that first ( to the last ) is a function that returns either ⍵ unchanged (if it's not quoted, and therefore radians) or ⍵-converted-from-degrees-to-radians (if it was quoted, and therefore degrees).
Which then gets multiplied by 0J1 and the radius.
Illustrating one of the unique features of APL-family languages - you can compute a function, not just the value of applying a function.
It might also be possible in LISP-family languages - but I'm not prepared to swear to it.
 
I think all functional languages will allow this (even JavaScript), however, the calling syntax may be awkward.
 
I don't think awkward would even begin to describe it...
 
As ngn likes to point out. APL isn't really a fully FP language because functions are not first-class citizens, but it sure does let you do most of what you actually need to do.
 
As far as I am concerned, that's the only test any language needs to pass - does it let you do what you need to do?
 
:-D
 
8:35 PM
All Turing-complete languages are ... I think the word I'm looking for is isomorphic ... but you end up choosing which one to use based on how well it facilitates the particular task at hand.
 
@KritixiLithos What's the longest run that you tested to finish?
 
Which is one of the reasons I object to modern computer education - they don't teach programming, they teach C programming, or python programming, or typescript programming, or et cetera, and as a result, too many people try to hammer that bolt, or use a wrench to drive a nail.
I consider it a matter of pride that I can read and understand code in most languages - obviously, APL still gives me the occasional light conniption.
Because I learned programming, principally as a way of thinking about problems.
Not about putting code on paper (or into a disk file), but about solving the problem.
 
@JeffZeitlin Can you read C?
 
Mostly. Obfuscated C is a problem.
 
Luckily, the code I linked to isn't obfuscated.
 
8:43 PM
It's semi-obfuscated; functions and macros there aren't meaningfully named (and I'd probably need to dig into k.h as well.
OTOH, from what I can see, I'd venture the guess that this is a "pcode" generator.
 
Yeah. K-implementers tend to write in that style.
 
If you want a bit of a giggle, I've done some language implementation of my own; psPILOT (source here) is mine.
 
Unusual choice for implementing a programming language.
 
It seemed to be a relatively simple language, and thus a good candidate to experiment with.
And the choice of PowerShell was more or less to prove to someone that PS wasn't just a glorified WinBatch.
The first implementation of PILOT I was exposed to was actually written in UCSD Pascal, and also implemented a PILOT REPL and program editor.
OK, it's time for me to wrap and head for home. I'll 'see' you tomorrow; I'll also remember to tune in to the Dyalog.tv webinar at 11 (my time).
 
8:59 PM
Have a good night.
 
Trying to learn some J, compared to APL it's simultaneously quite cool and very frustrating
 
9:20 PM
Trying to replicate monadic iota-underbar on matrices, J's I. only works on lists. So far I've got ([:;i.&#,"0&.><&I."1), no idea how I would do it for arbitrary rank.
Also I really miss inline dfns
 
@voidhawk [:<"1$#:I.&, or just $#:I.&, if you're happy with a matrix result.
 
Thanks, that makes sense
 

« first day (1092 days earlier)      last day (1555 days later) »