[racket-users] Racket -script running other Racket scripts

2016-08-21 Thread Pekka Niiranen
Hello users, I am trying to eradicate *.bat files running Racket scripts. What is the idiom to make Racket script to start itself recursively (system, process, subprocess) when main script is started from shell and all outputs are printed to console? "racket mscript.rkt args" => (system *.bat)

Re: [racket-users] Help needed in file processing idioms

2016-08-20 Thread Pekka Niiranen
ich contains >>;; substring "ON", otherwise #f >>(call-with-input-file (hash-ref *params* "myfile") >> (lambda (inp) >>(for/or ([row (in-lines inp 'return-linefeed)]) >>(string-contains? row "ON") >> &g

[racket-users] Help needed in file processing idioms

2016-08-19 Thread Pekka Niiranen
Hello users, I would like to read lines from a file, process each line and return either the success of the operation or the processed line to another function located in another module. Below are two functions that work OK, but are in my opinion "ugly" because they use "set!". It there a w

[racket-users] Re: For/lists: where is #:continue?

2015-07-13 Thread Pekka Niiranen
00)] [i (in-range start (sub1 end))] [s (in-value (vector-ref vector i))] [columns (in-value (string-split s ","))] [col# (in-value (length columns))] #:when (< 2 col#)) (first columns)) On Mon, Jul 13, 2015 at 3:46 PM, P

[racket-users] Re: For/lists: where is #:continue?

2015-07-13 Thread Pekka Niiranen
) On Mon, Jul 13, 2015 at 3:18 PM, Jon Zeppieri wrote: I think you're looking for #:when / #:unless. On Mon, Jul 13, 2015 at 3:12 PM, Pekka Niiranen wrote: Hello users, What is the proper design pattern to skip invalid values when using for/list? The programs below fails because

[racket-users] For/lists: where is #:continue?

2015-07-13 Thread Pekka Niiranen
Hello users, What is the proper design pattern to skip invalid values when using for/list? The programs below fails because #:continue is not recognized: for/list ([i (in-range 0 1000)]) (let ((value (vector-ref vector i))) (if (< 0 (length value)) value #:continue))) Sur

[racket-users] Re: How to return summary from the inner loop?

2015-07-11 Thread Pekka Niiranen
~a\n" lo v hi) (add1 failures))) (validate-ranges5 '(5 15 25) '(1 11 21) '(10 20 30)) => *** Faulty!: 1 < 5 < 10 *** Faulty!: 11 < 15 < 20 *** Faulty!: 21 < 25 < 30 3 On Fri, Jul 10, 2015 at 5:40 PM, Pekka Niiranen wrote: Thanks Sir, This was ex

[racket-users] Re: How to return summary from the inner loop?

2015-07-10 Thread Pekka Niiranen
Thanks Sir, This was exactly what I tried to reason. It never occured to me that parameter "failure" can be used in both for/fold -constructs. About the problem (Stephen): value-list: '(5, 15, 25) low-list: '(1, 11, 21) high-list: '(10, 20, 30) I need to check the following 9 cases: LV

[racket-users] How to return summary from the inner loop?

2015-07-10 Thread Pekka Niiranen
Hello users, I want to loop thru values and return the total number of failures instead of breaking out of loop as soon as the first failure is encountered. The code below works as intended: define (validate-order value-list low-list) ;; Checks whether all the values are all above list of low