The APL Orchard

apl.chat ― Learn, teach, ask, code, golf, & discuss usage. See ...
Dec 19, 2019 19:10
@Adám what are the shortest “normal” APL quine? dfns.dyalog.com/n_quine.htm ?
Dec 2, 2019 19:20
@dzaima thanks. That (almost) explains it. I specifically checked ⎕drs, but the docs for ⎕dr don't say anything about it trying to auto-compact.
Dec 2, 2019 19:06
@ngn that -x is not necessary, just a (simple) way to do unfoldr (\x -> if cond x then Just (x, next x) else Nothing) a₀ would be nice [But that's just me, and I'm only "using" APL for 2 weeks, so maybe I'm completely wrong]
Dec 2, 2019 18:56
well... -{2/x}\42 in k7. but we're talking about apl
Dec 2, 2019 18:53
@ngn yes... but why would I ever want a recursion? ;)
Dec 2, 2019 18:36
@Adám like in Haskell, e. g. unfoldr (\x -> if x>0 then Just (-x, xdiv2) else Nothing) 42 is [-42,-21,-10,-5,-2,-1]. Here function returns (a) what elem goes to the result (-42), (b) the next state (xdiv2 aka {⌊⍵÷2}), (c) whether to stop (Just(v,state) or Nothing). Shouldn't be necessary that complex, but the idea is this.
Dec 2, 2019 18:17
@Adám BTW do you have an idea why is chat.stackexchange.com/transcript/message/52727538#52727538 ?
Dec 2, 2019 18:16
@Adám Thanks. Yes! I tried to search "iterate", "unfold"
Dec 2, 2019 18:08
@Adám I don't want "vector of 𝑛", I want «until g»
Dec 2, 2019 17:59
How would you do «f⍣g but giving intermediate results»?
Dec 1, 2019 20:26
@Sherlock9 I just did ,⍎¨⎕csv FILE 😇
Nov 28, 2019 17:11
I thought about that, but… ×1.5? :)
Nov 28, 2019 17:06
Interestingly, if I do ti←¯128+'UTF-8'⎕ucs t ⋄ si←¯128+⎕ucs s ⍝ -128 to fit to 8-byte ints and run si{+/2</(⍺=⍵),1}ti, it's ×1.5 slower. Any idea why? (ascii-only, so t and ti have the same size.)
Nov 28, 2019 15:57
ah
Nov 28, 2019 15:57
is @Bubbler's version slower because it is prepending ,?
Nov 28, 2019 15:50
@Adám I thought it's about 'abc'[/⍨1] (syntax error, is it a bug?) so I tried to add [(..)], that works for me on 17.0
Nov 28, 2019 15:48
⎕←cmpx 's{+/2</⍺=⍵,⍺}t' 's(+/2</⊣=⊢,⊣)t' ⊣ s←',' ⊣ ⎕←≢t←',XY'[(/⍨?1e6⍴3)] ⊣ 'cmpx'⎕CY'dfns'
Nov 28, 2019 15:07
@Adám how bad is an idea to do +/0 1⍷','≠',',str instead?
Nov 27, 2019 19:38
What is the shortest tacit form of {⍺⍵}? (⊂⊣),(⊂⊢) ?
Nov 27, 2019 11:54
"you probably want 0=≢⍵ instead of ⍵≡⍬" what is wrong with the latter?
Nov 24, 2019 18:32
Cool. “All numbers sans 2-number products”?
Nov 24, 2019 18:23
yes
Nov 24, 2019 18:21
⎕←X/⍨1<≢¨('^(..+?)\1+$'⎕r'∘')(,/⍕)¨¨1/¨⍨X←⍳100⊣'is my first apl program horrible enough?'
Nov 20, 2019 19:07
⎕←1∣2|3 ⍝ interestingly, some doppelgängers are already accepted
Nov 20, 2019 19:07
complained to support@
Nov 20, 2019 18:10
now trying it, gnu apl accepts pretty much everything… both alphas, omegas, even minuses (ascii hyphen & mathematical minus U+2212). Edit: ah, it's all in the pdf you posted
Nov 20, 2019 18:04
it accepts both actually. And both iotas it seems
Nov 20, 2019 17:58
@Adám a-ha! Thanks. Blame emacs’ APL input-mode :)
Nov 20, 2019 16:44
Not sure I understand the error for this: 'bsearch'⎕CY'dfns' ⋄ {w←⍵ ◊({w≤⍵}bsearch 0 1)}1
Nov 20, 2019 08:14
if ⍺(f g h)⍵ is (⍺f⍵)g(⍺h⍵) then why ⍺(f∘h)⍵ is ⍺f(h ⍵) (isn’t it?)
Nov 18, 2019 08:54
apparently it exists as in NARS2000
Nov 18, 2019 07:54
Is there a short way to write (f ⍺) g (f ⍵)?
Nov 18, 2019 04:30
Never mind, wrong ⎕io
Nov 18, 2019 04:28
I’m watching youtube.com/watch?v=EJONZpNA81s and 0 0⍉D←{{⍉⍵⍪1↓⊖⍵}⍣2⌽s⍴⍵,'-'⍴⍨s←2⍴≢⍵}'ABCD' (the 0 0⍉ part) gives an error. Has something changed in Dyalog APL?
Nov 14, 2019 06:45
Why you can do (⊃,⊃), but not (⍬⍴,⍬⍴)?
Nov 11, 2019 23:49
👍
Nov 11, 2019 23:16
@Adám 10000000000 ÷big 2. Was VALUE ERROR: Undefined name: E; now DOMAIN ERROR. But I'm a complete noob, so maybe I’m doing something wrong :)
Nov 11, 2019 21:53
Yes, I understand. Still surprising (and failing would be better than useless result)
Nov 11, 2019 21:51
@Adám I think big should rather fail in this case: 10000000000000000000 ×big 1 ;-)
 
Dec 17, 2019 16:49
@ngn what do you suggest? hosting only .diffs? also, thanks for the source!
Dec 12, 2019 07:39
@ktye yes. why?
Dec 10, 2019 15:09
is there an official list of prefix squiggles anywhere? ^ sorted, ? unique(?), ! iota
Dec 8, 2019 13:57
heh… 2\: 21 0, 2 \: 2 ⇒ class error
Dec 7, 2019 19:33
@ngn ...or are you supposed to think of it as a special case of func\term?
Dec 7, 2019 19:30
@ngn hah. Thanks. Is it documented anywhere?
Dec 7, 2019 19:25
what is list\atom in k7?
Dec 2, 2019 22:25
@ngn but echo $'"\n\t"' | ./shakti-2019.09.20/bin/k"\n\t"
Dec 2, 2019 22:19
ah. Works in kdb's k4. But you can replace \n in k7 (?!): echo $'+/+1,(1=;<\':4=)@\:" \n\t\\r"? "foo bar quux"' | ./shakti-2019.09.20/bin/k
Dec 2, 2019 22:10
@ngn \r too then (as ^M)