Need it for a program I'm writing (repeated squaring to comput x^n). I can't seem to find the syntax for it, or if it is even supported.
Asked
Active
Viewed 970 times
5
-
I think my answer here already answers your [other question](http://stackoverflow.com/questions/35740771/how-do-i-inspect-an-integers-base-2-representation-in-standard-ml), so either delete that one, or edit it if there's something else you wanted there. – Ionuț G. Stan Mar 02 '16 at 10:04
1 Answers
6
They're available within the Word8
and Word
structures.
let
open Word8
infix andb orb xorb notb << >> ~>>
in
print (Word8.fmt StringCvt.BIN 0wxF) (* 1111 *)
; print "\n"
; print (Word8.fmt StringCvt.BIN 0wxA) (* 1010 *)
; print "\n"
; print (Word8.fmt StringCvt.BIN (0wxF andb 0wxA)) (* 1010 *)
; print "\n"
end

Ionuț G. Stan
- 176,118
- 18
- 189
- 202
-
2I want to note that there are also `andb orb xorb notb << ~>>` (though not `>>`) in the `IntInf` structure – newacct Mar 02 '16 at 22:07
-
The link is broken; [here's the updated link](https://smlfamily.github.io/Basis/word.html#SIG:WORD.andb:VAL) – zbw Mar 12 '21 at 21:04