« first day (1761 days earlier)      last day (1190 days later) » 

03:49
 m ← 2 3 4 ⍴ ⍳ 24
      m
 1  2  3  4
 5  6  7  8
 9 10 11 12

13 14 15 16
17 18 19 20
21 22 23 24
      ⌽m
 4  3  2  1
 8  7  6  5
12 11 10  9

16 15 14 13
20 19 18 17
24 23 22 21
      ⊖⍤1⊢m
 4  3  2  1
 8  7  6  5
12 11 10  9

16 15 14 13
20 19 18 17
24 23 22 21
⍝ Why we still need ⌽, it seems to me ⊖ can do eveything ⌽ can do
What ⌽ can do, but ⊖ can not do?
⍝ ⌽ can not specify any rank?
04:11
Sugar, I suppose? Specifying the axis when you want the other would be annoying
 
3 hours later…
07:00
Assume we have rank 3 arround, x => row, y = colum and z-axis, which one is leading axis?
x is leading axis?
07:46
any way to use ' inside a character vector
 
1 hour later…
RGS
RGS
09:16
@Itay123 Just double it: ⋄ 'I''m happy to help'
@RGS I'm happy to help
RGS
RGS
@elliptic00 The “columns” are the last axis always, the rows are the axis that precedes it, and what I think you are calling the “z-axis” is actually the first one. Take a look at this 3D array: ⋄ 2 3 4⍴⍳24
@RGS
 1  2  3  4
 5  6  7  8
 9 10 11 12

13 14 15 16
17 18 19 20
21 22 23 24
RGS
RGS
Its shape is 2 3 4. It has 2 slices, that we see here as two matrices separated by a blank line. The leading axis contains these slices, so the leading axis here has length 2.
Then each “matrix” or “slice” or “plane” contains 3 rows (the second axis) and 4 columns (the third, and last, axis).
@RGS nice, thanks,
RGS
RGS
09:19
Take a look at the diagram in here: https://course.dyalog.com/Array-model/#rank-vs-axis
It should help you out. The diagram uses the 3D array `2 3 4⍴⎕A` instead of the integers.
@elliptic00 You are right, ⌽ and ⊖ do the “same” thing, except they have a different default axis. But you can use axis specification on both.
⍝ ⊖ uses the leading axis by default
      ⍝ ⌽ uses the last axis 'by default' -> not sure about that, I can not specify axis for ⌽
RGS
RGS
You could delete one, or the other, from the APL keyboard :P But it's a nice amenity, to have ⌽ to rotate along the last axis. You can always write ⊖ as ⌽[1], but writing ⌽ in terms of ⊖ requires that you take a look at the array: ⌽array ←→ ⊖[≢⍴array] array
@elliptic00 You can specify an axis for : ⋄ ⌽[1]3 4⍴⎕A
@RGS
IJKL
EFGH
ABCD
RGS
RGS
See? I used as “rotate first”.
⍝ @RGS , I like the way ⌽[1] to index axis, it is easier to understand,
Thanks,
RGS
RGS
09:26
My pleasure. But it is recommended that you use when you want to rotate the first axis :)
Yep.... save a few character. APL -> every character count:)
every character matter, APL
@elliptic00 You're absolutely right, but precedes the invention of the rank operator by a long time. In fact, originally, Iverson had 64 functions like but it was found that those three were enough to express most things without it becoming too awkward. Just and would have worked too, but ⍉⌽⍉M to flip vertically was apparently too verbose.
2
09:47
Iverson try to replace all mathematical symbol with APL :), I love the idea
 
2 hours later…
11:31
Announcement: APL Campfire in six hours, featuring Zbigniew Stachniak (Computing historian, associate professor of computer science at York University in Toronto, and author of Inventing the PC).
 
5 hours later…
16:37
Could someone help me? I would need to write a string to memory buffer in Windows.
I tried it like this:
⎕na 'P msvcrt|malloc U8'
addr←malloc 256
'put' ⎕na 'P msvcrt|memcpy P <0T[] U8'
put addr 'test string' 255
74952720
'get' ⎕na 'P msvcrt|memcpy >0T[] P U8'
get 255 addr 255
┌────────┬───────────┐
│18746816│test string│
└────────┴───────────┘
'len' ⎕NA'P dyalog64|STRLEN P'
len addr
1
'getstr'⎕NA'msvcrt|wcsncpy >0T[] P U8'
getstr 256 addr 256
test string
'getstrd'⎕NA'dyalog64|STRNCPY >0T[] P U8'
getstrd 256 addr 256
t
As you can see memcpy can read the buffer but STRLEN notice only the first character and the same with STRNCPY.
 
