Floyd Arguello | 3 Mar 04:10 2015
Picon

updated trycode.io

trycode.io has been updated with the Guess My Number game from Realm of Racket. Please take a look and tell me your thoughts.

Cheers,
Floyd

____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Matthew Butterick | 2 Mar 19:45 2015

pre Realm of Racket

I enjoyed reading Realm of Racket (& not embarrassed to say I even learned a few things, like #; for commenting an S-expression). Nice job, all those involved. 

I was interested in the note on p.9 that Racket was originally a project that "had middle school students in mind." 

Suppose I know some middle-school students who are good at math but have no exposure to programming. What book / resource would give them an appropriate foundation to read Realm of Racket?
____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Neil Van Dyke | 2 Mar 02:39 2015
Picon

Re: xslt

Matthew Butterick wrote on 03/01/2015 08:07 PM:
> As a still newish user of Racket, I have learned to try it Their Way 
> before insisting on having it My Way (or looking for other options 
> farther up the Highway).

Yes, a newbie should usually try doing things the Racket Way first.

This guidance is especially helpful when the Racket Way is 
counterintuitive to the newbie (simple examples: snuggling parens, using 
mutations a lot less).

Two caveats:

* A newbie can't always tell what's the Racket Way, nor whether there 
even is an applicable Racket Way.

* Racket is not a cult.  And there is no ladder in the middle of the 
room, beneath some bananas.

Neil V.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Rufus | 2 Mar 02:37 2015
Picon

How can I dump (display) the variables defined in current the global environment

I'm working through the "Little Schemer" and there are literally dozens
of variables defined in the exercises. To run code some significant
subset of these variables needs to be defined - and particular names get
reused frequently with different values.

While this is not a show stopper at the moment and I can and probably
will find a system to organize the definitions, it would be _really_
nice to be able to call a function that would display existing (already
defined) variables in the global environment with their values. And also
a function to save this state (variables in the global environment) in a
fashion that could be quickly/easily (ie one short function call) be
reloaded the next day to continue from where I left off. I have found
one full blown extension on the site that will dump the "environment"
parameters from the opsys but this is not what I'm talking about. I want
the defined variables from the global environment of the current
DrRacket session. And now I think about it, probably _all_ the
definitions for the current session sorted by type.

So. Anybody heard about something like that? I've spent some time
looking for native functions or any extensions that might serve in whole
or in part but so far, nil.

Thanks

Rufus
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Jordan Johnson | 2 Mar 01:07 2015

min and max representable dates

Hi all,

Am I right in thinking the min and max dates that racket/date can handle are platform-dependent? If so, is
there any constant I can reasonably use as a least or greatest representable date?

I’ve looked in racket/date.rkt and see that there’s some code that appears to be doing binsearch on
greatest/least values that seconds->date will accept without error, and eventually I gave up chasing
seconds->date down the rabbit hole of racket/base. I really don’t want to get into putting the same
binsearch code into my library, but need plausible-yet-safe min/max values.

Context: I’m working on RFC6265 cookie support, and there are some places where the RFC calls for these
min/max values explicitly. I expect a pretty conservative estimate is A-OK if it’d be sure of not
throwing an error on 32+-bit systems; I see 2^32 seconds would get us at least to the year 2106...

Best,
jmj
____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Sanjeev K Sharma | 1 Mar 21:42 2015
Picon

sxpath, txpath and accessors


I tried to send this  twice now- this is the 3rd attempt, I hope no one gets this 3 times / gets pissed.

on this page
~/.racket/6.1.1/pkgs/sxml/sxml/doc/sxml/sxpath.html

I read this:

"Like sxpath, but only accepts an XPath query in string form, using the standard XPath syntax.

Deprecated; use sxpath instead."

so I'd like to get the hang of sxpath but I'm somehow stuck on how to translate txpath syntax to sxpath syntax
for axes and accessors

after the example document below are some of the variations I tried

#lang racket (require sxml)(require sxml/html)
(define doc(html->xexp
"<AAA>
   <BBB>
      <CCC/>
      <www> www content <xxx/><www>
      <zzz/>
   </BBB>
   <XXX>
      <DDD>
           <EEE/>
           <FFF>
              <HHH/>
              <GGG>
                 <JJJ>content under jjj
                    <QQQ><lll/>content under qqq</qqq>
                    <rrr/>
                 </JJJ>
                 <JJJ/>
              </GGG>
              <HHH/>
           </FFF>
      </DDD>
   </XXX>
   <CCC>content in ccc
      <DDD/>
   </CCC>
</AAA>"))

((txpath"/aaa/xxx/preceding::*")doc);expect;'((zzz) ... (www "\n" "      " (zzz) "\n" "   "))))

((txpath"/aaa/xxx/preceding::zzz")doc);expect '((zzz))
((txpath"/aaa/xxx/preceding::www")doc);expect '((www "\n" " ...   " (zzz) "\n" "   ")))
((txpath"/aaa/xxx/preceding::www/following::lll")doc);expect '((lll) (lll))

;from the doc,
;lists in the s-expression syntax correspond to string concatenation in the txpath syntax.
;((sxpath'(aaa xxx ddd fff ggg jjj qqq))doc);expect '((qqq (lll) "content under qqq"))

((sxpath'(aaa xxx preceding))doc)

((sxpath'(aaa xxx preceding::www))doc)
((sxpath'(aaa xxx preceding::zzz))doc)
((sxpath'(aaa xxx preceding::bbb))doc)

((sxpath'(aaa xxx "preceding"))doc)
((sxpath'(aaa xxx "preceding::zzz"))doc);
((sxpath'(aaa xxx "preceding::www"))doc);

((sxpath'(aaa xxx "preceding::*"))doc)
;((sxpath "/aaa/xxx/preceding::*")doc); works
((sxpath'(aaa xxx preceding::*))doc)
((sxpath'(aaa (xxx (preceding::*))))doc)
((sxpath'(aaa (xxx (preceding::*))))doc)
((sxpath'(aaa (xxx (preceding::"*"))))doc)
((sxpath'(aaa (xxx "preceding::*")))doc)
((sxpath'(aaa (xxx ("preceding::*"))))doc)

((sxpath'(aaa xxx preceding::*))doc)
((sxpath'(aaa xxx preceding::*))doc)
((sxpath'(aaa xxx "preceding::*"))doc)
((sxpath'(aaa xxx ,"preceding::*"))doc)
((sxpath'(// aaa /xxx /"preceding::*"))doc)

;((sxpath'(//aaa /xxx/preceding"::*"))doc); error
;(sxml:preceding::*(sxpath'(aaa xxx))doc); error

((sxml:preceding 'eq) doc) ;#<procedure:...l/sxpath-ext.rkt:578:4>
((sxml:preceding(sxpath'(aaa xxx)))doc);#<procedure:...l/sxpath-ext.rkt:578:4>

I'd like to get the other axes and accessors working but now that I've spent some time on this I also REALLY
want to know what my blind spot is here.  Hope I didn't miss something glaringly obvious.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Sanjeev K Sharma | 1 Mar 03:11 2015
Picon

xpath, txpath and accessors


on this page 
~/.racket/6.1.1/pkgs/sxml/sxml/doc/sxml/sxpath.html

I read this:

"Like sxpath, but only accepts an XPath query in string form, using the standard XPath syntax.

Deprecated; use sxpath instead."

so I'd like to get the hang of sxpath but I'm somehow stuck on how to translate txpath syntax to sxpath syntax
for axes and accessors

after the example document below are some of the variations I tried

#lang racket (require sxml)(require sxml/html)
(define doc(html->xexp
"<AAA>
   <BBB>
      <CCC/>
      <www> www content <xxx/><www>
      <zzz/>
   </BBB>
   <XXX>
      <DDD>
           <EEE/>
           <FFF>
              <HHH/>
              <GGG>
                 <JJJ>content under jjj
                    <QQQ><lll/>content under qqq</qqq>
                    <rrr/>
                 </JJJ>
                 <JJJ/>
              </GGG>
              <HHH/>
           </FFF>
      </DDD>
   </XXX>
   <CCC>content in ccc 
      <DDD/>
   </CCC>
</AAA>"))

((txpath"/aaa/xxx/preceding::*")doc);expect;'((zzz) ... (www "\n" "      " (zzz) "\n" "   "))))

((txpath"/aaa/xxx/preceding::zzz")doc);expect '((zzz))
((txpath"/aaa/xxx/preceding::www")doc);expect '((www "\n" " ...   " (zzz) "\n" "   ")))
((txpath"/aaa/xxx/preceding::www/following::lll")doc);expect '((lll) (lll))

;from the doc, 
;lists in the s-expression syntax correspond to string concatenation in the txpath syntax.
;((sxpath'(aaa xxx ddd fff ggg jjj qqq))doc);expect '((qqq (lll) "content under qqq"))

((sxpath'(aaa xxx preceding))doc)

((sxpath'(aaa xxx preceding::www))doc)
((sxpath'(aaa xxx preceding::zzz))doc)
((sxpath'(aaa xxx preceding::bbb))doc)

((sxpath'(aaa xxx "preceding"))doc)
((sxpath'(aaa xxx "preceding::zzz"))doc); 
((sxpath'(aaa xxx "preceding::www"))doc); 

((sxpath'(aaa xxx "preceding::*"))doc)
;((sxpath "/aaa/xxx/preceding::*")doc); works 
((sxpath'(aaa xxx preceding::*))doc)
((sxpath'(aaa (xxx (preceding::*))))doc)
((sxpath'(aaa (xxx (preceding::*))))doc)
((sxpath'(aaa (xxx (preceding::"*"))))doc)
((sxpath'(aaa (xxx "preceding::*")))doc)
((sxpath'(aaa (xxx ("preceding::*"))))doc)

((sxpath'(aaa xxx preceding::*))doc)
((sxpath'(aaa xxx preceding::*))doc)
((sxpath'(aaa xxx "preceding::*"))doc)
((sxpath'(aaa xxx ,"preceding::*"))doc)
((sxpath'(// aaa /xxx /"preceding::*"))doc)

;((sxpath'(//aaa /xxx/preceding"::*"))doc); error
;(sxml:preceding::*(sxpath'(aaa xxx))doc); error

((sxml:preceding 'eq) doc) ;#<procedure:...l/sxpath-ext.rkt:578:4>
((sxml:preceding(sxpath'(aaa xxx)))doc);#<procedure:...l/sxpath-ext.rkt:578:4>

I'd like to get the other axes and accessors working but now that I've spent some time on this I also REALLY
want to know what my blind spot is here.  Hope I didn't miss something glaringly obvious.

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Jukka Tuominen | 28 Feb 23:36 2015
Picon

Initial environment


If I want to ensure that certain libraries get automatically included
(required) in the initial racket/gracket/drracket environments, where
should I add them?

I tried /racket/collects/init.rkt but that didn't seem to work. I didn't
remove the .zo file though...

br, jukka

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

DJ | 28 Feb 17:49 2015

xslt

Ok - new to racket. I would like to use it because I know Common Lisp, but need something that provides good cross-platform gui capabilities. (I can't afford a commercial implementation of CL.)

My software will harvest data from several web services that provide results in xml.

I have spent a half hour searching for info on how to run xslt transforms in racket. All that I can find is a mention that sxml used to have xslt but doesn't any more. I would prefer native racket rather than some kind of ffi solution if possible.

Any suggestions?

Best,

- DJ -


____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Sergey Pinaev | 27 Feb 11:54 2015
Picon

runiing racket 6.1.1 under valgrind

hi.
i'm trying to run racket (v6.1.1.8) under valgrind.
(valgrind --num-callers=24 --vex-iropt-register-updates=allregs-at-each-insn --tool=memcheck
--trace-children=yes /var/tmp/racket/bin/racket)

but racket segfaults when scheme_handle_stack_overflow
calls scheme_longjmpup(&scheme_overflow_jmp->cont)
because scheme_overflow_jmp is NULL at this moment.
full backtrace (as told by valgrind):

==18730== Invalid read of size 8
==18730==    at 0x4F63897: scheme_longjmpup (setjmpup.c:633)
==18730==    by 0x4CB3B06: scheme_handle_stack_overflow (eval.c:489)
==18730==    by 0x4FD0A01: scheme_thread_block (thread.c:4969)
==18730==    by 0x4FCEF8A: scheme_out_of_fuel (thread.c:4434)
==18730==    by 0x4DFBD80: reverse_prim (list.c:1357)
==18730==    by 0x4DFBB1D: scheme_reverse (list.c:1321)
==18730==    by 0x4F95F04: scheme_lookup_prefab_type (struct.c:5408)
==18730==    by 0x4FC2E70: scheme_init_thread_places (thread.c:632)
==18730==    by 0x4C94356: place_instance_init (env.c:533)
==18730==    by 0x4C938A6: scheme_engine_instance_init (env.c:305)
==18730==    by 0x4C93714: scheme_basic_env (env.c:226)
==18730==    by 0x406CCD: ??? (in /var/tmp/racket/bin/racket)
==18730==    by 0x4071D8: ??? (in /var/tmp/racket/bin/racket)
==18730==    by 0x4C4A53E: do_main_stack_setup (salloc.c:198)
==18730==    by 0x4C4A5B1: scheme_main_stack_setup (salloc.c:310)
==18730==    by 0x4070DD: ??? (in /var/tmp/racket/bin/racket)
==18730==    by 0x4070A6: main (in /var/tmp/racket/bin/racket)
==18730==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==18730== 
SIGSEGV MAPERR si_code 1 fault on addr 0x8

if i modify place_instance_init() to call scheme_create_overflow()
after scheme_init_overflow() - things getting more worse.
valgrind complaints about:

==22609== Invalid read of size 8
==22609==    at 0x501B9DB: block_cache_compact (block_cache.c:325)
==22609==    by 0x501D216: mmu_should_compact_page (vm.c:191)
==22609==    by 0x5027F94: do_heap_compact (newgc.c:4112)
==22609==    by 0x5029BBA: garbage_collect (newgc.c:4912)
==22609==    by 0x501DFDF: collect_now (newgc.c:985)
==22609==    by 0x501ED08: allocate_slowpath (newgc.c:1375)
==22609==    by 0x501EE82: allocate (newgc.c:1439)
==22609==    by 0x501F2AF: GC_malloc_atomic (newgc.c:1557)
==22609==    by 0x4F62F1D: scheme_copy_stack (setjmpup.c:298)
==22609==    by 0x4F6364A: scheme_setjmpup_relative (setjmpup.c:556)
==22609==    by 0x4CB3781: scheme_handle_stack_overflow (eval.c:447)
==22609==    by 0x4FD0A09: scheme_thread_block (thread.c:4969)
==22609==    by 0x4CE2775: scheme_really_create_overflow (fun.c:1087)
==22609==    by 0x4CE2A7D: scheme_create_overflow (fun.c:1147)
==22609==    by 0x4C94360: place_instance_init (env.c:534)
==22609==    by 0x4C938A6: scheme_engine_instance_init (env.c:305)
==22609==    by 0x4C93714: scheme_basic_env (env.c:226)
==22609==    by 0x406CCD: ??? (in /var/tmp/racket/bin/racket)
==22609==    by 0x4071D8: ??? (in /var/tmp/racket/bin/racket)
==22609==    by 0x4C4A53E: do_main_stack_setup (salloc.c:198)
==22609==    by 0x4C4A5B1: scheme_main_stack_setup (salloc.c:310)
==22609==    by 0x4070DD: ??? (in /var/tmp/racket/bin/racket)
==22609==    by 0x4070A6: main (in /var/tmp/racket/bin/racket)
==22609==  Address 0x5ac2290 is 8 bytes after a block of size 104 alloc'd
==22609==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==22609==    by 0x501ABA2: ofm_malloc (newgc.c:335)
==22609==    by 0x501ABD5: ofm_malloc_zero (newgc.c:342)
==22609==    by 0x501B312: block_cache_create (block_cache.c:65)
==22609==    by 0x501D038: mmu_create (vm.c:101)
==22609==    by 0x5025423: NewGC_initialize (newgc.c:2942)
==22609==    by 0x5025533: init_type_tags_worker (newgc.c:2976)
==22609==    by 0x5025831: GC_construct_child_gc (newgc.c:3026)
==22609==    by 0x5025AF2: GC_switch_out_master_gc (newgc.c:3092)
==22609==    by 0x4C9388B: scheme_engine_instance_init (env.c:297)
==22609==    by 0x4C93714: scheme_basic_env (env.c:226)
==22609==    by 0x406CCD: ??? (in /var/tmp/racket/bin/racket)
==22609==    by 0x4071D8: ??? (in /var/tmp/racket/bin/racket)
==22609==    by 0x4C4A53E: do_main_stack_setup (salloc.c:198)
==22609==    by 0x4C4A5B1: scheme_main_stack_setup (salloc.c:310)
==22609==    by 0x4070DD: ??? (in /var/tmp/racket/bin/racket)
==22609==    by 0x4070A6: main (in /var/tmp/racket/bin/racket)

and after that racket eats cpu and memory till killed by OOM killer.
looking at strace - all that it is do - writing (and reading) all
alphabet characters one by one to pipe.

any ideas?

Отправлено моей секретаршей из моего Bentley с моего Vertu

--
Sergey Pinaev <pinaev <at> jet.msk.su>
____________________
  Racket Users list:
  http://lists.racket-lang.org/users
Ben Lerner | 25 Feb 05:06 2015

DrRacket 6.1.1 stuck in a gc loop on Windows7x64

I ran into an unfortunate situation last night with DrRacket, where I 
was editing a single scribble file, and DrRacket basically locked up in 
a gc loop (the recycle icon was flashing, syntax highlighting was 
glacially slow, and the entire UI was mostly frozen.)  There were two 
threads which seem to be stuck looping (and consuming 36+% of my CPU).  
The two stack traces were, according to Process Explorer:

Stack 1 (25% of CPU, aka one entire processor out of four)
USP10.dll+0x8580
libracket3m_9xtjc8.dll!GC_mark+0x1ab
libracket3m_9xtjc8.dll!GC_mark_variable_stack+0x8d0
libracket3m_9xtjc8.dll!GC_mark_variable_stack+0xb0b
libracket3m_9xtjc8.dll!GC_construct_child_gc+0x5a0
libracket3m_9xtjc8.dll!GC_free_all+0x318
libracket3m_9xtjc8.dll!GC_check_master_gc_request+0xc2
libracket3m_9xtjc8.dll!scheme_thread_block+0x630
libracket3m_9xtjc8.dll!scheme_block_until+0x225
libracket3m_9xtjc8.dll!scheme_kill_thread+0x8b1
libracket3m_9xtjc8.dll!scheme_kill_thread+0xb28
libracket3m_9xtjc8.dll!scheme_apply_known_prim_closure_multi+0x210
libracket3m_9xtjc8.dll!scheme_hash_set_atomic+0x3db0b

Stack 2 (11% CPU, aka half of one processor)
USP10.dll+0x8580
libracket3m_9xtjc8.dll!GC_retract_only_mark_stack_entry+0x63a
libracket3m_9xtjc8.dll!GC_mark+0x151
libracket3m_9xtjc8.dll!GC_mark_variable_stack+0x8d0
libracket3m_9xtjc8.dll!GC_mark_variable_stack+0xb0b
libracket3m_9xtjc8.dll!GC_construct_child_gc+0x5a0
libracket3m_9xtjc8.dll!GC_free_all+0x318
libracket3m_9xtjc8.dll!GC_make_jit_nursery_page+0x20b
libracket3m_9xtjc8.dll!GC_make_jit_nursery_page+0x2ff
libracket3m_9xtjc8.dll!scheme_break_thread+0xed8
libracket3m_9xtjc8.dll!scheme_kill_thread+0x743
libracket3m_9xtjc8.dll!scheme_sync+0x22
libracket3m_9xtjc8.dll!scheme_make_modidx+0x188f
libracket3m_9xtjc8.dll!scheme_module_is_declared+0xeb7
libracket3m_9xtjc8.dll!scheme_namespace_require+0x7e48
libracket3m_9xtjc8.dll!scheme_dynamic_require+0xbd
libracket3m_9xtjc8.dll!scheme_read_byte_string+0x9b4d
libracket3m_9xtjc8.dll!scheme_read_byte_string+0xa572
libracket3m_9xtjc8.dll!scheme_read_byte_string+0x1069a
libracket3m_9xtjc8.dll!scheme_read_byte_string+0x15df9
libracket3m_9xtjc8.dll!scheme_make_rational+0x29f9
libracket3m_9xtjc8.dll!scheme_get_seconds+0x2515
libracket3m_9xtjc8.dll!scheme_make_rational+0x2c27
libracket3m_9xtjc8.dll!scheme_call_enable_break+0x265c
libracket3m_9xtjc8.dll!scheme_dynamic_wind+0x3b6
libracket3m_9xtjc8.dll!scheme_call_enable_break+0x33ed

I managed to save my work and DrRacket did eventually close cleanly (I 
didn't have to force quit it).  I don't have the instance still running, 
since I needed a running DrRacket (and a not-frozen computer).  
Hopefully this stack info will be of sufficient use to someone trying to 
debug it.  A bit of searching reveals that "USP10.dll 0x8580" is 
probably a red herring, and running Process Explorer with administrator 
rights suggests that the USP10.dll line should really be a bunch of 
calls into ntoskrnl.exe, culminating in ntoskrnl.exe!memset+0x61a.

Ben
____________________
  Racket Users list:
  http://lists.racket-lang.org/users


Gmane