Re: [racket-users] Re: Recursive stepping down a list patially?
FWIW, your `find-it` is a thin wrapper over `memf` from `racket/base`. Vincent On Tue, 01 Nov 2016 05:06:47 +0100, George Neuner wrote: > > On Tue, 1 Nov 2016 04:28:26 +0100, > meino.cra...@gmx.de wrote: > > > > >Hi Jon, > > > >thanks for reply! :) > > > >My plan was, to return only one element from that list and > >possibly some extra informations and pass that to the processing > >function so it could right jump onto that train... > > > >Is that possible? > > Sure. I'm guessing that the list elements are not simple values that > can be matched directly, but rather you need to extract and match a > search key. > > You can do something like: > > (define (find-it lst key) > (cond > ([null? lst] > ;; end of the list > (list #f '())) > ([equal? (car lst) key] > ;; matched the search key > ;; return item and next list position > (list (car lst)(cdr lst))) > (else > ;; keep going > (find-it (cdr lst) key)) > )) > > > To return the 2 values, you can use a list, a vector, a structure or > even (values). Depends on what you need to do with them. > > > In Racket (or Scheme or Lisp) an object is just a reference to a heap > allocation somewhere. In C terms, you are always dealing with > pointers that are implicitly dereferenced when you look at them ... > and it isn't possible to get a null pointer. > [Actually it's more like workin with references in C++.] > > When you return the "tail of the list", all that is being passed is a > pointer to some element of the original list. > > This explanation is very simplistic [and not quite correct], but it is > close enough to reality that you won't go far wrong thinking about > things in this way. The technical details are too involved for you to > worry about until you learn more. > > Hope this helps, > George > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] [OT]: Receiving doubled mail and mutt (Linux/UNIX mailclient)
Hi, not a Racket thing... >From all threads I started or posted to I receive each mail twice. I am using "mutt", the lInux mail client, to write and compose mails. Mutt knows about mailinglists. Normally "r"eplaying to a posting of a mailinglist, mutt asked "Reply tp list? [yes]/no" and hitting accepts the default of replying to the list. For unknown reasons this seems not work with the racket mailinglist. I had to press "g" (reply all) to reply to the mailinglist. Are there some differences to other mailinglists which mau trigger this (and may be the root cause of the doubled mails in turn?)? What can I do to fix that? Cheers Meino -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Re: Recursive stepping down a list patially?
Hi George, thanks for your reply! :) THAT HELPS! Thanks for the look inside of racket! Cheers Meino George Neuner[16-11-01 05:20]: > On Tue, 1 Nov 2016 04:28:26 +0100, > meino.cra...@gmx.de wrote: > > > > >Hi Jon, > > > >thanks for reply! :) > > > >My plan was, to return only one element from that list and > >possibly some extra informations and pass that to the processing > >function so it could right jump onto that train... > > > >Is that possible? > > Sure. I'm guessing that the list elements are not simple values that > can be matched directly, but rather you need to extract and match a > search key. > > You can do something like: > > (define (find-it lst key) > (cond > ([null? lst] > ;; end of the list > (list #f '())) > ([equal? (car lst) key] > ;; matched the search key > ;; return item and next list position > (list (car lst)(cdr lst))) > (else > ;; keep going > (find-it (cdr lst) key)) > )) > > > To return the 2 values, you can use a list, a vector, a structure or > even (values). Depends on what you need to do with them. > > > In Racket (or Scheme or Lisp) an object is just a reference to a heap > allocation somewhere. In C terms, you are always dealing with > pointers that are implicitly dereferenced when you look at them ... > and it isn't possible to get a null pointer. > [Actually it's more like workin with references in C++.] > > When you return the "tail of the list", all that is being passed is a > pointer to some element of the original list. > > This explanation is very simplistic [and not quite correct], but it is > close enough to reality that you won't go far wrong thinking about > things in this way. The technical details are too involved for you to > worry about until you learn more. > > Hope this helps, > George > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Re: Recursive stepping down a list patially?
On Tue, 1 Nov 2016 04:28:26 +0100, meino.cra...@gmx.de wrote: > >Hi Jon, > >thanks for reply! :) > >My plan was, to return only one element from that list and >possibly some extra informations and pass that to the processing >function so it could right jump onto that train... > >Is that possible? Sure. I'm guessing that the list elements are not simple values that can be matched directly, but rather you need to extract and match a search key. You can do something like: (define (find-it lst key) (cond ([null? lst] ;; end of the list (list #f '())) ([equal? (car lst) key] ;; matched the search key ;; return item and next list position (list (car lst)(cdr lst))) (else ;; keep going (find-it (cdr lst) key)) )) To return the 2 values, you can use a list, a vector, a structure or even (values). Depends on what you need to do with them. In Racket (or Scheme or Lisp) an object is just a reference to a heap allocation somewhere. In C terms, you are always dealing with pointers that are implicitly dereferenced when you look at them ... and it isn't possible to get a null pointer. [Actually it's more like workin with references in C++.] When you return the "tail of the list", all that is being passed is a pointer to some element of the original list. This explanation is very simplistic [and not quite correct], but it is close enough to reality that you won't go far wrong thinking about things in this way. The technical details are too involved for you to worry about until you learn more. Hope this helps, George -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Recursive stepping down a list patially?
On Mon, Oct 31, 2016 at 11:28 PM,wrote: > > Hi Jon, > > thanks for reply! :) > > My plan was, to return only one element from that list and > possibly some extra informations and pass that to the processing > function so it could right jump onto that train... > > Is that possible? > > I think I understand your concern, and I think it's misplaced. Here's what I think you're suggesting: you don't want to return the entire remainder of the list, because (as you said) it's a really long list, and you're concerned about passing around (and possibly duplicating) a ton of data. But that's not the way it works. In terms of in-memory representation, all that the `member` functions return is a pointer to a position (a particular pair) in the original list. You seem to be thinking of something like this: if you were using a vector, you could return the element and the index where you found that element. Then you could continue on from the next index. And you wouldn't want to do this with a list, because if you start at the head of the original list, you'd first have to follow it down to the nth element before continuing on, and that would be inefficient. But what I'm saying is that if you simply return the tail of the list using a `member` function, you don't incur that extra iteration cost, and you don't duplicate any of the original list. - Jon -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Recursive stepping down a list patially?
Hi Jon, thanks for reply! :) My plan was, to return only one element from that list and possibly some extra informations and pass that to the processing function so it could right jump onto that train... Is that possible? Cheers Meino Jon Zeppieri[16-11-01 04:20]: > On Mon, Oct 31, 2016 at 10:53 PM, wrote: > > > Hi, > > > > I have a lng list of something. And I have a recursive serach > > function to crawl down the list and search for a previously determined > > item. > > When found, the search processes stops and returns that item of the > > list. > > > > In a second step, I want to process the list starting with that > > certain item til the end of the list. > > > > Is it possible to jump right into a list at a certain item of > > the list and to start processing there? Could the search function > > return a certain extra information so that another function could > > pick up that item directly and start recursing from there? > > """Distributed recursion""" somehow...? > > > > > The tail of a non-empty list is simply a list, so, if I understand you > correctly, what you want to do is very straightforward. The `member` (and > `memq` / `memv` / `memf` ) functions are meant for exactly this sort of > thing. In your first step, instead of returning just the member of the list > you're interested in, you can return the sublist that starts with that > item. For example, let's say you have a list of strings that looks like > this: > > (define xs '("one" "two" "three" "four" "five")) > > And you want to find "three." Then you can do: > > (member "three" xs) > > ... which returns: > > '("three" "four" "five") > > The first element of the result is the element you wanted, and the > remainder of the list is everything after it. > > You'll want `memf` if you need to search by some arbitrary function. See > the documentation for this group of functions. > > - Jon > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Recursive stepping down a list patially?
On Mon, Oct 31, 2016 at 10:53 PM,wrote: > Hi, > > I have a lng list of something. And I have a recursive serach > function to crawl down the list and search for a previously determined > item. > When found, the search processes stops and returns that item of the > list. > > In a second step, I want to process the list starting with that > certain item til the end of the list. > > Is it possible to jump right into a list at a certain item of > the list and to start processing there? Could the search function > return a certain extra information so that another function could > pick up that item directly and start recursing from there? > """Distributed recursion""" somehow...? > > The tail of a non-empty list is simply a list, so, if I understand you correctly, what you want to do is very straightforward. The `member` (and `memq` / `memv` / `memf` ) functions are meant for exactly this sort of thing. In your first step, instead of returning just the member of the list you're interested in, you can return the sublist that starts with that item. For example, let's say you have a list of strings that looks like this: (define xs '("one" "two" "three" "four" "five")) And you want to find "three." Then you can do: (member "three" xs) ... which returns: '("three" "four" "five") The first element of the result is the element you wanted, and the remainder of the list is everything after it. You'll want `memf` if you need to search by some arbitrary function. See the documentation for this group of functions. - Jon -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Recursive stepping down a list patially?
Hi, I have a lng list of something. And I have a recursive serach function to crawl down the list and search for a previously determined item. When found, the search processes stops and returns that item of the list. In a second step, I want to process the list starting with that certain item til the end of the list. Is it possible to jump right into a list at a certain item of the list and to start processing there? Could the search function return a certain extra information so that another function could pick up that item directly and start recursing from there? """Distributed recursion""" somehow...? (I know, that vectors can do that and that there is a function to convert a list to a vector and vice versa and the real programmer would call the processing function from the search function when the certain item is found -- but all this would make this email/question superflous... ;))) Cheers Meino -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[racket-users] Call for Workshop Proposals: ICFP 2017
CALL FOR WORKSHOP AND CO-LOCATED EVENT PROPOSALS ICFP 2017 22nd ACM SIGPLAN International Conference on Functional Programming September 3-9, 2017 Oxford, United Kingdom http://conf.researchr.org/home/icfp-2017 The 22nd ACM SIGPLAN International Conference on Functional Programming will be held in Oxford, United Kingdom on September 3-9, 2017. ICFP provides a forum for researchers and developers to hear about the latest work on the design, implementations, principles, and uses of functional programming. Proposals are invited for workshops (and other co-located events, such as tutorials) to be affiliated with ICFP 2017 and sponsored by SIGPLAN. These events should be less formal and more focused than ICFP itself, include sessions that enable interaction among the attendees, and foster the exchange of new ideas. The preference is for one-day events, but other schedules can also be considered. The workshops are scheduled to occur on September 3 (the day before ICFP) and September 7-9 (the three days after ICFP). -- Submission details Deadline for submission: November 19, 2016 Notification of acceptance: December 18, 2016 Prospective organizers of workshops or other co-located events are invited to submit a completed workshop proposal form in plain text format to the ICFP 2017 workshop co-chairs (David Christiansen and Andres Loeh), via email to icfp2017-worksh...@googlegroups.com by November 19, 2016. (For proposals of co-located events other than workshops, please fill in the workshop proposal form and just leave blank any sections that do not apply.) Please note that this is a firm deadline. Organizers will be notified if their event proposal is accepted by December 18, 2016, and if successful, depending on the event, they will be asked to produce a final report after the event has taken place that is suitable for publication in SIGPLAN Notices. The proposal form is available at: http://www.icfpconference.org/icfp2017-files/icfp17-workshops-form.txt Further information about SIGPLAN sponsorship is available at: http://www.sigplan.org/Resources/Proposals/Sponsored/ -- Selection committee The proposals will be evaluated by a committee comprising the following members of the ICFP 2017 organizing committee, together with the members of the SIGPLAN executive committee. Workshop Co-Chair: David Christiansen (Indiana University) Workshop Co-Chair: Andres Loeh(Well-Typed LLP) General Chair: Jeremy Gibbons (University of Oxford) Program Chair: Mark Jones (Portland State University) -- Further information Any queries should be addressed to the workshop co-chairs (David Christiansen and Andres Loeh), via email to icfp2017-worksh...@googlegroups.com -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] Using the graph library
Hi Lawrence, Can you provide some more context? Are you looking to learn about graphs in general, or specifically about the graph library API. For the former, any well known algorithms textbook should have a decent introduction. I used CLRS [1] as a guide when developing the library. For the latter, take a look at the example programs included with the library [2]. If things are still confusing, I'm open to feedback on which specific components could be improved. [1]: https://mitpress.mit.edu/books/introduction-algorithms [2]: https://github.com/stchang/graph/tree/master/graph/tests On Sat, Oct 29, 2016 at 2:59 PM, Lawrence Bottorffwrote: > I see the Racket Generic Graph Library, but I don't know how to use it. Where > would one go to learn, tutorial-style" the ins and outs of using this > library? I take it this library allows you to "roll your own" graph database? > I did notice the HTDP has a section on graph things. Would this help? > > LB > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.