1 hour later…
17:43
@KamilaSzewczyk Does the name Zbigniew Stachnia look like something you'd be comfortable pronouncing? If so, does Google Translate's pronunciation sound right to you?
17:58
i can pronounce it and send a recording in a short while
It is fine. He's used to it. Feel free to join in :-)
18:14
v ← 1 2 3
w ← (1 2 3)
is v and w are the same thing?
@elliptic00 Yes.
⋄ v ← 1 2 3 ⋄ w←(1 2 3) ⋄ v≡w
@Adám 1
when to use (1 2 3) when not to use (1 2 3) then..
(1 2 3) is just bracket three numbers?
like (1*2) + 1 ?
Yes. But you need it to delimit it from adjacent values, e.g. ⎕←0(1 2 3)4 is a 3-element vector.
@Adám
┌─┬─────┬─┐
│0│1 2 3│4│
└─┴─────┴─┘
18:24
@elliptic00 Yes, there you need it to force order of evaluation.
@Adám , thx..
19:02
v ← 1 2 3 4
      bit ← 2 <¨ v
      bit
0 0 1 1
      v[bit]
INDEX ERROR
      v[bit]
       ∧
      v[⊂bit]
INDEX ERROR
      v[⊂bit]
       ∧
      ⊂bit⌷v
LENGTH ERROR
      ⊂bit⌷v
any idea how to extract 3 4 from vector v?
@elliptic00 ⋄ v←1 2 3 4 ⋄ bit←2<¨v ⋄ bit/v but note that is the same as < here because < is a apl.wiki/scalar_function
@Adám 3 4
@Adám, cool, thx
19:31
The latest APL Campfire is now available to watch:
19:47
@Adám Is there Graphical output in APL?
20:05
@Fmbalbuena I think every APL has some way of doing graphics, but it varies from implementation to implementation. Which one do you use?
@Adám I don't have APL installed on my computer
@Fmbalbuena Which OS do you use?
@Adám Windows 10
OK, then Dyalog APL has something known as ⎕WC which is basically a cover for WinForms and allows direct OO-based graphics. Cross-platform, there's also an HTML renderer (Chromium Embedded Framework) which allows you do do anything using HTML/JS/CSS and all such libraries.
⎕WC is easiest to get started with:
'f'⎕WC'Form'
'f.c'⎕WC'Circle' (50 50) 20
makes:
what happened?
@Adám you posted wrong image.
20:14
Yes, but it is right now, although I amended the code slightly. I added 'My drawing' to the first statement.
what does
'f'⎕WC'Form'
'f.c'⎕WC'Square' (50 50) 20
do?
It isn't quite right, but
'f'⎕WC'Form'
'f.c'⎕WC'Rect' (50 50)(20 20)
makes:
The (50 50) is here the top left corner (in percent of the form size), and (20 20) is the hight and width (in percent of the form size).
For the circle, the (50 50) was the centre point and 20 was the radius.
sorry. is possible to check the click (if the user clicked the rectangle. output "You Clicked!")
Yes, very easy: f.c.onMouseDown←'⍎⎕←''You Clicked!'''
@Adám Does ⎕WC use the HTML renderer on other platforms and WinForms on Windows?
(I was looking up "dyalog apl chromium embedded framework" and got this old document, which uses ⎕WC but says it creates an HTML renderer)
20:25
@user No, ⎕WC only works on Windows, but there are people working on porting to an HTML-based rendering.
@Adám what programming language the interpreter/compiler is written?
Mostly C, some APL, and little C++ and assembler.
is there unofficial python interpreter?
Are you asking the there exists an APL interpreter written in Python?
@Adám yes
20:29
@Fmbalbuena Not really. There's this and then there's the Python-APL bridge
For cross-platform graphics, you can write
'h'⎕WC'HTMLRenderer' '<title>My Drawing</title><svg><circle cx="75" cy="75" r="50" stroke="black" fill="transparent"></svg>'
to get
You can also construct that HTML code using the ⎕XML tool.
Ah, cool
ok so... is there APL self-interpreter without exec()
(same applies for eval)
About pynapl, by the way, does it allow you to do run APL code like apl.eval("⎕←'foo'") now?
@Fmbalbuena Why would you want that? (execute) is a core function in APL, and has always been in every version, afaik.
I think I tried it once and couldn't use ⎕← from inside Python (and I had some problems loading it later and never got around to exploring it more)
20:31
@user Didn't it before?
@user I seem to recall that is used to pass arguments or something.
Hmm, let me try it again then
@Adám Pass arguments to what?
From Python to APL or vice versa.
Oh, how is that used? Do you mean you can give user input to functions prompting you with ⎕: using ⎕←?
Well, more streamlined than that. Basically, the arguments to the Python function get inserted into the various s in the APL expression.
Interesting, are there any examples of how that's used?
20:37
Hm, no, it seems I remembered that wrong. It is in the Python code that is the placeholder for APL arguments: '⎕+⎕' py.Eval 2 2 on the APL side uses Python to evaluate 2+2
Whereas APL functions are exposed as Python functions of 0/1/2 argument on the Python side.
Going back to using ⎕XML with the HTML renderer, if m is the matrix:
┌─┬──────┬──────────┬────────────────────┐
│0│title │My Drawing│                    │
├─┼──────┼──────────┼────────────────────┤
│0│svg   │          │                    │
├─┼──────┼──────────┼────────────────────┤
│1│circle│          │┌──────┬───────────┐│
│ │      │          ││cx    │75         ││
│ │      │          │├──────┼───────────┤│
│ │      │          ││cy    │75         ││
│ │      │          │├──────┼───────────┤│
│ │      │          ││r     │50         ││
│ │      │          │├──────┼───────────┤│
You can do 'h'⎕WC'HTMLRenderer'(⎕XML m) to create the above-shown window.
So you can use APL's array manipulation to build up your DOM tree represented in this matrix form (the first column is the node level, the second is the node type, the third is the content, and the fourth is a matrix of attribute-value pairs), which you then convert to XHTML and render.
@Adám Oh cool, I would've expected some args global variable, honestly
Have a look at the repo readme!
Oh yeah, I should've just read that in the first place :P
21:30
any idea how to clear all output after the current cursor position in RIDE?
I use mouse to 'cut', but the space still there.. take lot of space on RIDE
@elliptic00 There seems to be a bug causing the emptied lines to remain. I'll log an issue.
Oh.. i c, .. thanks.. no wondering I can't remove all the empty lines..:)
it is very annoy.. the empty lines pile up very fast.. and very easy to lose my apl function.. :)
@elliptic00 You should be saving your functions in files.
21:47
Yep, I should do that..thx, hope the next release of RIDE will be fixed
Yeah. I also hope the next release will make it easier to work with source in text files. I just logged another issue about that.
APL is very powerful language.. hope more ppl will play with it.. and appreciate the power of APL.. good IDE is first step for someone who want to play around with ..
@elliptic00 Meanwhile, if you create the directory /tmp/mysrc and start coding by entering ]link.create # /tmp/mysrc then the functions you create and edit using the editor should automatically be saved to text files there.
@Adám, nice..
how to load the code to RIDE after same it to file?
Firstly, you should understand that RIDE is "dumb". It is just a graphical interface to the interpreter. The interpreter is doing all the work, including loading and saving things.
If you use the above method of ]link.create then the exact same command will load your code next time.
21:53
oh.. nice.. thx
]LINK.create # '/tmp/x.apl'
Source directory not found: /tmp/x.apl
      ]LINK.create # /tmp/x.apl
