Menu
  • HOME
  • TAGS

Smalltalk Visual Works concurrency

multithreading,concurrency,smalltalk,visualworks

VisualWorks uses non-preemptive multitasking This means that when two processes have the same priority, one process needs to yield in order to another to run. Try running the following code to see the difference: p1 := [ 1 to: 3000 do: [:i | Transcript show: 'AA';cr. i \\ 10 =...

small talk: how to turn int into a string of its hex value? (visual works)

string,numbers,smalltalk,visualworks

(10 + 5) asBigEndianByteArray asHexString => '0F' should suffice. There doesn't seem to be an asHexString equivalent on numbers themself, so we have to convert the number to a ByteArray first. If you have to trim the leading 0s you could do something like the following: [result allButLast startsWith: '0']...

convert int to binary in smalltalk visualworks

binary,integer,smalltalk,visualworks

Try using the bitAt: method. This method extracts a bit from an integer and tells you whether it's a 1 or a 0. It will extract any bit you want and treat bits higher than the size of the integer as 0's. 5 bitAt: 1 ==> 1 5 bitAt: 2...

Converting a string and an integer to a hex in smalltalk

string,hex,smalltalk,visualworks

Try this: (Compiler evaluate: '16r', self stringToMakeHex) To convert back: (sum printStringRadix: 16) ...