« first day (1796 days earlier)      last day (1155 days later) » 

00:44
@Adám COW
@Adám wdym?
Kamila made a nice pun.
Bba dum tss?
ok
COW today?
You don't need to ask me.
00:49
ok
but saturday or sunday?
@Adám
I don't understand.
ok, COW updates every sunday.
01:06
But i forgot to add one code
@Adám
 
9 hours later…
10:12
@MasterQuiz Yeah, I made a temporary fix back then as a "tech demo". Should now be permanently fixed.
 
4 hours later…
14:04
Is it possible that if I make multiple request to the API to the same WS with for example ?⍨4, the answer is always the same?
14:17
@MasterQuiz Yes, of course, because the random seed is part of your state. If you want true irreproducibile random numbers, set ⎕RL←⍬2 as part of your state.
Thanks
I've managed, after two long days on this, to create a function using fetch and use it to send requests. Should I send it somewhere so that someone can add it to aplwiki ('cause the actual documentation on it isn't understandable, at least for me)
@MasterQuiz You don't want to add it to APL Wiki yourself?
const apleval = (() => {
 let [ns, len, hash, out] = ['', 0, '', '']; // initialise mutable state
 return (async (input) => {
  [ns, len, hash, out] = await fetch('https://tryapl.org/Exec', {
   'headers': {"Content-Type": "application/json; charset=utf-8"},
   'body': JSON.stringify([ns, len, hash, input]),
   'method': 'POST',
   'mode': 'cors'
  }).then(res => res.json());
  return out;
 })
})();
here's what I came up with before
@Adám I can, but I'm not an expert of JS, so probably someone else could do it better
People can always edit the code on the Wiki.
14:26
@Adám So I'll do it later
@rak1507 @MasterQuiz What are the benefits of using fetch over XMLHttpRequest?
@Adám I think that Fetch API is more modern; on the other hand, it isn't available on all browsers
@Adám can you show me an example of how i would extract json as apl from this site: api.open-notify.org/iss-now.json
14:42
@PyGamer0 xpqz.github.io/learnapl/http.html might be helpful
@Adám the benefit for me was.. I know how to use fetch and idk how to use xmlhttprequest :p
@PyGamer0 Don't think that there's something better than this aplcart.info/?q=Convert%20JSON%20text%20to%20APL%20matrix#
15:14
@Adám Print to STDOUT without newline
@Fmbalbuena I'll try to find out for you if you give me a compelling use case.
@Fmbalbuena maybe you could quad arbout to /dev/stdout
there should be a similar device on windows i think
CMC: print "Hi" without newline
@Fmbalbuena It hasn't got newlines
Why this is full of lessons?
except lession 28
⎕←foo←bar←baz←7
@Fmbalbuena 7
@PyGamer0 This tradfn:
 report←iss
 :With (⎕SE.SALT.Load'HttpCommand -non').GetJSON'GET' 'http://api.open-notify.org/iss-now.json'
     HttpMessage ⎕SIGNAL HttpStatus⍴⍨0≠rc
     report←Data.(('%ISO%'(1200⌶)20 1 ⎕DT timestamp),⍕'NS' 'EW'{(⍕|⍵),'°',⍺↑⍨×⍵}∘⍎¨iss_position.(latitude longitude))
 :EndWith
@Fmbalbuena Because people make typos.
@Fmbalbuena @KamilaSzewczyk Indeed, this seems to work:
tn←'/dev/stdout'⎕NTIE 0
tn⎕ARBOUT⎕UCS'hello world'
15:44
mastermind
I still want to know a compelling use case.
16:32
I managed to solve AoC day 8. Probably not at a very clever way but at least the answers were ok :) One question though
The input is a list vectors, each consisting out of characters.
  ──────────────────────────────────────────────────┐
   ┌→──────────────────────┐ ┌→───────────────────┐ │
   │ cabgdf ceafb afgdec de│ │ fb baf edgafb cbgda│ │
   └───────────────────────┘ └────────────────────┘ │
  ──────────────────────────────────────────────────┘
