Comments (6)
You're missing the crucial ⎕IO←0
. See the first code cell at the top of every chapter. The Indexing chapter intro emphasises this:
But as before, we begin by setting our index origin, extra important as we’re about to discuss indexing.
⎕IO←0
I←⌷⍨∘⊃⍨⍤0 99
m ← 3 3⍴(1 2 3)(3 2 1)(4 5 6)(5 3 1)(5 6 8)(7 1 2)(4 3 9)(3 7 6)(4 5 1)
(0 0)(1 2)(2 2)I m
┌→────────────────────────┐
│ ┌→────┐ ┌→────┐ ┌→────┐ │
│ │1 2 3│ │7 1 2│ │4 5 1│ │
│ └~────┘ └~────┘ └~────┘ │
└∊────────────────────────┘
from learnapl.
⎕IO←0
]DISPLAY m ← 3 3⍴9?9
┌→──────┐
↓┌→────┐│
│↓0 3 5││
││4 2 1││
││7 6 8││
│└~────┘│
└───────┘
(0 0⍉m) ← ¯1 ¯1 ¯1
m
┌→───────┐
↓¯1 3 5│
│ 4 ¯1 1│
│ 7 6 ¯1│
└~───────┘
from learnapl.
⎕IO←0
is used exclusively in the book, reasons for which are explained in the first chapter.
from learnapl.
gotcha @xpqz thx, interesting, still didnt get why that was there, maybe skim a lot but could you explain what actually is doing and why it is needed?
For me not being English my first lang, isnt clear why I need to define that (except that doesnt work if I dont do that)... also why it isn't defined in the langauge itself or if there are other ways to define the base index. Or how it is referenecd used by other symbols that are already defined.
I think would be helpful to know why.
Anyway, thanks for the book, still searching more ways to learn about APL, resources seem scarse.
from learnapl.
I think I have it now, ⎕IO
prints 1 just starting the repl, so setting it as 0
as "normal" programming.
So I guess that is a variable already defined on system, interesting way of APL to allow changing base index I guess.
Still dont know why I can't use IO←0
but must use ⎕
Quad to set it or display it.
from learnapl.
from learnapl.
Related Issues (20)
- "The Stencil operator: `⌺`" revision HOT 1
- Grade up/down HOT 2
- Typo on page /iteration.html HOT 1
- Export as EPUB HOT 1
- Relative rank ⍤¯1 HOT 1
- The "finding things" chapter confuses extension with pervasion HOT 1
- Iota Underbar HOT 1
- Expand on the timings for binary search HOT 1
- Issue on page /rank.html HOT 1
- Link to single PDF does not exist HOT 3
- Font issue HOT 1
- Domain Error HOT 1
- Font issue (presumably again) HOT 10
- Array model wording HOT 1
- Incorrect explanation of the value returned by dyadic iota when no element is found HOT 2
- Issue on page /testing.html with a URL giving 404 HOT 2
- Update Link docs URL HOT 1
- Typo re: "APL Ex(c)ercises" on page /rank.html
- Spelling mistake "alreay" on page /dyadictrn.html
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learnapl.