« first day (922 days earlier)      last day (613 days later) » 

5:15 AM
@ngn i have `k@ and `l@ (list-printing, tables, .. 2d). repl defaults to `l and uses `k for input with a leading space
 
ngn
@ktye why put `l in the core language? it could be implemented in k itself
 
it is: https://github.com/ktye/i/blob/master/z.k#L10
z.k is loaded at startup and contains all k code. there are no k-strings in the source code. kx(..) and kxy(..) call these definitions based on numeric values behind the symbols (the offsets are important).
 
ngn
ah, so it is implemented in k :)
or "i", whatever you call it
 
I hide definitions by assigning to `".var". in my implementation x:.. and `x:.. is identical
@ngn the language is called k! i is more general and stands for interpreter.
 
ngn
@ktye ok. but i'm missing the big picture. what are you trying to achieve with this implementation? are you promoting Go? why no license file?
 
5:32 AM
@ngn i don't promote go, i just use it for a while and it lets me program without chasing bugs for too long, although this feature is "disabled" if you program sth lowlevel as k. The current implementation targets wasm directly (via ktye/wg), it's more like assembly looking like go. It also runs as a go program as a side-product which is very useful for testing/debugging. i don't care much about the license. if someone needs one, i can change that.
 
ngn
@ktye don't you care about having users? the lack of a free/open source license could discourage people from using and contributing to your project
if you're hoping to sell the software one day, that's okay, but then why not keep it private
 
@ngn i dont want to sell it. the core should be more or less complete. maybe some things about dicts/tables remain. i plan to work on the front-end/gui. and add some k libraries, like plotting. Maybe when more wasm is standard, i can add exceptions (handling error traps) for the standalone wasi version, like i do in js now.
 
ngn
@ktye what are the advantages over ngn/k?
if c can compile to wasm (in addition to working on most platforms), what's the point of generating wasm directly? it seems limiting
 
6:24 AM
I thought "generating wasm directly" meant something like compiling k code into wasm on the fly, but apparently it isn't
 
 
3 hours later…
9:03 AM
@Bubbler jit in wasm needs the embedder, e.g. js to do it. it creates a new module that you have to link in. that is not a nice approach for k. see here for details.
Maybe i'd do that later or when risc-v is more popular/available. this compiles k from k for risc-v. But it's compiling the interpreter source, not a jit compileing a lambda.
c is better if you want to have a native binary. But do you know which instructions are generated when you write the source? i don't. not even evaluation order. In my wasm i have a mental 1:1 mapping from the source code to the vm instructions (not machine instructions that's true).
From c to wasm, you don't even know where the memory is. All stack manipulations are done in wasm heap. For me, these are "locals/registers" even if they aren't for the machine.
 
ngn
@ktye sometimes i do look at the asm, actually
i have a configured a shortcut in vim which makes it super easy to jump to the asm for the current function
 
@ngn for one c compiler with current flags.
 
ngn
of course i don't inspect everything all the time. i only do it when i'm wondering if some loop is vectorized, or some function inlined, things like that
 
@ngn do you have vectorized iota?
 
ngn
@ktye of course
for example, here's the critical section of iota for 32bit ints:
.LBB2_3:
  and esi, 24
  mov rcx, rax
  sub rcx, rsi
  vmovdqa ymm0, ymmword ptr [rip + .LCPI2_0] # ymm0 = [0,1,2,3,4,5,6,7]
  xor edx, edx
  vpbroadcastd  ymm1, dword ptr [rip + .LCPI2_1] # ymm1 = [8,8,8,8,8,8,8,8]
  vpbroadcastd  ymm2, dword ptr [rip + .LCPI2_2] # ymm2 = [16,16,16,16,16,16,16,16]
  vpbroadcastd  ymm3, dword ptr [rip + .LCPI2_3] # ymm3 = [24,24,24,24,24,24,24,24]
  vpbroadcastd  ymm4, dword ptr [rip + .LCPI2_4] # ymm4 = [32,32,32,32,32,32,32,32]
  .p2align  4, 0x90
.LBB2_4:                                # =>This Inner Loop Header: Depth=1
generally when you see many instructions that start with "p" or "v", that's good :)
in this case the loop is not only vectorized but it also takes advantage of alignment and padding
if the compiler knows that the start and end address are multiples of a power of 2, it can omit most of the junk before/after the loop
 
9:21 AM
mine is [here](https://github.com/ktye/i/blob/master/verbs.go#L85)
i'm not familiar with x86 asm.
 
ngn
@ktye you have a continue at the end of a for loop's body?
I32x4load(), I32x4splat() - those looks like you're manually doing what should be the job of the compiler
 
@ngn you spot the dirt corners! the continue does nothing in go. i place it there do generate a shorter wasm loop. the loop is always entered (i know that the initial conditional is true) and the test+jump back is at the end only. for the general case i need to generate more instructions.
 
wasm isn't much "closer to assembly" than C with intrinsics really
 
ngn
@dzaima c doesn't even need intrinsics in this case
 
9:37 AM
then you're relying on the compiler more than wasm does. What I'm saying is that with intrinsics, the compiler is equally unimportant between c and wasm
but of course in simple cases you don't need intrinsics in c
 
@ngn thank you for this. posted
 
@chrispsn I'll award the bounty in 5 more days if there's no further golfs
 
@Razetime i do wonder if there's a shorter (way to get the) keying scheme
instead of 1,2,3... for empty slots and 0s for ones to keep
 
10:27 AM
 
ngn
@chrispsn oh. nice :)
@chrispsn another -1 - hey, this challenge is about projections :)
 
@ngn lmao. very clever!
that's a cool general technique
 
ngn
@ktye do you support smaller ints than 32bit?
the "iota" functions for different widths can be the same function :)
 
10:45 AM
@ngn only 1byte boolean, e.g. 1b 1001b
 
11:20 AM
@ktye yes.. open source it. join the select group of open source k implementers, a.k.a. rogue lunatics :)
 
58 in k9 {"f[",|x,|y/{!?![a*+\a:~#'x;x],?+\y!1}/y\'-1_x\1_z_}."];["
or indeed, 57 {"f[",|x,|y/{!?![a*+\a:~#'x;x],?+\y!1}/y\'1_z\1_x_}."];["
55 {"f[",|x,|y/{!?![a*+\a:~#'x;x],?+\y!1}/y\'1_z\x_}."];["
 
 
2 hours later…
1:16 PM
what's the shortest license then? this has some apl style in the logo at least.
 
1:54 PM
@ktye That ranks as the best license ever.
 
 
3 hours later…
5:43 PM
TIL that f'd is short for (!d)!f'.d -- my new favourite k-ism.
 
5:55 PM
being able to bang on the contents of a dictionary while keeping its structure intact is very handy
 
Having dicts at all is very handy....
 
no kidding
 
 
2 hours later…
ngn
8:16 PM
@ktye is licence size the thing you want to optimise? there are trade-offs. no licence is the shortest but it defaults to proprietary. public domain is the second shortest but there's no "no warranty" clause to protect you. permissive licences (mit, bsd, isc..) are very short but your code could legally end up used in commercial products and you wouldn't even know it - that could be ok, depending on your philosophy and your goals.
i've come to the conclusion that gnu's share-alike licences are best for user-facing free software. gpl2 is the classic one. gpl3 added protection against abusing patents. agpl3 added protection against circumventing the licence by putting the software on a server and using it over the network "as a service".
 
 
1 hour later…
9:32 PM
@ngn in the ideal world yes. but compiler auto-vectorization breaks down often (and in unpredictable ways if code is later modified), and I think there are entire classes of transformations that compilers won't/can't do. a "sufficiently smart compiler" is a real bugbear
 
ngn
@coltim in my experience autovectorization works well for the kinds of simple loops needed for implementing an array language
if you have a loop with a large and complicated body, then it could be hard..
 
@ngn I agree that array languages and SIMD are a great fit (as borne out by the clean ASM of ngn/k), but there's no guarantee. I don't think x?y is autovectorized, likely b/c of the early return if a match is found (?)
 
ngn
@coltim probably. i'll have a look later.
wrestling with makefile syntax now and everything's broken :)
 
intrinsics are ugly and have all sorts of portability issues. there are a lot of libraries to paper over the differences but I dunno how good they are in practice
 
ngn
10:01 PM
TIL: "order-only prerequisites" in makefiles. what a mess.
@coltim right, find is not vectorized
at least not in its general form, unlike small-domain find which uses indexing
 
I dislike GPL because I don't believe the anti-corporate/anti-capitalist angle in it actually has any teeth and I'm much more interested in encouraging people to learn from, reuse, and build upon my code than anything else
 
ngn
@JohnE what would have more teeth than the gpl?
 
nothing. it's just pointless. if it goes to court, the person with more money will win
 
ngn
going permissive sounds like giving up without a fight
 
10:17 PM
going permissive means I'm sticking to my principles of enriching the intellectual commons instead of attaching strings and trying to dictate how other people use stuff I make
 
ngn
"enriching the intellectual commons" - i'm not sure..
with a permissive license anyone can make modifications to the software and use them in their own product without contributing them back to the intellectual commons
so, it seems it encourages quite the opposite
 
copyright laws exist to serve the interest of capital; trying to use copyright law to fight back against capital is just barely a step above freemen on the land stuff. the gpl contributes to the perceived legitimacy of copyright law
if somebody builds their own commercial products based on material in the commons it in no way causes the original to disappear
I believe software patents are immoral and claiming I have some divine right to control how others use a piece of code I wrote because it is "intellectual property" is the height of hubris
if you don't want people to do stuff with source code, don't publish it
 
ngn
@JohnE it doesn't cause the old free code to disappear, but it could prevent new free code from appearing
@JohnE yeah, i think "property" is meaningful only to the extent it can be enforced, it has nothing to do with abstract nonsense like morality or "divine" rights
 
10:33 PM
qed only governments and corporations have property
 
ngn
"monopoly on violence", yes :)
 
I think we're in complete agreement then
 
ngn
boring :)
@JohnE well, except about our assessment of the gpl's (i.e. the fsf's) chances of fighting back
 
and whether or not it's good to try to use copyright to exert personal will, or whether it's best to discard copyright to the extent it is legally possible to do so
 
ngn
i'm not sure, tbh
 
10:46 PM
lua is MIT licensed and it is one of the most popular embeddable scripting languages, from offering plugin capabilities for tools to offering moddability to games. the permissive license is essential for many of these applications. widespread use enriches the community around the language, and being able to extend a program without reaching for a scary compiler toolchain is empowering to end users of all sorts, whether the program is open source or proprietary
if a teenager picks up lua because they want to add a feature to the commercial game Rimworld, their learning, empowerment, and creative expression are no less real because the platform they're on isn't protected by a gpl
 
ngn
but that's a lot less "user-facing" than k
 
k could be an excellent scripting language for similar applications if there were high quality implementations with permissive licenses
pico-8 is also based on lua, and it puts the language rather front-and-center
 
ngn
for ngn/k, i don't think going permissive would have attracted more users
 
there are things no one will consider building with it because it isn't permissive
just like k
 
ngn
the gap between permissive and copyleft is so much smaller than the gap between copyleft and proprietary :)
 
10:57 PM
we're all obviously in agreement that k is a good language, but if I ever worked for a company that didn't already have k licenses I could not in a million years justify starting to use it in a commercial setting
 
ngn
why not?
 
the encumbrance and risk of being properietary instantly overrides any of its benefits
 
ngn
you can use gpl software for commercial purposes, that's okay, as long as your modifications to it are made public
 
there's no shortage of un-encumbered languages which are less brilliant, but still acceptable
@ngn and with weird batshit requirements around dynamic linking
as if cross-platform software wasn't already enough of a pain in the ass
@ngn imo it's really just non-coercion against two philosophies of coercion
 
ngn
maybe. but if someone makes and improvement to my software, i don't want it to sink into proprietary obscurity. i want it as a contribution, so everyone else can use it.
users of the language should put their ingenuity in using the language, not competing against it
idk if this counts as coercion
it's more like software self-defense :)
 
11:06 PM
you could ask nicely, and get contributions from people who are friendly and civic-minded, while people who want to take their ball elsewhere don't have any reason to bother you
 
ngn
yeah but not everyone is friendly and reasonable
implementers of other languages are particularly difficult
 
but don't you see- permissive licenses mean that people who are unfriendly and unreasonable can just fuck off and do their own thing!
like they're going to anyway
 
ngn
what if they don't fuck off but take things from the project and present them as their own?
permissive licences require (at most) a note about that (easy to hide under piles of verbose docs)
copyleft requires that everything linked should be free too
 
I don't think copyleft licenses really do much, if anything, to deter plagiarism
 
I thought the GPL licenses essentially mean that if you use them for anything everything you have has to be fully open sourced under GPL
 
11:15 PM
@coltim yes; the "viral" nature of the gpl is part of why I'm calling it coercive
 
ngn
@coltim there's a difference between "use" and "link with"
 
@ngn I don't know enough about the nuances, but if I write an application in ngn/k for use in my commercial thing, what do I have to do under the terms of the license?
(I think the only GPL related thing I know about is like OpenWRT or whatever the deal was with the router firmware being forced open source)
 
ngn
@coltim abide by the agplv3
 
for many, many years gcc resisted the idea of exposing a usable internal API or IR basically for fear that properietary software might somehow take advantage of its precious tooling. as a result the compiler was an absolute dumpster fire that stymied both the improvement of open-source tooling and progress in compiler research for over a decade. finally, clang provided a viable (and permissive!) alternative and lit a fire under their asses
 
ngn
@coltim (i'm not a lawyer) i think if you use the interpreter without making changes to it, or are willing to publish your changes, then you can use the language for any purpose, including commercial
there are complications about linking with other programs or putting the software on a server
@JohnE clang could have done the same under a copyleft licence
or the guys unwilling to open up the internal api could have had their assess on fire even if their licence was permissive
 

« first day (922 days earlier)      last day (613 days later) »