(this is the last part)
How can I keep the entire vector converting from JSON this string?
(↑⍣≡0∘⎕JSON)'"[\"2 15\",\"3 14\",\"3 15\",\"3 16\",\"4 13\",\"4 14\",\"4 15\",\"4 16\",\"4 17\",\"5 13\",\"5 14\",\"5 15\",\"5 16\",\"5 17\",\"6 12\",\"6 13\",\"6 14\",\"6 15\",\"6 16\",\"6 17\",\"6 18\",\"7 11\",\"7 12\",\"7 13\",\"7 14\",\"7 15\",\"7 16\",\"7 17\",\"7 18\",\"7 19\",\"8 10\",\"8 11\",\"8 12\",\"8 13\",\"8 14\",\"8 15\",\"8 16\",\"8 17\",\"8 18\",\"8 19\",\"8 20\",\"9 9\",\"9 10\",\"9 11\",\"9 12\",\"9 13\",\"9 14\",\"9 15\",\"9 16\",\"9 17\",\"9 18\",\"9 19\",\"9 20\",\"9 21\",\"10 9\",\"10 10\",\"10 11\",\
@Richard What's the question?
still typing :), sorry
@Richard Oops ahahah
I use the following solution to count the number of 3 length groups of letters
+/+/3=¨⍴¨¨mask⊂¨i
for example 'abc' or 'efg'.
My question, is it necessary to use the 'for each' operator all the time?
@Richard not on = at least (or any arith/comparison function)
16:39
I'd write something like this
{+/3=≢¨' '(≠⊆⊢)⍵}¨'cabgdf ceafb afgdec de' ' fb baf edgafb cbgda'
:)
thanks!
@Richard (≠⊆⊢) is a famous train
thanks, and 'partition' seems to be a much better way, which also does't include the spaces in counting
and Tally is also better than rho I presume
it's almost certainly what you want if you only work with vectors
@Richard I thinks it's cause it can be more general, so the function may works also with matrices. But in this case I think that it doesn't matter so much
16:45
@MasterQuiz well, it depends. Sometimes is what you want for generality. Sometimes it's
17:02
a question about your solution @MasterQuiz.
Why are the following two lines of code different?
{≢¨' '(≠⊆⊢)⍵}¨i
≢¨' '(≠⊆⊢)¨i
btw the first one works, the second not
@Richard {≢¨' '(≠⊆⊢)⍵}¨i → ≢¨¨' '(≠⊆⊢)¨i
yes exactly, but why is the extra ¨ necessary?
{≢¨⍵}¨i Here you're doing tally of each element of omega, but omega is each element of i, so you're doing the tally of each element of each element of i
⋄ ⎕←i ← ((1 2) (3 4) (1 1))((5 6) (7 8) (1 1)) ⋄≢¨i ⋄ ≢¨¨i
@MasterQuiz
┌─────────────┬─────────────┐
│┌───┬───┬───┐│┌───┬───┬───┐│
││1 2│3 4│1 1│││5 6│7 8│1 1││
│└───┴───┴───┘│└───┴───┴───┘│
└─────────────┴─────────────┘
3 3
┌─────┬─────┐
│2 2 2│2 2 2│
└─────┴─────┘
In the first case it counts how many elements does each box have
In the second case it goes one depth further
17:10
ok, i understand but ⍵ is the same as ¨i.
for the first solution
⍵ refers to ¨i
and the second solution uses ¨i directly
@Richard All thing are applied to ¨i, you can just replace ⍵ with ¨i
ah, I think I got it
@MasterQuiz You have to imagine that the dfn enters in each box; ' '(≠⊆⊢)⍵ creates a vector of vectors and you want to find the length of each one of this elements
' '(≠⊆⊢)⍵}¨i works on every single item
and
' '(≠⊆⊢)¨i returns the complete list again
or better explained, the same nested structure
@Richard These two expressions do the same thing
17:20
So in the fist case the ≢ works on each vector. And in the second case the input for ≢ is a list of vectors
@Richard Exactly
@Richard Probably this can help
f¨¨g¨A → {f¨g ⍵}¨A
f¨g¨A → {f g ⍵}¨A
f¨g¨¨A → {f g¨⍵}A
It does, thanks!
@Adám error AC0008: error (VALUE ERROR) executing line "F"
17:37
@Fmbalbuena what's the context for this error
when call function
what function though
∇F
f ← 1
:While f ≢ 100
⎕ ← f × f
f ← f + 1
:EndWhile
∇
F
see the debug
17:48
@Fmbalbuena This works
too late
has sent to CR
@Fmbalbuena To what?
CR
(Code Review Stack Exchange)
yeah i think the issue is just no return value
0
Q: Print square numbers from 1 to 9999 (non-tradfn)

FmbalbuenaI'm making a simple program that outputs the squares. Code ∇F f ← 1 :While f ≢ 100 ⎕ ← f × f f ← f + 1 :EndWhile ∇ F Output: a lot of squares

17:53
@MasterQuiz ^
@StackExchangeFeeds Can't you delete the question?
i can but not
why, when you can just do (⎕∘←)¨×⍨⍳9999
⍝ ⌊⊃ ⊂ |⊃ |≡ |= |≡, |-| | ,,| |< ⌊ |⍱| |⍱ ⎕ ⍴ ⍉ ⍴~ ⊆ ⌿ |,,| \/ \/\/ >< >/ ≥
1 downvote... nevermind i will get 2 rep
18:29
@Fmbalbuena The question doesn't have much sense... If you want a "non-tradfn", you just have to do {×⍨⍳⌊0.5*⍨⍵-1}9999
well, the question asks "print"
i suggested a way of solving this already
18:50
@KamilaSzewczyk I've interpreted the question as Squares number lower than 9999
19:17
⎕←¨×⍨⍳⌈9999*÷2 for a proper 'printing' method (also ⌈ not ⌊)
@rak1507
SYNTAX ERROR
      ⎕←¨×⍨⍳⌈9999*÷2
      ∧
