illo
Re:ASCII Lookup Utility in Ada
on Tuesday April 15, 2025 @05:28AM (#43690693)
Standard ML program. I fear it does not contribute much to the conversation but I cannot abstain from calling attention to my favourite pragmatic programming language that is presently on what seems to be a neverending life support.
structure I = Int
structure S = String
structure SU = Substring
structure SC = StringCvt
infix 5 >>
fun (x >> y) f = if x = y then () else (f x; ((x + 1) >> y) f)
val printRow =
let
val p0 = SC.padLeft #"0" val ps = SC.padLeft #" "
val td = I.fmt SC.DEC val tx = I.fmt SC.HEX
val to = I.fmt SC.OCT val tb = I.fmt SC.BIN
val desc = fn
0 => "NUL" | 1 => "SOH" | 2 => "STX" | 3 => "ETX" | 4 => "EOT" | 5 => "ENQ"
| 6 => "ACK" | 7 => "BEL" | 8 => "BS" | 9 => "HT" | 10 => "LF" | 11 => "VT"
| 12 => "FF" | 13 => "CR" | 14 => "SO" | 15 => "SI" | 16 => "DLE" | 17 => "DC1"
| 18 => "DC2" | 19 => "DC3" | 20 => "DC4" | 21 => "NAK" | 22 => "SYN" | 23 => "ETB"
| 24 => "CAN" | 25 => "EM" | 26 => "SUB" | 27 => "ESC" | 28 => "FS" | 29 => "GS"
| 30 => "RS" | 31 => "US" | 32 => "SPC" | 127 => "DEL" | n => str (chr n)
in
fn n => print (S.concatWith " " [ps 3 (td n), p0 2 (tx n), p0 7 (tb n), p0 3 (to n), desc n] ^ "\n")
end
val spec =
let
val scan = fn rad => fn sl => SC.scanString (I.scan rad) (implode sl)
in
fn str => valOf (case explode str of
#"0" :: #"x" :: hex => scan SC.HEX hex
| #"0" :: #"o" :: oct => scan SC.OCT oct
| #"0" :: #"b" :: bin => scan SC.BIN bin
| dec => scan SC.DEC dec)
end
val () = case CommandLine.arguments () of
[] => (0 >> 128) printRow
| [req] => printRow (spec req)
| _ => raise Fail "arguments"
Re:Test, [, and [[ (2020)
on Thursday November 23, 2023 @04:47AM (#38391098)
> [ a = b ] && echo "Oops!" || echo "Expected; phew!"
Not to be taken as a general rule though. I might be mistaken but I think that bash would parse the line as:
([ a = b ] && echo "Oops!") || echo "Expected; phew!"
so if the command sequence after `&&` fails, then the code sequence after `||` is executed anyway: illo@joe:~ $ [ "a" == "a" ] && >/dev/full echo "strings match" || echo "strings don't match"
-bash: echo: write error: No space left on device
strings don't match
illo@joe:~ $
This is different from the semantics of the `if` block: illo@joe:~ $ if [ "a" == "a" ]; then >/dev/full echo "strings match"; else echo "strings don't match"; fi
-bash: echo: write error: No space left on device
illo@joe:~ $Data Submitted by the Italian Civil Defense on COVID19 in Italy, Updated Daily
Spark (major NZ telecom) to employees: Agile or leave
Re:Words for “yes” in Romance languages
on Saturday February 24, 2018 @06:57AM (#16452902)
Italian has "ni", a merge of "no" and "sì".
Erlando: Syntax Extensions for Erlang
Functional Unparsing (1998) [pdf]
The Future of Programming (2013)
Re:The Swedish Loneliness
on Monday October 03, 2016 @01:56AM (#12625689)
In case anybody wants to hear a different bell, I am probably as wealthy as jack9 and equally happy about my lifestyle, but I love people and I've never lived alone in all my life. My opinion is that it's more a matter of having different social needs and sensitivity, than being economically independent. Or maybe it's what you think of yourself -- I know for a fact that there are always smarter and more interesting and different people out there and I'd love to know them and experience life with them. It's a basic need I feel that doesn't depend on whether I'm able to support myself or not.
Ask HN: Will you ditch your Mac for a PC running Windows 10 because of WSL?
Windows 10 Anniversary Edition is about to be released, sporting Windows Subsystem for Linux. Do you think Macs will lose their "cool factor" amongst developers and engineers, leading in the long-term to lack of support from open-source projects?
Apple Helped FBI Identify Alleged Owner of KickassTorrents
FlashForth: A Forth System for Arduino and PICs
Re:Lisp implementation in sed
on Saturday June 28, 2014 @05:33AM (#7957841)
Erlang, just for fun:
grade(#student{work=Work, tried_hard=Tried}) -> grade1(Work, Tried).
grade1(excellent_work, _) -> 'a+';
grade1(okay_stuff, yes) -> b;
grade1(okay_stuff, _) -> 'b-';
grade1(_, _) -> c.
Edit: formatting.
Re:It's Not Just Apple vs Android
on Friday March 15, 2013 @08:52AM (#5380283)
In which way a market can truly be split between (ideologically) better and worse players (this is a sincere question, no rethorics)? My point of view is that all the companies involved in this mobile-market dance happened and will happen (sometimes willingly) to turn out evil or good based on what better suits them in a particular point in time. I'm confident it will take just time for Samsung to show they're just a company (no deontology involved). Same goes for Google, HTC, LG, whatever. Apple, they chose the wrong juncture and now are paying that by (deservingly) facing endless bad publicity. So, no, I don't think the "good guys" won (let alone the fact that profit-wise they're actually all winning right now), I can't even think about them being good guys... just companies.