« first day (485 days earlier)      last day (2156 days later) » 

12:22 AM
What was the syntax for an optional argument in a tradfn?
 
Wrap in braces (I think)
 
Sorry, I meant to say what is the syntax for a default argument in a tradfn?
Do I have to use ⎕NC ?
 
I'll wait for someone else to answer
 
 
1 hour later…
 
3 hours later…
5:23 AM
@Zacharý 900⌶anything is "called monadically".
@Zacharý Sometimes, it is shortest to write a←{0::default⋄a}something
 
 
9 hours later…
2:19 PM
Functional programming (the functionception kind) does NOT mix with APL.
 
ngn
2:39 PM
@Zacharý ideas how to fix that? I had some but none were taken seriously
 
Maybe one operator for putting a wrapper around a function, and another for calling that function?
That would still lead to hacks-a-plenty, but at least direct functions would be available!
 
ngn
@Zacharý that's what I was trying to do too :) have an operator (or some special syntax) that "boxes" a function, so it becomes like a scalar and can be put in arrays, and another operator to unbox it and call it
one of my early attempts (not very good) to come up with something like that: github.com/ngn/apl/issues/66
 
2:57 PM
Or maybe one could just make K symbolic :-)
 
ngn
@Zacharý symbolic?
 
Like APL is: using symbols
 
ngn
@Zacharý well, it already uses whatever's available in ascii
and it doesn't have a problem with treating functions as first-class values: + is a verb, (+) is a noun
 
Yeah, I know about treating functions as first class objects
 
3:18 PM
Does K have trains?
 
ngn
@Zacharý not in the apl/j sense - a sequences of verbs in k is composition
 
Ah
 
ngn
1+2* is like {1+2*x}
 
I finally had a crossed out 44 incidence.
 
 
2 hours later…
5:48 PM
)help
 
@Adám How can I convert a value (like a double) to a byte array, e.g. to send over a socket connection?
And vice versa
 
⎕←80 ⎕DR 3E4 ⋄ ⎕←83 ⎕DR 3E4
 
@Adám
0u
48 117
 
⎕←163 ⎕DR '0u' ⋄ ⎕←163 ⎕DR 48 117
 
5:58 PM
@Adám
30000
30000
 
Is that a scientific notation literal?
Didn't know APL had those
Thanks
Is there a way to get the sizeof an object other than ≢83⎕DR?
 
@Pavel +/∘⌊80÷⍨⎕DR¨
@Pavel You can get the actual memory used by a symbol with ⎕SIZE.
 
Yeah, it can get pretty weird stuff with scientific notation literals.
 
⎕SIZE makes sense, that first one looks like black magic
Actually it doesn't.
      ⎕SIZE 32
DOMAIN ERROR
 
by a symbol
 
6:10 PM
Like this, you mean?
      q←32
      ⎕SIZE q
DOMAIN ERROR
 
⎕←⎕SIZE q←'q'
 
⋄ q←32 ⋄ ⎕←⎕SIZE'q'
 
@Zacharý
32
@Adám

Rebuilding user command cache... done

Real time: 0.944 s
User time: 0.909 s
Sys. time: 0.026 s
CPU share: 98.95 %
Exit code: 0
 
._.
 
k
 
6:13 PM
⋄ q←32 ⋄ ⎕←⎕SIZE'q'
 
@Adám
32
 
Works for any symbol.
But notice that there is overhead (shape info, etc) added to the size of the actual data.
 
⎕←⎕SIZE '⎕SIZE'
 
@Pavel
0
 
⋄ f←{⍺+⍵} ⋄ ⎕←⎕SIZE 'f'
 
6:15 PM
@Pavel
1200
 
:thinking:
Overhead indeed
 
It's there for reasons though
 
A kilobyte for {⍺+⍵} is more than I expected though
I'm legitimatly curious what takes up all that space
 
I have no idea, honestly. And Adám probably isn't allowed to tell you
 
int p(int a, int b){return a+b;} compiles to a file that's only around 700 bytes
 
6:27 PM
⋄ f←+ ⋄ ⎕←⎕size 'f'
 
@Cowsquack
48
 
cc @Pavel
 
6:39 PM
._.
 
ngn
⋄f←{⍺+⍵}⋄⎕←⎕size'f'
 
@ngn

Rebuilding user command cache... done

Real time: 0.908 s
User time: 0.862 s
Sys. time: 0.035 s
CPU share: 98.85 %
Exit code: 0
 
ngn
⋄f←{⍺+⍵}⋄⎕←⎕size'f'
 
@ngn
1200
 
ngn
⋄f←{⍺+⍵}⋄a←0⋄⎕←⎕size'f'
 
6:41 PM
@ngn
1304
 
ngn
^ most likely the dfn drags along the top-level namespace
 
Yeah, and don't forget the function itself
 
⋄ x←⎕THIS ⋄ ⎕←⎕SIZE 'x'
 
@Pavel
40
 
⋄ f ← {⍺+⍵} ⋄ x ← ⎕THIS ⋄ ⎕←⎕SIZE 'x'
 
6:45 PM
@Pavel
40
 
@ngn Mm, The top-level namespace appears to be a consistent 40 bytes.
⋄ f ← +× ⋄ ⎕←⎕SIZE 'f'
 
@Pavel
48
 
ngn
@Pavel right, it probably doesn't count the content of the namespace as part of its ⎕size
I just noticed that the more variables ("names") you have in scope, the larger the ⎕size of f←{⍺+⍵}
 
So, we're dissecting Dyalog?
 
7:04 PM
Yep
Unlike Mathematica, to my knowledge Dyalog doesn't have a "no reverse engineering" clause in it's license.
 
ngn
we are studying its behaviour through the intended api - the language itself
reverse engineering would be something like disassembling or debugging the binary
 
Reverse engineering is literally observing how something behaves in order to determine how it's designed.
What we're doing now isn't allowed under the Mathematica license
In Mathematica you just have to accept that a function works without trying to determine how.
 
7:28 PM
Yep ...
 
@ngn I looked it up, what you're describing is called "reengineering"
Reverse engineering is like black-box testing
 
ngn
7:49 PM
@Pavel that doesn't sound right, but of course I'm not a lawyer and I can't speak for Dyalog
 
Yeah, people do pay for Dyalog so there has to be some measure in place.
 
um, excuse me, but nothing forbids you from typing specific strings into the interpreter
 
8:05 PM
(Whether it be actual or in the license)
 
I have read the license (because I've given Dyalog my address), and I'm sure it doesn't contain anything to forbid you from specific strings
 
 
1 hour later…
ngn
9:18 PM
the mysteries of the cpu: today I replaced a[i++%n] with a[i] and further down i++;i*=i<n; and my reshape primitive became about twice as fast :)
"modulo" must be really heavy compared to +, *, and <
 
Which language?
 
maybe ngn/k...
unless ngn is implementing yet another language
 
ngn
@Zacharý ngn/k, written in C
hm, it would be interesting to compile through assembly and see what's going on there
 
9:39 PM
That code is VERY vague. Could've been C, C++, C#, D, Java, JavaScript, and some others.
 
ngn
@Zacharý yeah, I should have mentioned it's C, sorry
 
It's fine,
 

« first day (485 days earlier)      last day (2156 days later) »