Source directory not found: /tmp/x.apl
IDE:
  Version: 4.3.3463
  Platform: MacIntel
  Date: 2020-07-07 10:44:21 +0100
  Git commit: 0cd6e9faf39a5d6a5f5caa94d1ff51743d5cdd75
  Preferences:{
    "colourScheme":"Francisco Goya",
    "kbdLocale":"en_US",
    "zoom":"-1"
  }

Interpreter:
  Version: 18.0.40684
  Platform: Mac-64
  Edition: Unicode/64
  Date: Jun 19 2021 at 00:08:08
@elliptic00 That /tmp/x.apl sounds like a strange name for a directory.
oh.. directory?
]LINK.create # '/tmp/apl'
Source directory not found: /tmp/apl
Did you create it first, as I wrote above?
oh.. I thought RIDE will create it for me.. my bad.
⎕cmd 'mkdir /tmp/apl'
      ]LINK.create # /tmp/apl
Linked: # → /tmp/apl
it works..thx
@elliptic00 The next version will create it for you :-)
@elliptic00 Btw, APL can create directories with ⎕MKDIR'/tmp/apl'
22:04
awesome..
@elliptic00 If you install .NET then you can even edit the source files and your changes will automatically be picked up by APL. Otherwise, I think that if you open the item in the APL editor, it'll ask you to re-read the file. You can also do ]link.refresh to read in all changes.
@Adám, good to know.. unfortunately, I'm on macOS,
@elliptic00 That's not a hindrance. It is right here
@Adám, nice.. awesome... I will try it.. thx:)

« first day (1761 days earlier)      last day (1190 days later) »