Re: [racket] Looking for better designs to learn principles.

2015-03-14 Thread Sean Kanaley
If "thread-through macro" refers to " http://www.greghendershott.com/2013/05/the-threading-macro.html"; then I recommend a functional alternative called "compose": (define print/cdr (match-lambda [(cons x xs) (print x) xs])) (define print-two (compose print/cdr print/cdr)) The result is

Re: [racket] Looking for better designs to learn principles.

2015-03-15 Thread Sean Kanaley
ng.org/doc/point-free/index.html?q=thrush#(def._((lib._point-free/main..rkt)._thrush))> > > On Mar 14, 2015, at 15:35, Sean Kanaley wrote: > > If "thread-through macro" refers to " > http://www.greghendershott.com/2013/05/the-threading-macro.html"; then I &g

Re: [racket-users] carmack s-expression tweet

2015-03-27 Thread Sean Kanaley
Couldn't this binary s-expression just be a struct? '(move 3 5) becomes (struct move (x y) #:prefab) (move 3 5) client/server will likely have some kind of matching either way, and prefab structs can be matched (match command [(list 'move x y) ... becomes (match command [(move x y) ...

Re: [racket-users] http-sendrecv with Google geocode

2015-04-20 Thread Sean Kanaley
Just comment out #:data and append it to the url: (http-sendrecv "maps.googleapis.com" (string-append "http://maps.googleapis.com/maps/api/geocode/json?"; form-data) ;#:ssl? ss

Re: [racket-users] http-sendrecv with Google geocode

2015-04-21 Thread Sean Kanaley
(I commented out the fprintfs to avoid dealing with ferr.) It won't work if #:data is uncommented. I hope that helps, otherwise I'm stuck too. On Tue, Apr 21, 2015 at 2:23 AM, George Neuner wrote: > Hi Sean, > > On 4/21/2015 1:46 AM, Sean Kanale

Re: [racket-users] eval PSA (was Sending Closures to Places)

2015-08-04 Thread Sean Kanaley
" I cannot think of any good uses for eval in Racket." Any time the mental time spent using eval (or defmacro) is less than that of figuring out how to not use eval or defmacro by using let-parameterize-syntax-splicing-local-transformer-binding-apply-values instead, which for the average programme

[racket-users] Finding an old patch

2015-10-06 Thread Sean Kanaley
Hi all, Now that the repository has moved from git.racket-lang..., I can no longer find a particular patch. I also have no idea what it did, only that it was necessary. Is there a way to find it based on the old url? Failing that, I would try installing the base version along side and diffing the

Re: [racket-users] Finding an old patch

2015-10-06 Thread Sean Kanaley
RL includes the commit hash, finding its new location should be > easy. > > Vincent > > > > On Tue, 06 Oct 2015 15:26:22 -0500, > Sean Kanaley wrote: > > > > Hi all, > > > > Now that the repository has moved from git.racket-lang..., I can no > >

Re: [racket-users] racket users fight for their right to colon keywords

2015-10-16 Thread Sean Kanaley
While were at it, can we make :long-keyword [3] => :long-keyword [long-keyword 3] ? And can we make define => =, and = => == ? In general, can we "Huffman encode" forms by average form usage frequency? (But seriously, the first one would be nice) On Fri, Oct 16, 2015 at 6:05 PM, Gustavo Mas

Re: [racket-users] Can a macro have an affect above/outside its scope?

2016-03-21 Thread Sean Kanaley
What if you define define as define/provide and define definep as define? That doesn't answer the question about black magic though. On Mon, Mar 21, 2016 at 10:51 AM, Brian Adkins wrote: > I've been porting my friend's Elixir code to Racket with great success. > When I asked what the equivalent

Re: [racket-users] Unit test inner procedures

2017-12-06 Thread Sean Kanaley
Regarding submod testing, would it make sense to have a submod* form that recursively imports? I've recently become a fan of this approach to testing inner procedures but it seems to require both (submod "." ) (submod "." test), or maybe a version that specifically imports all tests recursively.

Re: [racket-users] On Richard P. Gabriel’s “The Structure of a Programming Language Revolution”

2018-04-30 Thread Sean Kanaley
> and using version control as the primary source of truth. Reproducibility is important. > we got ourselves confused on occasion and the more it happened, the more it became clear to me that we needed to shift to a more static view I want to voice what I think is agreement that reliability of th

[racket-users] parameterized logging

2018-08-06 Thread Sean Kanaley
Hi all, Is there a way to automatically send say a prefix string with many already coded logger invocations? For example, to go from: (thread ... (log-debug "information specific to particular thread, without mention of which thread")) ---

Re: [racket-users] parameterized logging

2018-08-07 Thread Sean Kanaley
Thanks, Neil. Unfortunately #2 didn't work. The historically written define-logger calls like log-something-debug overwrites the "foo" topic with "something". If only they were appended together. #3 can't intercept logs of define-logger loggers (if a woodchuck could...) even with topic/level hardco

[racket] Something to achieve "define-syntax-parameter-for-syntax" or "set!-for-syntax"?

2014-01-05 Thread Sean Kanaley
Hello, First the short question: is there a way that user code can set some sort of in-effect global variable to determine how a library macro will expand? The problem I have is there doesn't seem to be a way to combine the concepts of parameters/globals and transformer environments. Long part in

Re: [racket] Something to achieve "define-syntax-parameter-for-syntax" or "set!-for-syntax"?

2014-01-05 Thread Sean Kanaley
Ha! The below solution is a macro-making macro that re-syntaxifies "params ..." to "belong to" the inner macro: (define-syntax-rule (make-commands name params ...) (define-syntax (name inner-stx) (syntax-case inner-stx () [(_ (c f) (... ...)) (with-syntax ([(ps (... ...)) (datu

Re: [racket] Something to achieve "define-syntax-parameter-for-syntax" or "set!-for-syntax"?

2014-01-05 Thread Sean Kanaley
think of a serious > drawback off the top of my head. (I am sure Ryan and Matthew can think of > one.) Does it pass your test cases? > > > On Jan 5, 2014, at 1:21 PM, Sean Kanaley wrote: > > > Ha! The below solution is a macro-making macro that re-syntaxifies > "

[racket] Possible bug with "const"?

2014-01-10 Thread Sean Kanaley
> (define x (build-vector 4 (const (vector 1 > (vector-set! (vector-ref x 2) 0 5) > x '#(#(5) #(5) #(5) #(5)) vs. -- > (define x (build-vector 4 (λ (x) (vector 1 > (vector-set! (vector-ref x 2) 0 5) > x '#(#(1) #(1) #(5) #(1))

Re: [racket] Style. for/fold for/list for/lists

2014-01-22 Thread Sean Kanaley
ou feared, but since it's entirely local to the collector implementation I don't think it counts as breaking purity. On Wed, Jan 22, 2014 at 6:49 PM, Sean Kanaley wrote: > This doesn't have the full fanciness of the for--- series, but perhaps > this is a useful starting po

[racket] Nested macros to refer to user's lexical context?

2014-01-24 Thread Sean Kanaley
A macro like (define-syntax (mac stx) (... generate user scope function by passing stx to format-id ...)) doesn't work (function is unbound in phase 0) if I use optional parameters and telescoping cases: (syntax-case ... [(_ param ...) #'(mac some-default-thing param ...)] [(_ optional-thi

Re: [racket] FYI: A new Racket-powered startup

2014-02-05 Thread Sean Kanaley
On-topic, congratulations on using a superior language in the real world. On-latest-topic, maybe indoctrination is the answer: I pledge allegiance...to functional programming And the open source coders of America And to the recursion...for which it stands One function, under lambda, immutable Wit

[racket] Rosetta Task: RCRPG

2014-02-07 Thread Sean Kanaley
https://github.com/Seanner/RCRPG/blob/master/mud.rkt It's pretty minimal (polished only to not crash on bad user input) so if anybody wants to mess with it before I upload it, please feel free. There are a few things that are seemingly illogical like using one-shot macros that take up more code t

Re: [racket] Using big-bang with picts

2014-02-17 Thread Sean Kanaley
(define (world->image w) (overlay (pict->bitmap (circle w)) (empty-scene 100 100))) On Mon, Feb 17, 2014 at 1:40 PM, Jens Axel Søgaard wrote: > Hi All, > > Is there a way to use big-bang with picts? > In other words, how can I convert a pict into something that big-bang > will displ

Re: [racket] first vs car ; last vs cdr ; empty? vs null?

2014-03-07 Thread Sean Kanaley
Pardon me, but going back a bit where the blog about switching to immutable lists was mentioned...I saw an interesting comment about immutability and eq?. Have any mathematicians come up with an answer for the meaning of eq? on permanently distinct but equivalent and immutable objects, e.g. (eq? (

Re: [racket] Knuth's algorithm S

2014-03-10 Thread Sean Kanaley
The current Racket algorithm has an error: (define counts (build-vector 10 identity)) This sets the counts to their indices, meaning e.g. 9 was pre-counted 9 times. Switch the first line of the executable portion to run only say 3 trials to see the effects. It should be: (define counts (make-v

Re: [racket] What do first-class structures achieve?

2014-03-13 Thread Sean Kanaley
Printing and transparency are in fact separate: (struct test (x) #:methods gen:custom-write [(define (write-proc t p m) (write (format "" (test-x t)) p))]) The above untangles the concepts: > (test 5) "" > (struct? (test 5)) #f But I suppose it could be useful to have a comparable defa

Re: [racket] big-bang is slow to render on screen?

2014-04-21 Thread Sean Kanaley
Here's my log after pasting the source into command-line racket 6.0, Ubuntu 12.04 32-bit: to-draw at 1649 to-draw: cpu time: 0 real time: 2 gc time: 0 on-key a at 2934 to-draw at 2934 to-draw: cpu time: 0 real time: 2 gc time: 0 on-key s at 2970 to-draw at 2970 to-draw: cpu time: 4 real time: 3 gc

Re: [racket] set!: eval-ing to lvalues

2014-04-22 Thread Sean Kanaley
;s not immediately obvious that it's a win/win scenario. Predicting the > impact of features like this is difficult, because they're interacting with > so much else in the language. > > Carl Eastlund > > On Sun, Jun 9, 2013 at 12:28 PM, Sean Kanaley wrote: > >>

Re: [racket] set!: eval-ing to lvalues

2014-04-23 Thread Sean Kanaley
Unfortunately I forgot which site it was and I deleted my browsing history as I always do after looking at functional porngramming. On Wed, Apr 23, 2014 at 9:26 AM, Matthias Felleisen wrote: > > On Apr 22, 2014, at 10:10 PM, Sean Kanaley wrote: > > > a hylomorphism is just an

Re: [racket] set!: eval-ing to lvalues

2014-04-23 Thread Sean Kanaley
It appears I have subconsciously plagiarized something I must've read a long time ago? Well I'm citing that blog then. On Wed, Apr 23, 2014 at 5:04 PM, Prabhakar Ragde wrote: > Stephen Chang wrote: > > Reminds me of this: >> http://james-iry.blogspot.com/2009/05/brief-incomplete-and- >> mostly

[racket] compile time (file read -> define function)

2014-04-24 Thread Sean Kanaley
I have: 1. a macro to define functions (define-syntax the-macro ... #'(define (name) ...)) 2. a file filled with "user" definitions in expression form (this is a definition that shall be passed to the macro) (so is this) ... 3. I would like to do something to the effect of (define-namespa

Re: [racket] compile time (file read -> define function)

2014-04-24 Thread Sean Kanaley
Please disregard, this makes no sense. How would the code refer to functions that may or may not exist? I forgot the macro was just converting a call like (get-function 'name) directly into allowing (name), so ultimately some sort of lookup is needed. On Thu, Apr 24, 2014 at 8:17 PM,

Re: [racket] Optional parameters in Typed Racket?

2014-04-26 Thread Sean Kanaley
According to Sam according to google http://lists.racket-lang.org/users/archive/2011-November/049010.html (: append-bar (case-> (String Positive-Integer -> String) (String -> String))) (define (append-bar str [how-many 1]) (apply string-append str (make-list how-many "bar"

Re: [racket] Macros baffle me

2014-05-02 Thread Sean Kanaley
Here's a solution (at the bottom) with the datum/syntax converters. flatten is built-in, free-vars is basically filtering stuff and then removing duplicates, with-vars can take advantage of the built-in nested for, and then tauta. tauta can get the "quoted" form of the expression like when you use

Re: [racket] Macros baffle me

2014-05-02 Thread Sean Kanaley
#,(collect-fvars stx #'exp) exp)])) > > (tauta (or (then P Q) (then Q (not P > (tauta (or P (not P))) ; excluded middle > (tauta (or (and P Q) (or (not P) (not Q)))) > (tauta (equiv (then P Q) (then (not Q) (not P ;equiv > (tauta (then (and (then (not A) B) (then (no

Re: [racket] "lab notebook on learning process" (was: Re: Macros baffle me)

2014-05-05 Thread Sean Kanaley
“don't forget: call-by-value! call-by-value!” somewhere early on. Don't feel bad, fellow i-wish-racket-was-as-awesome-as-haskell-ian, I submitted an incorrect bug report claiming something like (function-call (const (random))) wasn't passing different random values, where it was kindly pointed out

Re: [racket] "lab notebook on learning process"

2014-05-05 Thread Sean Kanaley
I think we just misunderstood each other then. I was interpreting what you said in conjunction with what some others said in response, which painted it in a different light. And my responses in turn weren't meant to be overly serious sounding, but mostly just silly stories of my flailing around i

Re: [racket] "lab notebook on learning process" (was: Re: Macros baffle me)

2014-05-05 Thread Sean Kanaley
ndrik Boom wrote: > On Mon, May 05, 2014 at 11:58:17AM -0400, Sean Kanaley wrote: > > > So technically it was my fault, > > but the documentation could benefit from some kind of "WARNING!" section > on > > each or at least especially dangerous pages for such pi

[racket] "error: degrees->complex: 360.0"

2014-05-12 Thread Sean Kanaley
Hello all, I can't figure this out as I have no function called degrees->complex and it occurs only sometimes. It's always when rotating stuff through the positive x axis, as in it's probably related to floating point operations like sin or cos near 0 or perhaps integer multiples of 2pi. So far

Re: [racket] "error: degrees->complex: 360.0"

2014-05-12 Thread Sean Kanaley
The entire program is too big but some tests: pass ... (rotate -0.0 SHIP) pass ... (rotate -0.0001 SHIP) fail... (rotate -0.0001 SHIP) Racket Users list: http://lists.racket-lang.org/users

Re: [racket] "error: degrees->complex: 360.0"

2014-05-12 Thread Sean Kanaley
Interesting, my code has the same bug then. I called it modulo/real, used for things like displaying the space ship's rotation to the user or wrapping x coordinates to stay in the world. Apparently it's going to fail at some point with vector ref out of range. What was your fix? I was thinking

[racket] universe and big-bang initial state

2014-05-13 Thread Sean Kanaley
I am making a server controlled game, where the clients are just input/outputs to/from the server. Therefore the clients have no valid independent initial state. Is there some way to hold off until the server handles the incoming connection by sending the initial state to it? Otherwise it's pret

Re: [racket] "error: degrees->complex: 360.0"

2014-05-17 Thread Sean Kanaley
On Mon, May 12, 2014 at 11:24 PM, Neil Toronto >>>> wrote: >>>> >>>>> >>>>> He went with exact rationals. Here's another option, which preserves >>>>> inexactness: >>>>> >>>>> (define (angl

Re: [racket] Use of map and eval to evaluate symbol in namespace

2014-08-09 Thread Sean Kanaley
There's a simple enough example I think: apply with keyword parameters. Apply has that built-in..sort of...but the list is supposed to be provided inline to APPLY, seemingly requiring apply to be applied (e.g. (apply apply (cons *thefunctiontoapply* params))), except keywords can't be expressions a

Re: [racket] Use of map and eval to evaluate symbol in namespace

2014-08-09 Thread Sean Kanaley
Sorry, couple typos: mapply = map and l = lst. On Sat, Aug 9, 2014 at 10:10 AM, Sean Kanaley wrote: > There's a simple enough example I think: apply with keyword parameters. > Apply has that built-in..sort of...but the list is supposed to be provided > inline to APPLY, seemi

Re: [racket] Use of map and eval to evaluate symbol in namespace

2014-08-10 Thread Sean Kanaley
***The ultimate (programming) concern is what will produce the highest average correct-and-useful-running-program-output per second over my lifespan.*** (philosophical extensions: provided it doesn't hurt other people, unless they are "bad", where bad = ...etc...) Or anyone else who programs. The

Re: [racket] performance of iteration through a vector

2014-08-30 Thread Sean Kanaley
The generic (for ([var seq]) is slow regardless of vector/list/etc. But there is often a specific "in-" form. On my machine (for ((j (in-range 100))) (for ((v (in-vector vec))) (set! sum (+ sum v is very slightly faster than the explicit vector ref version, 7.3... vs. 7.6... (32

[racket] Submodules can't be imported in same file?

2014-09-05 Thread Sean Kanaley
Hello, For ease of exporting wrapper functions I am trying to do something like #lang racket (module wrap racket or module+ wrap (provide (all-defined-out)) ) (require 'wrap) (provide (all-from-out 'wrap)) With (module wrap racket ...), (require 'wrap) works but the stuff to be wrapped i

Re: [racket] Submodules can't be imported in same file?

2014-09-05 Thread Sean Kanaley
(reply to all) Right but that doesn't work from within the file, only at REPL or another file. #lang racket (module+ invisible (provide x) (define x 3)) (require (submod "." invisible)) doesn't work Racket Users list: http://lists.racket-lang.org/users

Re: [racket] Submodules can't be imported in same file?

2014-09-05 Thread Sean Kanaley
Oh of course, I had inverted the hierarchy of modules. Your way is much more logical, thanks. I got too sidetracked into what exactly module+ does... On Fri, Sep 5, 2014 at 6:29 PM, Greg Hendershott wrote: > The following approach works for me. Would that do what you need? > > ;; - mod.rkt

[racket] DrRacket 6.1 or Hardware Issue?

2014-09-08 Thread Sean Kanaley
After investigating a near complete lock up some more (saved by TTY window and killing DrRacket after seeing it with 3GB+ residency), it's clearly correlated with background expansion of an accidentally infinitely looping macro. A few questions.. 1. Is the OS supposed to break and enter an infinit

Re: [racket] A beginner's question re drawing on a canvas

2014-10-01 Thread Sean Kanaley
Hi, Just make the drawing code part of on-paint. I have inlined a subclass for you: #lang racket/gui (define frame (new frame% [label "Example"] [width 300] [height 300])) (define top-canvas (new (class canvas% (super-new [parent frame])

Re: [racket] A beginner's question re drawing on a canvas

2014-10-01 Thread Sean Kanaley
At the risk of sending duplicate information, and you should prefer Matthias' responses as he is far more experienced, but one idea is to place all drawing code under the canvas class definition. Then the button callback should invoke that class' new drawing method. This keeps the actual drawing co

Re: [racket] macro question

2014-10-02 Thread Sean Kanaley
(let ([x y]) x) => y That "let" is just a wrapper that equals y. So your macro is really (define-syntax (mylet stx) (syntax-case stx () [(_ x) #'x] [(_ x xs ...) #'(cons x (mylet xs ...))])]) Which causes (mylet 1 2 3) => '(1 2 . 3) ;don't forget the dot! And that's just the macro v

[racket] Code that double checks is good, bad, other?

2014-10-03 Thread Sean Kanaley
Hello all, Sometimes I run into situations where a callee has certain input constraints that the caller must satisfy. Particularly when the caller is just below the user interface level, this can lead to redundant checks. For example, if the the callee takes an integer, and the user input function

Re: [racket] Code that double checks is good, bad, other?

2014-10-03 Thread Sean Kanaley
"the problem is when you re-work the code, do you know for sure that you moved the contract/assertion/validation/checking appropriately." That's the real crux that I forgot to say. I was inspired to post when I was slightly repurposing a mid-level function and realized it no longer had to do as mu

Re: [racket] Code that double checks is good, bad, other?

2014-10-03 Thread Sean Kanaley
The open-endedness of this led me to write a bit, then read a few things, then produce unnecessarily long responses, and so on, so I deleted everything to spare people. I'll go with saying thanks for the input. But here's an interesting related link: http://blog.codinghorror.com/gold-plating/ Re

Re: [racket] Code that double checks is good, bad, other?

2014-10-04 Thread Sean Kanaley
What do you mean by "weaken" in #3? I presume you mean use a more general type. Is this to allow for flexibility in future iterations? Promising any/c instead of void? ? On Sat, Oct 4, 2014 at 3:04 PM, Matthias Felleisen wrote: > > Here is an answer that's not a book but it should be one. > > 1.

Re: [racket] confused beginner

2014-10-04 Thread Sean Kanaley
You can add this repository to get a more recent version *ppa:plt/racket* *https://launchpad.net/~plt/+archive/ubuntu/racket * On Sat, Oct 4, 2014 at 4:16 PM, Andrew Ulrich wrote: > That was the problem, thanks Robby! I guess ubuntu's apt rep

[racket] LINQ

2014-12-13 Thread Sean Kanaley
Hello all, Does anybody know of a workable LINQ for Racket? I'm basically looking to run selects and joins on CSV files. If not, any roadblocks people have encountered toying with such a thing? Sean Racket Users list: http://lists.racket-lang.org/users

Re: [racket] LINQ

2014-12-14 Thread Sean Kanaley
be it will happen. There's a Haskell implementation I haven't looked at yet that I might be able to translate with lazy Racket. On Sat, Dec 13, 2014 at 11:58 PM, John Clements wrote: > > > On Dec 13, 2014, at 4:45 PM, Sean Kanaley wrote: > > > Hello all, > > >

Re: [racket] universe program using 100% cpu on Mac (also poor Raspberry Pi performance)

2014-12-30 Thread Sean Kanaley
Hi Darren, I think there are three common kinds of unit tests -- 1. Interaction window while developing the function, to ensure it seems to do what you think it does. It's probably simple yet covers the majority of cases. These might be copy and pasted into unit tests as a simple sanity check for

Re: [racket] Void expression found

2015-01-05 Thread Sean Kanaley
I see "void" as a tangible value specifying no information, whereas "undefined" is literally no information. So void is more like an empty universe and undefined is no universe at all. On Mon, Jan 5, 2015 at 5:40 PM, Vincent St-Amour wrote: > At Mon, 5 Jan 2015 23:20:54 +0100, > Jos Koot wrote:

Re: [racket] Little Schemer, lat?

2015-01-08 Thread Sean Kanaley
As I see it, '() may not specifically be a lat, but it's not *not* a lat. not not == is Perhaps with a 3rd logical value we could declare it a "maybe" lat. That's the same answer I would put in the truth table for implication T T -> T T F -> F F T -> Maybe F F -> Maybe I know there are alternati

[racket] Racket DB Library, data conversion

2015-02-14 Thread Sean Kanaley
Hello All, I would like to query based on an incoming hash (with help of json library), but I don't see a built-in way to generate query needed. There is a rows->dict but I don't see either a dict->where-clause or at least whatever query uses in that dollar sign magic to convert Racket-val->SQL-st

Re: [racket] Racket DB Library, data conversion

2015-02-14 Thread Sean Kanaley
Nevermind, that seems to be what prepared statements do. On Sat, Feb 14, 2015 at 9:34 AM, Sean Kanaley wrote: > Hello All, > > I would like to query based on an incoming hash (with help of json > library), but I don't see a built-in way to generate query needed. There is >

[racket] Onlisp's condlet macro in Racket

2013-01-02 Thread Sean Kanaley
While I've ultimately succeeded in having it return the correct output for a sample input, I'm not positive it's correct in general and I *am *positive it's written poorly, as I don't fully understand both syntax-case and syntax objects vs. datums. If someone could look it over and provide a more

Re: [racket] Onlisp's condlet macro in Racket

2013-01-02 Thread Sean Kanaley
Thanks all for the help. Stephan: Good point about let*--I should've thought of it. Depending on how sufficiently-smart (tm) Racket is, is it not very slightly slower to create more bindings at run time (I suppose it could analyze bindings not used or immediately shadowed and drop them)? I'm no

[racket] Calling Private Methods on non-this Objects?

2013-05-30 Thread Sean Kanaley
In C++ for example, the following is valid: class A { private: int test(A a) { return n + a.n; } int n; }; The key point is the "a.n" is valid. I'm trying to create a 3d game in Racket, and in order to avoid recomputing world transforms all the time, child objects (say a rotatable gun on

[racket] Rosetta Code Minesweeper Implementation

2013-06-03 Thread Sean Kanaley
Hello all, Rosetta Code does not have a minesweeper implementation in Racket. I have created the one shown below. Before I post it to Rosetta, I was looking for possible feedback to shorten, make clearer, make "safer" in some way, make more use of library functions, etc. I would hate to give Ra

Re: [racket] Rosetta Code Minesweeper Implementation

2013-06-03 Thread Sean Kanaley
Thank you both for the replies. I have incorporated all of your suggestions. The thin board wrapper over vector2 proved useful to quickly switch everything over to arrays. The program should no longer crash due to user input aside from any kind of internal buffer issues that may or may not be po

Re: [racket] Rosetta Code Minesweeper Implementation

2013-06-03 Thread Sean Kanaley
Just kidding there are more parse bugs, but I'm doing my best to fix them. The consolation is that the other implementations are either far longer, incorrect, or both. Still... I shall post it shortly and hope for the best. On Mon, Jun 3, 2013 at 4:26 PM, Sean Kanaley wrote: > Thank

Re: [racket] Rosetta code submission / string operations

2013-06-04 Thread Sean Kanaley
Hello fellow Rosetta submitter! The regular expressions are actually pretty useful to make a functional version shorter than the imperative one! First, forms with (for ...) and a bunch of (set!)'s is made functional by (for/fold ...) where the final (values ...) functionally sets the new values.

[racket] set!: eval-ing to lvalues

2013-06-06 Thread Sean Kanaley
Hello all, I was curious why Scheme and now Racket does not inherently support a generic set!. I found an SRFI http://srfi.schemers.org/srfi-17/srfi-17.htmlthat suggests a generic method solution requiring a lookup for the "real" setter (and so needing a special setter for every data type. What

Re: [racket] issue with function "regexp-replaces"

2013-06-07 Thread Sean Kanaley
(regexp-replace* "\n" input-string "\n") would be the target expansion for those pairs. On 06/07/2013 08:57 AM, Sanjeev K Sharma wrote: I have to clean up a bunch of source files that don't show properly I have a file from which I'm reading a bunch of regular expressions to replace, things li

Re: [racket] Size matters

2013-06-08 Thread Sean Kanaley
I was coincidentally just thinking about this. I'm experimenting with terse names myself right now. I believe the general rule for consistent pain/gain is that the favoring of the short name is proportional to both how frequently it's used and how obvious it is. For-loops in C had better def

Re: [racket] Size matters

2013-06-08 Thread Sean Kanaley
Sorry about the multiple posts, but an idea just occurred to me to save on name length in the case of name conflicts, like in the posted fill-sack example. Example code: (let ([n #1]) (let ([n-that-needs-new-name #2]) (+ n n-that...) The inner most n will overwrite the outer one if the

Re: [racket] Size matters

2013-06-09 Thread Sean Kanaley
ualifying. Although your code would be perfect for the nested let, "let*". On 06/09/2013 03:03 AM, ??? ? wrote: Then why not (let ([x:n #1]) (let ([n #2]) (+ x:n n) I think, it is less confusing ???, 8 2013, 17:07 -04:00 ?? Sean Kanaley : Sorry about the

Re: [racket] set!: eval-ing to lvalues

2013-06-09 Thread Sean Kanaley
'm not a compiler implementer myself, so I'm sure others can probably give more specific details. In the meantime, I hope this explanation is helpful. Carl Eastlund On Thu, Jun 6, 2013 at 4:12 PM, Sean Kanaley <mailto:skana...@gmail.com>> wrote: Hello all, I wa

[racket] Rosetta Sokoban Solution

2013-06-10 Thread Sean Kanaley
The rather empty page on Sokoban now has a Racket solution. The creator is proud to announce it's the fastest solution (though a couple didn't give run times) at ~0.1 seconds. My thanks to Ryan Culpepper for making the binary heap that made this possible. http://rosettacode.org/wiki/Sokoban#

Re: [racket] Rosetta Sokoban Solution

2013-06-10 Thread Sean Kanaley
ost. But if I had to choose which language seems to actually produce better code, I would have to side with PicoLisp. Just beware dynamic scope. On 06/10/2013 12:42 PM, Matthias Felleisen wrote: Thank you for this effort. This is not a criticism of your code but I will say that Racket code looks

Re: [racket] Rosetta Sokoban Solution

2013-06-10 Thread Sean Kanaley
! = vec! set-box! = box! (in general, the "!" indicates a setter, so do away with the "set-") print = pr display = disp string-X = str-X append-map = map* / mappend / mapp null? = nil? lambda = delete entirely, because pressing ctrl+\ and getting an actual lambda is vastly su

Re: [racket] Adding new Rosetta tasks

2013-06-10 Thread Sean Kanaley
What would be the best task to show off Racket's advantages intrinsic to the language and less to library support? It would have to somehow abuse hygienic macros I suppose--some kind of task like embedding a DSL, so what would be a good one? Maybe something with graphics to show off functiona

Re: [racket] racket library for minecraft pi edition

2013-06-10 Thread Sean Kanaley
I found a short write-up on the API. It shows setBlocks(x1, y1, z1, x2, y2, z2, blockType, blockData) - set lots of blocks all at the same time by providing 2 sets of co-ordinates (x, y, z) and fill the gap between with a blockType If a similar function is available for get blocks, that woul

Re: [racket] Rosetta Sokoban Solution

2013-06-11 Thread Sean Kanaley
alues (list i j) x (case-lambda [(p) (hash-ref h p)] [(p x) (hash-set! h p x) x] [else (error "level: too many arguments")])) I didn't even know structures could be procedure-ified. On 06/11/2013 05:06 AM, Jens Axel Søgaard wrote: Hi Sean 2013/6/10 Sean Kanaley

Re: [racket] Style or and/define

2013-06-11 Thread Sean Kanaley
This code appears to be equivalent to using Maybe in Haskell, with the same kind of indentation issues: case char-width of Nothing -> Nothing Just n -> do stuff, get new Maybe, case new-maybe of Nothing -> Nothing Just x -> do stuff ... etc... In Haskell, one composes these with b

Re: [racket] Adding new Rosetta tasks

2013-06-12 Thread Sean Kanaley
Welll that one might be cheating :) On 06/12/2013 05:25 AM, Tim Brown wrote: Task: Load and Use a Package from PLaneT :-) On 10/06/13 23:08, Sean Kanaley wrote: What would be the best task to show off Racket's advantages intrinsic to the language and less to library support? It

[racket] SGL Bindings

2013-06-17 Thread Sean Kanaley
Hello all, I'm attempting to do some 3d targeting by screen position, and it would be convenient to use unproject, however I can't figure out the parameters. The OpenGL specs require various matrices to be passed in, and Racket wants them of type gl-double-vector, which seems to be a type sy

Re: [racket] SGL Bindings

2013-06-18 Thread Sean Kanaley
Thank you Jay and Stephan for the information. So the OpenGL package is not the same thing as what you get with (require sgl/gl), which in turn is the unwrapped (require sgl)? And the OpenGL package is the "good" one? I don't mind the matrix stuff, I just want to avoid strange type errors...

Re: [racket] Code Reuse, Object Oriented vs Functional

2013-06-20 Thread Sean Kanaley
The definition and essence of "object" is not always agreed upon (encapsulation, polymorphism, state, ...), but since you're wondering about objects versus functions (purely functional), the "versus" implies a difference about an object that makes it impure, or the comparison isn't so helpful.

Re: [racket] DSLs and complexity

2013-06-21 Thread Sean Kanaley
A famous Lisp programmer once said (in the context of functional programming): "For alumni of other languages, beginning to use Lisp may be like stepping onto a skating rink for the first time. It's actually much easier to get around on ice than it is on dry land---if you use skates. Till then

[racket] Modules and File Save Bug?

2013-06-22 Thread Sean Kanaley
I don't use modules very much, so this could be the defined behavior similar to how the ffi module "secretly" (it's actually documented) doesn't reload foreign libraries unless DrRacket is restarted, but I didn't notice anything in the documentation. How to reproduce: (module+ test (write "

Re: [racket] Modules and File Save Bug?

2013-06-22 Thread Sean Kanaley
Robby On Sat, Jun 22, 2013 at 2:02 PM, Sean Kanaley <mailto:skana...@gmail.com>> wrote: I don't use modules very much, so this could be the defined behavior similar to how the ffi module "secretly" (it's actually documented) doesn't reload foreign

Re: [racket] Modules and File Save Bug?

2013-06-22 Thread Sean Kanaley
06/22/2013 03:30 PM, Robby Findler wrote: Oh, maybe memory got corrupted somehow earlier along the line. Just in case it is relevant: DrRacket tries hard to protect itself against buggy user programs, but it cannot do that when #%foreign is being used (unsafely). Robby On Sat, Ju

Re: [racket] Modules and File Save Bug?

2013-06-22 Thread Sean Kanaley
explain what you are seeing, perhaps? Robby On Sat, Jun 22, 2013 at 2:38 PM, Sean Kanaley <mailto:skana...@gmail.com>> wrote: I've got it this time: The test file with the module+ must be required by another, not even necessarily saved file (untitled # is fine). It

Re: [racket] Definition of DSL?

2013-06-24 Thread Sean Kanaley
As said in SICP, "eval" is the ultimate language interpreter, capable of implementing anything computable. You could feed it code (a language) to interpret C code (the DSL to interpret C, so this code in turn takes a parameter of the C to interpret just as eval takes a parameter of the Scheme

[racket] Realm of Racket as Starting Book?

2013-06-25 Thread Sean Kanaley
To the authors: I have recommended Realm of Racket to a friend who expressed an interest in programming in conjunction with HtDP. Now, I'm sure the creators would "strongly encourage" future software engineers to be comfortable with the material in HtDP, but exactly how difficult is the "inte

[racket] REPL @ Runtime Contract Modification?

2013-06-26 Thread Sean Kanaley
Hello, I'm debugging a heavily stateful GUI app that has reached a very specific state but has come across a contract error. Is there some way to modify the contract and proceed or I must I reevaluate and run the gui and attempt to duplicate the state? Racket Users list

Re: [racket] REPL @ Runtime Contract Modification?

2013-06-27 Thread Sean Kanaley
bug Before you restart try to figure out which one is which and fix something. On Jun 27, 2013, at 12:35 AM, Sean Kanaley wrote: Hello, I'm debugging a heavily stateful GUI app that has reached a very specific state but has come across a contract error. Is there some way to m

Re: [racket] REPL @ Runtime Contract Modification?

2013-06-27 Thread Sean Kanaley
ct (define/contract fprime ...) -- (set! f fprime) On Jun 27, 2013, at 10:53 AM, Sean Kanaley wrote: All of Racket seems to be available while debugging GUIs. I can query state and launch new error-free dialogs while the GUI sits there with its broken dialog. I was thinking th

  1   2   >