I suppose ⎕IO matters...
@rak1507 you can't ¨
it works for me
well then
19:19
      ⎕←¨×⍨⍳⌈100*÷2
0
1
4
9
16
25
36
49
64
81
@rak1507
SYNTAX ERROR
      ⎕←¨×⍨⍳⌈100*÷2
      ∧
weird
@rak1507 It doesn't work on Tio, on Dyalog APL it does.
yeah
it's TryAPL that the bot uses
which I assume transpiles ⎕← to something else that most definitely does not like ¨
19:37
hm, weird, i didn't think i did anything weird with the ⎕←
no, tryapl transpiles code for safety
oh you mean tryapl transpiles it
right
19:56
Can I change somehow this option on TryAPL ]Rows -fold= ?
It cut's some result's that I need
CMC: print "#" infinitely
without newlines
{∇⍞←#}⍬
i was going to suggest {⎕←⍵⋄∇⍵}'#'
but this is better
Hmmm
i need APL keyboard
{∇⎕←⍵}'#' probably
spotting that you can drop the quotes was smart
20:04
then ∇⎕←'H' prints "H" without newline, right?
it was also accidental :D
@Fmbalbuena ⍞ not ⎕
⍞ prints to STDERR
true, you didn't say stdout
⋄{∇⎕←⍵}'#'
@Fmbalbuena
NOT PERMITTED: Illegal token
      {∇ ⎕←⍵}'#'
     ^
20:06
⋄{⎕←⍵⋄∇⍵}'#'
@Fmbalbuena
NOT PERMITTED: Illegal token
      {⎕←⍵ ⋄ ∇ ⍵}'#'
     ^
⋄{∇⍞←#}⍬
@Fmbalbuena
NOT PERMITTED: Illegal token
      {∇⍞←#}⍬
     ^
incorrect
@Fmbalbuena I don't think that the bot would allow you to print an infinite message
20:07
doesn't work on tryapl but it works locally I promise :P
@Fmbalbuena TryAPL doesn't like ⎕←
it accepts ⎕← at the start of a line, but nowhere else
⋄⎕←8 5+ ⍝ Polish notation!!!!11!
@Fmbalbuena
SYNTAX ERROR: Missing right argument
      ⎕←8 5+
         ∧
20:10
CMC: Implement polish notation calculator
@dzaima What would this do?
f ← {
⎕←'#'
∇ ⍬
}'
⋄F←{
⋄'hi',⍵
⋄}'hi'
@Fmbalbuena Response looks like a 0-by-0 matrix.
⋄F←{
⋄⎕←'hi',⍵
⋄}'hi'
@Fmbalbuena
NOT PERMITTED: Illegal token
      F←{ ⋄ ⎕←'hi',⍵ ⋄ }'hi'
     ^
20:12
@dzaima ^
pjC█d┐│↑Ψ{⁽○σ#d{§⁰!∆*κ‽Τ!P¤‚↕⁴‘
@MasterQuiz This works on Dyalog APL; on TryAPL it prints just a '#' cause it transforms the function to
{
    '#'
    ∇ ⍬
}'
@Fmbalbuena actually, that's a fun challenge
give me a second
ok
@KamilaSzewczyk (protip: use stack)
thank you for this piece of indispensable knowledge
hmmm
use for loops
@KamilaSzewczyk ^
20:22
how about i write one without a stack? :P
Knock knock
someone here?
@KamilaSzewczyk are you making?
sorry i was gone for a second
i'm back and i'm gonna try it now
 rpn←{
     _←'tokens'⎕cy'dfns'
     t←{⍵/⍨{∧/⍵≠' '}¨⍵}tokens⍵
     e←{
         ⍺∊⎕d:∊⍵,⍎⍺
         (2↓⍵),(⍎⍺)/¯2↑⍵
     }
     ⊃e/(⊂⍬),⍨⌽t
 }
20:41
What's the polish notation?
polish notation, alternatively cringe notation, is basically just postfix/forth.
golfed?
@KamilaSzewczyk golfed?
@KamilaSzewczyk when?
rpn←{⊃{⍺∊⎕d:∊⍵,⍎⍺⋄(2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽{⍵/⍨(∧/≠∘' ')¨⍵}({⍵⊣⍵.⎕CY'dfns'}⎕NS⍬).tokens⍵} should do it
20:49
⋄rpn←{⊃{⍺∊⎕d:∊⍵,⍎⍺⋄(2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽{⍵/⍨(∧/≠∘' ')¨⍵}({⍵⊣⍵.⎕CY'dfns'}⎕NS⍬).tokens⍵}⋄rpn '2 2 2 2 + * *'
@Fmbalbuena
NOT PERMITTED: Illegal token
      rpn←{⊃{⍺∊⎕D:∊⍵,⍎⍺ ⋄ (2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽{⍵/⍨(∧/≠∘' ')¨⍵}({⍵⊣⍵.⎕CY'dfns'}⎕NS ⍬).tokens ⍵} ⋄ rpn'2 2 2 2 + * *'
     ^
rpn←{⊃{⍺∊⎕d:∊⍵,⍎⍺⋄(2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽' '(≠⊆⊢)⍵} is much smaller
and doesn't depend on dfns
⋄{⊃{⍺∊⎕d:∊⍵,⍎⍺⋄(2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽' '(≠⊆⊢)⍵}'2 2 2 2 + * *'
@Fmbalbuena 4294967296
Uhhh
hmmm
.....
??????
20:51
what does * do in APL?
exponentiation
you raised 4^16
because uhh, something is wrong with the stack order
ah yes, i forgot a minus
@KamilaSzewczyk What is your flag of your old pfp?
{⊃{⍺∊⎕d:∊⍵,⍎⍺⋄(¯2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽' '(≠⊆⊢)⍵}
⎕←{⊃{⍺∊⎕d:∊⍵,⍎⍺⋄(¯2↓⍵),(⍎⍺)/¯2↑⍵}/(⊂⍬),⍨⌽' '(≠⊆⊢)⍵}'2 2 2 2 + * *'
@KamilaSzewczyk 65536
20:54
this works correctly
> @KamilaSzewczyk What is your flag of your old pfp?
21:19
Any tips on how this expression can be written more compact? (my solution for AoC day 9)
@Secret Hej. Interested in APL?
+/1+m1[⍸(m1<1⌽m1)∧(m1<¯1⌽m1)∧(m1<1⊖m1)∧(m1<¯1⊖m1)]
Hello Adam, i was actually looking for you cause i had a question haha
should I try to make it tacit?
@Secret Go ahead, in English or Danish :-)
@Richard You should be able to replace [⍸] with /⍨
21:21
@Adám Hvordan laver jeg en dfn som ikke tager argumenter? det lader ikke til at virke
@Richard That could work out nicely. Alternatively, it looks like something might do well, unless you actually need that wrap-around.
@Secret Det kan man ikke i Dyalog APL, men du kan bruge et dummy-argument, f.eks. — ellers må du bruge en tradfn (som evt. kan indeholde hele din dfn plus dummy-argumentet.)
@Adám ja det må du gerne
Skal jeg vise dig et eksempel?
Men du behøver altså ikke at bruge en dfn inden i den tradfn. Try it online!
@Adám I'll have to study that operator. Looks quite complicated.
Aah sådan, det ser vel også pænere ud
21:27
@Richard Essentially, f⌺3 3 applies f to each 3×3 neighbourhood.
ah, :)
Just watch out; f is given a left argument which you might need to ignore.
@Adám Fik lige et sidste spørgsmål, er der en måde at append noget i starten af en streng? Virker invers ravel eller er der et primitive som jeg ikke kan finde
Jeg er ikke sikker på hvad problemet er. Kan du ikke bare sætte dit prefiks til venstre for ,?
⋄ tekst←'bla bla osv' ⋄ '*',tekst,'*'
@Adám *bla bla osv*
21:31
hvis jeg ville wrappe en streng i " eller * eller noget tredje
@Richard I'm not a tacit expert, but from experience, it's difficult that tacify shorten a long function
Kunne også skrives som ⋄ '*'(,,⊣)'tekst'
@Adám *tekst*
@MasterQuiz But that one has a structure that's very amenable to trains.
@Adám Wouldn't there be lots of jots and ranks?
21:34
@MasterQuiz None: +/1+⊢(/⍨)(⊢<1⌽⊢)∧(⊢<¯1⊢⌽)∧(⊢<1⊖⊢)∧(⊢<¯1⊖⊢)
haha, tak, havde ikke set jeg bare kunne gøre præcis det der, det er første dag rigtigt giver dyalog et forsøg og kommer fra J så var så vandt til min head-primitive
Head er ⊣⌿ (som svarer til J's [/) men hvis du har at gøre med en simpel vektor, kan du bruge
@KamilaSzewczyk Doesn't Forth just look like postfix?
@user No.
21:50
Huh, I always thought as concatenative stack-based languages as being different from postfix because there's no real "parsing" involved

« first day (1796 days earlier)      last day (1155 days later) »