smalltalk | simple inferface for mapping in terminal mapping via gl | Dataset library
kandi X-RAY | smalltalk Summary
kandi X-RAY | smalltalk Summary
A simple inferface for mapping in terminal mapping via gl-js!
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Navigate to the screen
- Get the bounding box
- Return the center of a tile
- Zoom out of a tile
- Zoom a tile in the bounding box
- Convert a byte string to an integer
- Map coordinates to bounding boxes
- Check if two bounding boxes are overlapping
- Determine if bds reference overlap
- Find a getch of a getch
- Clip the data according to the bounding box
smalltalk Key Features
smalltalk Examples and Code Snippets
Community Discussions
Trending Discussions on smalltalk
QUESTION
I found a way to make it work, but it seems clumsy. There has to be a better way...
The question I might try to answer is If I wanted to find out how often a language was selected by country, how would I do that efficiently?
This works, what's better?
...ANSWER
Answered 2021-Apr-13 at 15:05Your tidyverse solution seems pretty good. For something more concise you could try base R or data.table
:
QUESTION
How to convert information from one object's format to another?
In Smalltalk best practice patterns by Kent Beck, he discouraged "adding all the possible protocol needed to every object they may be asked of it". Instead, he suggested to convert from one object to another.
Can someone give me an example of what he meant by "overwhelming object's protocol"? I am trying to understand the bad way to do it in order to be able to appreciate the good way.
...ANSWER
Answered 2021-Mar-26 at 11:33As Beck explains, some clients may need to enumerate a collection in a way that the elements are sorted before exposing them, others would require not iterating twice over the same object (which may appear twice in the collection), etc.
One way to address these situations would be to add methods such as #sortedDo:
, #withoutDuplicatesDo:
, etc. to the collection class. Sooner or later, this approach would derive in populating the class with other variants of #do:
such as #sortedSelect:
, #withoutDuplicatesCollect:
, and the like. The problem is that the resulting protocol of the class would quickly grow too large, adding complexity to the simple task of finding the right selector, increasing the risk of duplicating pieces of code when the search is not exhaustive enough, etc.
To avoid those side effects, the class should provide methods for converting its instances in instances of other classes. So, instead of #sortedDo:
the client may use
QUESTION
I need a static array of structs and the structs contain a Vec. I can manage the lifetimes of the actual values. I get the following error:
...ANSWER
Answered 2021-Mar-24 at 07:35As the compiler tells you, you cannot move a value out of a place observable by others. But since you have the replacement at the ready, you can use std::mem::replace
:
QUESTION
In a past question, Is there a CAS for Pharo?, I asked about a Computer Algebra System for Pharo, and people pointed to Domains, a port of Mathematics from CUIS smalltalk, that is part of PolyMath project. I suceeded installing PolyMath in Pharo 8, running the following code in the playground, as adviced in https://github.com/PolyMathOrg/PolyMath:
...ANSWER
Answered 2021-Mar-02 at 08:24Once you load polymath, you will have all packages available to load. The tool used to load/save packages in Pharo is called iceberg (is a git client). You can find it in the menu "tools" in Pharo 8 or in "browse" in Pharo 9.
QUESTION
I'm currently puzzling over the response provided by the class method Float>>asFraction
and its various forms. Here are a few examples:
ANSWER
Answered 2021-Feb-24 at 09:49A Float
is a data structure that codifies a number, which regardless of how we see or interpret it, mathematically speaking, cannot be anything but a rational quantity (i.e., an integer or fraction). This codification is appropriate for arithmetic operations, which the CPU performs at high speed. The price we pay is that the codification doesn't exhibit the numerator and denominator it represents. The method Float >> #asTrueFraction
answers with these numbers, in other words, it decodes the bits enclosed in the instance of Float
, and answers with the actual fraction it codifies.
What you have to understand is that when you write 0.001
you are telling the Compiler to create a Float
that approximates the fraction 1/1000
. Had the CPU used decimal rather than binary representations, this would have been similar to asking it to codify 1/3
using a finite number of decimal places, which leads irrevocably to 0.33333..3
, for some maximum number of digits 3
. In the case where the denominator is not a power of 2
, the CPU has to solve a similar problem and ends up approximating the provided quantity so that it fits in the number of bits allocated to Floats
. The method #asTrueFraction
reverses that process and reveals the exact value of the approximation, which Float
hides behind the way it prints its instances.
In Pharo, Float >> #asFraction
is the same as Float >> #asTrueFraction
, so no difference there.
The comment in Float >> #asMinimalDecimalFraction
is very clear, it will give what you usually expect, this is, the shortest decimal Fraction that will equal self when converted back asFloat.
Finally, Float >> #asApproximateFraction
uses some algorithm to produce an acceptable approximation of the receiver.
QUESTION
I am struggling to find out is there a way to feed input
to the interactive command of gst a.st b.st ... -
and redirect the output. Normally, the interactive buffer will
have st> ...
and when you type a command it will output something by calling
the default/override displayString
method to the interactive output. How to get the input
and feed the output using linux command or maybe a tiny smalltalk test script to do that.
Thank you.
ANSWER
Answered 2021-Feb-27 at 04:51Here's a contrived demonstration program. It reads in strings from standard input until EOF, sorts them, then prints them out:
QUESTION
I just installed GNU Smalltalk gst
on Ubuntu and when I enter gst
into the terminal, I get this:
ANSWER
Answered 2021-Feb-21 at 14:33The problem is that there's a conflict between the Smalltalk gst
command and, evidently, an alias provided by the git
package installation called gst
which probably does a git status
. This cause has been indicated in other linked answers (e.g., here), but those answers don't tell you what to do to solve it.
There are a couple of ways this can be solved easily:
You can undo the alias that the git
installation setup by doing an unalias in your login profile. Make sure you put it after any global profile is executed:
QUESTION
What is the exact meaning of these characters ←, ≡, ¬, ≠, ⌾, and ∢ and how are used in Smalltalk-80?
consider the following expressions: (taken from the smalltalk-80 source code)
^self class ≡ x ≡ false
^mem ◦ ¬448 ≠ 0
strm frame ← 15000 ⌾ frame origin y rect: 20000 ⌾ frame corner y.
neg ← (aStream ∢ 45 "-" ifTrue: [true] ifFalse: [aStream ∢ 21 "**¬**"]).
Note: This examples were extracted from the original Xerox Alto disks found in this link: http://bitsavers.trailing-edge.com/bits/Xerox/Alto/disk_images/
...ANSWER
Answered 2021-Jan-29 at 16:29Sounds like this is a source file from a Xerox-internal version of Smalltalk-80. For the public release they must have replaced these "unusual" chars (which required custom font glyphs) with ASCII, only keeping ←
and ↑
glyphs for the _
and ^
ASCII characters.
This is a best guess based on my experience with St76/78 (Update: confirmed by Dan Ingalls):
←
assignment as invar ← object
. Same in St80.rcvr word← arg
is an alternative toword:
and usually indicates assignment to a slot of the receiver (e.g.x←
as inpoint x ← 100
). St80 only allows keywords ending in a colon:
.The parser treats
←
as lower precedence so you can have keyword expressions on both sides of it. E.g.a foo: b ← c bar: d
would eval
c bar: d
and pass the result as second argument to a'sfoo:←
method).◦
indexing as inarray◦index
. St80 usesat:
instead.◦←
equivalent to St80'sat:put:
as inarray◦index ← value
≡
identity, like St80's==
¬
literal for negative numbers as in¬1
for -1. The parser treated-
as a binary message selector so another symbol had to be used for negative numbers literals.≠
not equal, like St80's~=
≢
not identical, like St80's~~
⌾
create a Point, like St80's@
∢
match token from stream. If the next token read from stream matches the argument, it is consumed and returned. Otherwise it answersfalse
.
For more info check out the Smalltalk Zoo website.
QUESTION
Is it possible to compare localized strings in some Smalltalk implementation? The only one I have met so far is Pharo and GNU ST, which seem to lack this ability. It seems the only possibility would be to write an ICU wrapper from scratch. (That's far beyond my experiences.)
I know this is a complicated functionality. Unfortunately, it is needed very often everywhere, e.g., sorting menus in web apps.
I mean:
...ANSWER
Answered 2021-Jan-19 at 08:29I can't speak for other dialects, but GemStone does have this capability:
QUESTION
Since Smalltalk scheduling is non-preemptive, processes must explicitly yield or wait on a semaphore
Does this mean that one object entering an infinite loop could stall the entire system?
the loop can be interrupted at any time. Even an atomic loop like [true] whileTrue can be interrupted before "executing" the true object
By what can it be interrupted?
...ANSWER
Answered 2020-Dec-11 at 20:32Yes, it is super simple to just run
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install smalltalk
You can use smalltalk like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page