code logs -> 2013 -> Fri, 23 Aug 2013< code.20130822.log - code.20130824.log >
--- Log opened Fri Aug 23 00:00:03 2013
00:05 You're now known as TheWatcher[T-2]
00:07 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
00:07 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Connection reset by peer]
00:15 You're now known as TheWatcher[zZzZ]
00:24 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
00:48 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Client closed the connection]
00:48 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
00:54 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
01:56 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Ping timeout: 121 seconds]
01:57
<&ToxicFrog>
Yeah, I remember gccxml being actually rather exciting because now you could get semantic information from anything gcc could parse, and all you needed to do was parse XML.
01:58
<&ToxicFrog>
Which is not exactly fun, but if my choices of input format are "gcc internal API", "C++ source code", or "XML", well, hand me the XML parser.
01:58 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
02:01
<&McMartin>
Yeah. I think that this is obsolete now that gcc can emit gimple.
02:06 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Client closed the connection]
02:06 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
02:21 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Ping timeout: 121 seconds]
02:44 Vorntastic [Vorn@Nightstar-b8287ec3.sub-70-211-15.myvzw.com] has joined #code
02:47 RichyB [RichyB@D553D1.68E9F7.02BB7C.3AF784] has quit [[NS] Quit: Gone.]
02:50 RichyB [RichyB@D553D1.68E9F7.02BB7C.3AF784] has joined #code
03:08 * Vorntastic thinks at vorntiers, which is now enjoying a renaissance because he found love2d and he's gotten around to poking at it.
03:11
<&ToxicFrog>
love2d is pretty tasty
03:12
<&ToxicFrog>
symbol and I have been running our HTPC infrastructure on it~
03:12
<&ToxicFrog>
in other news, I have discovered some->>, and it makes me very happy even if it confuses the syntax hilighting engine.
03:12
<&Derakon>
some->>?
03:13
<&ToxicFrog>
It's like ->> but shortcircuits on ninl
03:13
<&ToxicFrog>
*nil
03:13
<&Derakon>
Language?
03:13
<&ToxicFrog>
Making it analogous to Haskell's Maybe monad.
03:13
<&ToxicFrog>
Clojure.
03:15 Thalasleep [thalass@Nightstar-de48278f.bigpond.net.au] has quit [Ping timeout: 121 seconds]
03:16
< Vorntastic>
At the moment I'm back to thinking about game generation.
03:25 McMartin [mcmartin@Nightstar-141a9c34.pltn13.sbcglobal.net] has quit [[NS] Quit: bbiab]
03:29 McMartin [mcmartin@Nightstar-141a9c34.pltn13.sbcglobal.net] has joined #code
03:29 mode/#code [+ao McMartin McMartin] by ChanServ
03:52 Thalasleep [thalass@Nightstar-de48278f.bigpond.net.au] has joined #code
03:54 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
03:55 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Operation timed out]
03:56 Thalasleep is now known as Thalass
04:04 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Client closed the connection]
04:05 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
04:06 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Connection reset by peer]
04:06 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
04:07 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Connection reset by peer]
04:07 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has joined #code
04:08 Karono [Karono@9C034E.4BE65E.E00AF8.FDA077] has quit [Connection reset by peer]
04:09 Thalass [thalass@Nightstar-de48278f.bigpond.net.au] has quit [Ping timeout: 121 seconds]
04:09
<@Reiv>
HTPC?
04:12 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
04:13 mode/#code [+o himi] by ChanServ
04:40
<@Alek>
Home Theater PC
04:40
<@Alek>
PC connected to your TV and perhaps stereo, to stream shows, movies, etc, generally.
04:42
<@Reiv>
... why would you run your HTPC on love2d?
04:46
<@Alek>
... I dunno? where did you see that?
04:48 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
04:48 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:51
<@Reiv>
Above.
04:52 Vorntastic [Vorn@Nightstar-b8287ec3.sub-70-211-15.myvzw.com] has quit [[NS] Quit: Bye]
04:54
<~Vornicus>
And the reason is, TF is running his own custom softwar, that lets him use emulators, VLC, whatever else
04:54 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
04:59
<@Reiv>
I see.
05:00
<@Reiv>
Why am I not suprised TF has homebrewed his own entertainment system.
05:01
<~Vornicus>
Because this is TF we're talking about
05:04
<@Reiv>
Yeah, a tad.
05:12
<&McMartin>
http://www.chris-granger.com/2013/08/22/light-table-050/
05:12
<&McMartin>
New Light Table out
05:15 Derakon is now known as Derakon[AFK]
05:17 Thalass [thalass@Nightstar-de48278f.bigpond.net.au] has joined #code
05:24
<@Reiv>
... Light Table looks very pretty.
05:24
<@Reiv>
It's a Python IDE?
05:25
<&McMartin>
Clojure, JS, Python.
05:25
<&McMartin>
Started as Clojure, but watching development I think JS is its most powerful one now
05:27
<@Reiv>
I know very little about Clojure, so
05:27
<@Reiv>
How good is its python?
05:27
<&McMartin>
It's a Lisp dialect, more or less
05:27
<&McMartin>
I've not tried its Python. But that was a stretch goal at start.
05:27
<&McMartin>
I suspect it's rather basic
05:27
<@Reiv>
Aw.
05:28
<@Reiv>
It's what would've sold it to me; and the thing looks very nice. >_>
05:28
<&McMartin>
One of the big deals for Light Table is that it does realtime dataflow visualization
05:28
<&McMartin>
It's open source~
05:28
<&McMartin>
as an IDE it's probably quite nice for Python
05:28
<@Reiv>
Sold in terms of investment, not cash~
05:28
<&McMartin>
Yeah
05:28
<&McMartin>
I funded this project primarily because I want to see IDE experimentation~
05:29
<@Reiv>
Right, I... think we're talking different languages, because you're the engineer that builds jet planes and I like building with Meccano
05:29
<&McMartin>
But the gimmick before would be that you define a bunch of functions, and then type f(3) or whatever
05:30
<&McMartin>
And then you see the variables in the calls get replaced in the code temporarily with the 3 and the derived values thereof
05:31
<@Reiv>
Right
05:33
<&McMartin>
That's the part I'd expect to work less well for JS and Python, since variables, like, get reassigned
05:33
<&McMartin>
Or assigned through
05:33
<&McMartin>
But 0.5 has some kind of super-watch system in JS that looks promising
05:34
<@Reiv>
But not yet for Python?
05:40
<&McMartin>
I haven't checked
05:40
<&McMartin>
It's pretty clear that he's mostly getting feedback from JS/HTML5 guys.
05:41 ErikMesoy|sleep is now known as ErikMesoy
05:44
< [R]>
How is Light Table for people used to vim?
05:45 * [R] is willint to experiment, just wanting to know how much effort to put in.
05:47
<@Reiv>
Awh.
06:12 Thalass is now known as Thalaway
06:16 Thalaway [thalass@Nightstar-de48278f.bigpond.net.au] has quit [Ping timeout: 121 seconds]
06:18 Kindamoody[zZz] is now known as Kindamoody
06:42
<&McMartin>
R: It's based on some text component I'm unfamiliar with
06:42
<&McMartin>
The, er, control scheme is closer to a Windows or Mac text editor.
06:45
< [R]>
Hmm, will try it anyways.
06:49
<~Vornicus>
kitty I cannot program with you on my arm like this
07:11 Netsplit *.net <-> *.split quits: Typherix
07:13 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
07:19 Netsplit over, joins: Typherix
07:19 celticminstrel [celticminst@Nightstar-ae361035.dsl.bell.ca] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
07:57 Kindamoody is now known as Kindamoody|out
08:20
< jeroud>
Kitty! \o/
09:15 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has joined #code
09:21 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
09:38 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
09:38 mode/#code [+o himi] by ChanServ
09:56 You're now known as TheWatcher
10:05 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has quit [Ping timeout: 121 seconds]
12:16 Karono [Karono@Nightstar-13c26ed9.optusnet.com.au] has joined #code
12:45
<@Azash>
http://imgur.com/gallery/skeWow2
13:42
< [R]>
"// standards compliant; doesn't work in IE"
13:51 * TheWatcher eyes
13:51
<@TheWatcher>
This code consipires to confound and confuse me
13:53
<&jerith>
It is code.
13:53
<&jerith>
That is its primary purpose.
14:06
< Syka>
i like the html5 one
14:06
< Syka>
"Does it work in IE? No? Then it's HTML5."
14:12 Karono [Karono@Nightstar-13c26ed9.optusnet.com.au] has quit [Client closed the connection]
14:12 Karono [Karono@Nightstar-13c26ed9.optusnet.com.au] has joined #code
14:47 * iospace sighs
14:47
<@iospace>
i hate test scripts
14:53
< Xon>
iospace, is not having them any better?
14:57
<@iospace>
Xon: point, but they're acting up and making my life hard
14:57
<@iospace>
i need a release done yesterday
14:58
< Xon>
lol
14:58
<@iospace>
yeah Dx
15:12 celticminstrel [celticminst@Nightstar-ae361035.dsl.bell.ca] has joined #code
15:12 mode/#code [+o celticminstrel] by ChanServ
15:18 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
15:55 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
15:55 mode/#code [+ao Derakon Derakon] by ChanServ
15:55 * Derakon mutters at programs that refuse to exit properly when you close them.
15:55
<&Derakon>
The new cockpit worked fine! Until the user tried to re-start it (for whatever reason) and discovered that it wouldn't start up. Because the previous instance was still there. Invisible.
15:56
<&Derakon>
I had to start up Task Manager, find the pythonw.exe process, and close it manually.
16:31 * iospace eyes her board and sighs
16:32 Syloq [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Operation timed out]
16:35 Syloq [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
16:35 mode/#code [+o Syloq] by ChanServ
16:49 Syka [the@Nightstar-1aebe99b.iinet.net.au] has quit [Ping timeout: 121 seconds]
16:52
<@Azash>
Derakon: The solution is, of course, to write your program to close any existing ones :P
17:07
<&Derakon>
Azash: that is the emergency backup solution, actually.
17:07
<&Derakon>
win32.TerminateProcess.
17:29
<&Derakon>
Whelp, figured out the cause of the problem this time -- trying to create a wx.ProgressDialog in a non-main thread.
17:29
<&Derakon>
Now I just wish I knew why that results in the program not exiting cleanly.
17:34 * ToxicFrog tries to figure out a way to do a stateful group-by that doesn't look incredibly ugly
17:34 Karono [Karono@Nightstar-13c26ed9.optusnet.com.au] has quit [Connection reset by peer]
17:41
<&ToxicFrog>
Hmm. It seems like zipmap should be easily applicable here.
17:41 * iospace beats ToxicFrog with a borked SPI NOR Flash
17:50
<&ToxicFrog>
Pretty sure I'm going to hell for this
17:50
<&ToxicFrog>
(->> body (tag-seq :section)
17:50
<&ToxicFrog>
(filter #(not= "gamebox systemend" (:class (:attrs %))))
17:50
<&ToxicFrog>
(partition-by (comp :class :attrs))
17:50
<&ToxicFrog>
(partition 2)
17:50
<&ToxicFrog>
(map (fn [[[header] games]] [(:content header) games]))
17:50
<&ToxicFrog>
(into {})
17:50
< RichyB>
What Lisp are you writing in?
17:50
<&ToxicFrog>
The best part is that now that I look at the output, this whole thing can be replaced with:
17:51
<&ToxicFrog>
(->> body (tag-seq :section) (filter #(= "gamebox" (:class (:attrs %)))) (group-by (re-match (:content %) ;insert horrifying regular expression here)))
17:52 * ErikMesoy inserts a horrifying regular expression
17:52
<&ToxicFrog>
RichyB: Clojure.
17:53
< RichyB>
It looks pretty pretty for a lisp.
17:53
<&ToxicFrog>
It is.
17:54
<&ToxicFrog>
-> ->> and some->> in particular make me very happy indeed.
17:58 PinkFreud [WhyNot@NetworkAdministrator.Nightstar.Net] has joined #code
17:58 mode/#code [+o PinkFreud] by ChanServ
18:05
< RichyB>
What's (->>)? "Compose all of the following functions"?
18:05
<@Tamber>
"Threaten these functions with a good stabbing."
18:11
< RichyB>
That would be the ââ â operator
18:16
< ErikMesoy>
The [2654] [sign that looks like AOA over WOW] [0000] operator?
18:17
< RichyB>
Unicode better in the future, ErikMesoy.
18:17
< RichyB>
That's u+2694 CROSSED SWORDS, u+2620 SKULL AND CROSSBONES, then another CROSSED SWORDS.
18:18
< ErikMesoy>
Oh, I can kinda see the skull and crossbones now as tiny pixel art.
18:44
<@Azash>
What's the Correct Way to do child nodes in JSON?
18:44
<&Derakon>
Child nodes?
18:44
<@Azash>
{ left : { right : {} } }
18:44
<@Azash>
As a tree example
18:45
<&Derakon>
You mean, nested dictionaries?
18:45
<@Azash>
Is there a better way than to write them inside each other?
18:45
<@Azash>
I guess
18:46
<&Derakon>
If you're hoping for some way to avoid excessive indentation, you're not gonna find it.
18:51
<&Derakon>
...ah, good to know. bool(Queue.Queue()) will always return True even if the queue is empty.
18:54
<@Azash>
Oops?
19:00 Syka [the@Nightstar-e0f5fd20.iinet.net.au] has joined #code
19:09
<&ToxicFrog>
RichyB: kind of, yeah
19:09
<&ToxicFrog>
(-> x f g h) evalues (f x), then passes the result of that to g, then to h, etc
19:09
<&ToxicFrog>
So it's (h (g (f x))), except readable.
19:09
< RichyB>
Azash, indeed, oops.
19:10
<&ToxicFrog>
Except it can take forms as well as functions, since it's a macro - (-> x f (g 1) h) is legal and eqv to (h (g (f x) 1))
19:10
< RichyB>
For container types in Python, bool(x) should always return the same value as (len(x) != 0)
19:10
<&ToxicFrog>
->> is the same except things are passed through as the last argument to each form, not the first.
19:11
<&ToxicFrog>
some-> and some->> are versions that short-circuit as soon as one of the forms evaluates to nil, so you can do something like (some->> x f g h) where (f x) might return nil and (g nil) is an exception.
19:12
<&ToxicFrog>
(for straight up function composition, there's (comp))
19:15
< RichyB>
I think that some of that is doable with currying, but certainly not all. What the some-> forms do is doable with MaybeT.
19:15 ktemkin[awol] is now known as ktemkin
19:15
<&ToxicFrog>
Yeah, I actually learned about some-> and some->> by asking #clojure "is there a ->> that behaves like the Maybe monad"
19:16
<&ToxicFrog>
->> can be done pretty straightforwardly if you have haskell-style automatic partial application and currying everywhere.
19:17
<&ToxicFrog>
-> is a lot harder because you need to partially apply all of the arguments except the first, which is easy in Scala but not so much in Haskell; Clojure handles it by making it a macro.
19:26
< simon_>
I'm trying to make up some recursive functions that necessitate running themselves as the first thing they do. e.g. "fun f x = let y = f ... in ... end"
19:26
<&ToxicFrog>
RichyB: anyways, if you find yourself looking for a lisp, I do highly recommend clojure.
19:27
< RichyB>
Yeah.
19:27
< simon_>
I'm thinking something that returns a Maybe a ('a option in SML), since it needs constant unpacking of the Just constructor
19:28
< RichyB>
Between having seen the stuff about Twitter's systems migration to everything running on JVMs lately, and the sheer niceness of Clojure it's like⦠yeah, that'll do.
19:28
<&ToxicFrog>
Yeah, thus far my only complaint about it is that the JVM takes forever to start up on orias.
19:29
<&ToxicFrog>
Wait, no.
19:29
<&ToxicFrog>
That, and debugging is not nearly as nice as it should be. Stack traces in clojure are ugly.
19:29
< RichyB>
simon_, you kind of can't do that unless that "let y = f ... in " is lazy in y.
19:30
< RichyB>
Because f x = f (some expression involving f and x...) = f (f (...)) = f (f (f (...))) = ...
19:30
< RichyB>
It'll always diverge unless your 'let' is lazy.
19:30
< RichyB>
If you do have a lazy let though, then you can write things like:
19:31
< RichyB>
> fix f = let x = f x in x
19:31
< RichyB>
whiiiich expands to f (f (f (f (f... too, but in a lazy language that can work.
19:35
< RichyB>
e.g. > fix (\l -> 1 : l) -- is an infinite (well, circular) list whose values are all 1.
19:43 Kindamoody|out is now known as Kindamoody
19:47
< simon_>
RichyB, I'm sorry, I didn't expand enough on my thoughts: so long as f's argument is a reduction of x (e.g. a tail or a sub-tree), it should lead to a recursive base-case.
19:53
< RichyB>
You hav to examine x to see whether it's reached the base-case *before* recursing for that to work.
19:53
< RichyB>
*have
19:55
< simon_>
okay, so what I'm aiming at is this:
19:55
< simon_>
fun sum [] = 0
19:55
< simon_>
| sum (x::xs) =
19:55
< simon_>
let val res = sum xs in res + x end
19:56
< simon_>
except there isn't really any point in calling sum xs before calculating (+ x)
19:56
< simon_>
e.g. I might as well have written " | sum (x::xs) = x + sum xs".
19:57
< RichyB>
Yes, that's perfectly sensible.
19:57
< RichyB>
There would be if you were using the value 'res' more than once in the output.
19:58
< simon_>
so one reason for declaring the call first is if I need to use the result twice and binding it alleviates its dual computation
19:58
< simon_>
yes
19:58
< simon_>
so I'm trying to think of assignments in which this would be an advantage.
20:32 Kindamoody is now known as Kindamoody[zZz]
20:41 * ToxicFrog discovers sort-by, is very happy
20:47 * Derakon mutters at the camera, wonders why it only crashes when triggered externally.
20:48
<&ToxicFrog>
And since maps in clojure are callable, and so are symbols, (sort-by :name games) sorts the sequence games by the value of the :name field in each element.
20:48
<&ToxicFrog>
\o/
20:52
< simon_>
nice
20:52
< simon_>
I would've thought it was like Haskell's sortBy.
20:53
<&ToxicFrog>
What does that do?
20:53
<&Derakon>
I was expecting a sort function that takes another function to evaluate two elements.
20:54
<&ToxicFrog>
Aah. Yeah, that's an overload on sort.
20:54
<&ToxicFrog>
(sort seq) or (sort fn seq)
20:55
<&ToxicFrog>
(sort-by fn seq) uses the default comparator on whatever fn returns for each seq element, but places the original elements into the output (unlike (sort (map fn seq))
20:56
<&ToxicFrog>
which is not what I was expecting, but is actually damn handy.
20:58
< RichyB>
Haskell's is (sortBy :: (a -> a -> Ordering) -> [a] -> [a]), where Ordering = data LT | EQ | GT
20:58
< RichyB>
er, data Ordering = LT | EQ | GT
20:58
<&ToxicFrog>
Aah.
20:59
< RichyB>
To get Clojure's version, define: sortByKey f l = sortBy (\a b -> compare (f a) (f b)) l
21:01
< RichyB>
Clojure's sort-by is like Python's sorted(list, key=lambda k: ...), Haskell's is like Python's sorted(list, cmp=lambda a, b: ...)
21:40 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
22:14 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has joined #code
22:34 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [[NS] Quit: leaving]
22:45
< simon_>
ToxicFrog, Haskell has some pretty neat sorting idioms
22:46
< simon_>
ToxicFrog, sortBy (compare `on` fst)
22:48
< simon_>
ToxicFrog, compare is just the typeclass-overloaded comparison function for any Ord type, whereas on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
22:49
< simon_>
ToxicFrog, compare `on` fst becomes \x y -> compare (fst x) (fst y), i.e. sort by some record's property rather than the record itself
22:52
< RichyB>
on g f a b = g (f a) (f b)
22:53
< RichyB>
compare `on` fst == on compare fst == \a b -> compare (fst a) (fst b)
23:05 ErikMesoy is now known as ErikMesoy|sleep
23:07 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has quit [Ping timeout: 121 seconds]
23:25
< simon_>
RichyB, thanks, that makes a little more sense than the type sig. :)
23:26
< RichyB>
Equational reasoning for the win! ^_^
23:26
< RichyB>
At least, when the equations are simple. :|
23:26
< simon_>
yeah.
23:26
< simon_>
so long as they don't involve a heckload of recursion.
23:27
< simon_>
RichyB, I didn't explain myself very well before. the core of the problem is that I've been asked to give examples of problems that are best solved by thinking of recursively solving a sub-problem first and then handling its result.
23:28
< simon_>
I thought: the moment the result from the sub-problem needs to be either used twice or needs unpacking before use, then that pattern may apply (but isn't required as one can do it using either case-of pattern matching or even helper functions that handle the binding)
23:29
< RichyB>
Rrrrright, but it doesn't matter whether you write sum as: { sum [] = 0; sum (a:as) = a + sum as; } or whether you write it as { sum [] = 0; sum (a:as) = let { how_many_left = sum as; } in a + how_many_left; }
23:29
< RichyB>
either will proceed with the same evaluation order because of the data dependency
23:30
< simon_>
right
23:30
< simon_>
so that's a bad example.
23:30
< RichyB>
No, it's a fine example of the principle. The sum of a list is its first element added to the sum of the rest of it.
23:31
< RichyB>
It's just that moving the `let` keyword as far left as you can while still on the RHS is little more than a distraction from what you're actually interested in. :)
23:31
< simon_>
here's one that works better: longshort : (int -> bool) -> int list -> (int * int), partitions numbers based on some predicate.
23:33
< RichyB>
Yyyes, the only clear way to write that one is with a de-structuring bind on the recursive call.
23:33
< simon_>
sorry, that'd be (int list * int list). I was thinking of longshort : string list -> (int * int) for doing long and short strings.
23:33
< simon_>
and then count them
23:34
< RichyB>
(Amusing aside: I can usually read ML, but no idea how to write it. ;)
23:35
< simon_>
haha
23:35
< simon_>
yeah, no problem. I keep messing up ML/Haskell these days.
23:35
< simon_>
e.g. int * int vs. (Int, Int)
23:39 Derakon[AFK] is now known as Derakon
23:43
< RichyB>
How about mergesort? The core step is splitting the input halfway, recursively sorting both sides and merging. It's nicely binary-tree structured.
23:43 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
23:43
< RichyB>
The merge operation also has this nice linear structure where you can always see one or the other of the two input lists getting shorter as you cons onto the output.
23:45
< simon_>
yeah, that'd be great. well, any recursive function operating on trees would also work, since you probably need multiple recursions down different branches, and keeping track of any stack explicitly seems worse than having to make recursive calls in advance.
23:46
< simon_>
I'm making exercises for my flatmate who will be a TA in an introductory functional programming course and hasn't done FP in a year.
23:46
< RichyB>
Can s?he get away with just reading SICP at the class? ;)
23:47
< simon_>
well, it's ML and she doesn't know Scheme ;)
23:48
< RichyB>
Out of curiosity, which ML?
23:49
< simon_>
Standard ML
23:49
< simon_>
using the Moscow ML compiler
23:49
< simon_>
(I think very few people use mosml)
23:49
< simon_>
since there's mlton, smlnj, mlkit, polyml that all seem superior.
23:57
< RichyB>
Hrmn. Is the grammar for well-formed XML in LL(1)?
23:57
< RichyB>
(It looks to me like it ought to be.)
23:58
<@Azash>
http://tnx.nl/legacy-ip-only.svg
23:58
< RichyB>
Bringing compilers into it by accident would maybe suck fat rocks hard, but you can hand-write an LL(1) recursive parser with not-inordinate effort
23:59
< RichyB>
Tree serialisation is a nice recursive exercise too.
--- Log closed Sat Aug 24 00:00:18 2013
code logs -> 2013 -> Fri, 23 Aug 2013< code.20130822.log - code.20130824.log >

[ Latest log file ]