Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Text parsing

Name: Anonymous 2014-04-16 11:26

Hey guys suppose I have an application that is fed the body of my post. Now my post might contain quotations such as
>>8
>>3-7
>>2,3,4
>>7-8,2,5,10-12
It also may have quotations mid-text such as >>42.

Now, I want the result of my application to be
2 3 4 5 6 7 8 10 11 12
.
Notice 42 is missing because it was midtext.

How would you code that? (Before you laugh and say it's trivial - it is, but I want to code it).

I figured, maybe I will use perl. But maybe not. Since it's been a lot of time since I coded, I want to use something that is funky to code it. Perhaps factor, or J. Well, that's my shitty thread, thanks for reading.

Name: Anonymous 2014-04-17 1:19

>>8
It can be inlined with some additional loop fu

(loop repeat n
counting (< (+ (expt (random 1.0) 2)
(expt (random 1.0) 2))
1.0)
into c
finally (return (/ c n 0.25)))

writing CL is a joy really. I am trying to cook up a solution in mathematica using anonymous functions and the y combinator, the idea is that you need a predicate and just the anonymous function calling itself with two internal counters, n and the number of times the predicate was sucessful. So the black box would look something like this

(whatever P) ==> now you get a function that when called with argument n represents the number of times P was satisfied when called n times

... but I failed. I'll continue watching my movie Donnie Darko.

Thanks for the post!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List