[racket-users] Redefining a function or aliasing a function

2016-11-11 Thread Ken MacKenzie
I am trying to figure out the best way to do this and granted I am not sure my 
architecture is the most sane or sensible way to handle it.  I am trying to 
build my DB interface and I want to allow the system to deal with numerous 
types of data stores.  So I have a config file that is read and gets the 
information needed.  So to pseudo lay it out:

(define (query-db where-clause))

(define (db-type)
  (cond
[(=? db-conf '(mysql)) ()]) ;something to redefine how query-db 
actually works.
)

Maybe this is silly as in query-db I can just do a conditional for each type.  
But then I have to do a conditional for each DB action, connect, drop, query, 
update, etc.  I was thinking loading the conditional and redefining place 
holders would be a more elegant solution.  I don't know just spit balling with 
a different design pattern here.

Ken

-- 
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] Of editors and mere mortals

2016-11-10 Thread Ken MacKenzie
I have been a vim user for quite some time.  After numerous attempts at
setting vim up more IDE like I decided to give emacs a try as I was
starting to dive deeper in the scheme/lisp/racket world.  Emacs has proven
to be a much more flexible setup.  Granted I still think knowing vim or vi
is important as of its availability in more places, especially when needing
to edit a remote instance.  However emacs has proven very useful for having
a one screen textual view of everything I need at a given time.

Ken

On Thu, Nov 10, 2016 at 8:41 AM, David Raymond Christiansen <
da...@davidchristiansen.dk> wrote:

> On 11/05/2016 09:14 AM, Ken MacKenzie wrote:
>
>> And particularly if you use emacs, what add ons or setup do you do for
>> racket or scheme editing in general.
>>
>
> I use mostly Emacs. Aside from what's already been recommended here, I
> really like DrRacket's handling of input of non-keyboard characters using
> TeX codes with a keystroke to convert them, as opposed to the typical Emacs
> setup with an input method like Agda's that converts them on the fly.
>
> So I ported it to Emacs:
>
> https://github.com/david-christiansen/dr-racket-like-unicode
>
> In my personal config, I use it like this:
>
> (use-package dr-racket-like-unicode
>   :ensure t
>   :bind (("C-\\" . dr-racket-like-unicode-char)))
>
> This one is also easy to customize. To add an abbreviation, type
>
> M-x customize-variable RET dr-racket-like-unicode-table RET
>
> and then you can add codes to the table.
>
> /David
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Racket Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/to
> pic/racket-users/IguDP2TpI-Q/unsubscribe.
> To unsubscribe from this group and all its topics, 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] Of editors and mere mortals

2016-11-05 Thread Ken MacKenzie
So as much as I know there is much love for Dr Racket, I am not the biggest 
fan.  Yes I must admit some of its helper features are great for working in 
racket and if I must debug something it is probably the best place to work.

Anyway was wondering what other editors people use.  I have been a vim user for 
a while.  Lately navigating away from it for more IDE like tasks.  I have found 
VS code on linux to actually be a pretty good racket environment with the 
drracket plugin available for it.

My latest love is I have started to get into emacs.  Years ago I tried it and 
didn't see the advantage over vim.  Now having been coding in racket, elisp 
looks less like annoying voodoo to me.  Also I am finding all the things one 
can do within emacs that are outside the scope of editing to be handy.

Anyway just curious what other editors people use.  And particularly if you use 
emacs, what add ons or setup do you do for racket or scheme editing in general.

Ken

-- 
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?

2016-11-01 Thread Ken MacKenzie
I am wondering why not use a filter on the list?

Ken


On Monday, October 31, 2016 at 10:53:25 PM UTC-4, meino.cramer 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...?
> 
> (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.


Re: [racket-users] handling terminal input per character

2016-10-30 Thread Ken MacKenzie
No this is reminding me that I need to think of my intended implementations and 
this is not a worth while thing to implement at the terminal level and also a 
case of prematurely attempting to optimize before dealing with the solution.

Intended implementation is I see a large part of this living on a server and 
clients communicating to it through json requests.  So that right there limits 
the usefulness of intercepting the key requests.

Also for heavier client side instances a possibility of implementing Sphinx for 
speech recognition is a goal and at that point we are dealing with something 
completely different.

Since the first part of the problem to solve is my ideas about Natural Language 
Processing I need to stop getting distracted from focusing on that problem 
which right now involves compiling a lot of data sets that I can quickly search 
through and the only performance optimizations I should really be dealing with 
at this stage is DB schema design for the linguistic data.

Ken

-- 
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] handling terminal input per character

2016-10-30 Thread Ken MacKenzie
So a curiosity question.  Right now I am reading in a line of terminal input 
from the user and handling it.  I am thinking of switching the program to 
handle the input character by character, and just wondering how to do that but 
also have it seem to the user that the program is waiting for them to press 
enter, appear the same as a read-line basically.

The reason I want to do that is trigger some events for certain non-alpha for 
now, white space and punctuation.  The other thing is eventually I may with to 
begin some background processing as the user is completing the full input 
string.  Basically the appearance of better performance using the bottle neck 
of the time it takes a user to create the input.  Granted I will have to deal 
with backspace or other cases where the user changes there mind.  Basically 
doing some predictive text analysis sort of.

So what is the best way to read keypress or character by character input in 
racket.  For now dealing with a CLI/terminal interface to keep it simple as I 
work to test and refine my methods.

Ken

-- 
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] How to 'apply' a function with optional parameters?

2016-10-29 Thread Ken MacKenzie
Yeah that is much more concise than mine.  My newbie lack of knowledge on the 
stdlib is showing.

Ken

On Saturday, October 29, 2016 at 11:12:50 AM UTC-4, Stephen Chang wrote:
> string-join already expects a list of strings, so are you sure you want apply?
> Can you give a more specific example?
> 
> Perhaps map or some other iteration is what you want?
> 
> (for ([strs '(("a" "b") ("c" "D" "E"))])
>   (displayln (string-join strs " ")))
> 
> =>
> a b
> c D E
> 

-- 
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: How to 'apply' a function with optional parameters?

2016-10-29 Thread Ken MacKenzie
Not 100% sure of what you're asking so if I got this wrong pseudo code it for 
me.  Remember I am kind of new to racket but I will give it a go:

As I understand it you have a list of lists of strings perhaps like this...

(('this' 'is' 'one')('this' 'is' 'another')('this' 'is' 'the' 'last'))

and you want to output as such

this is one
this is another

this is the last


Ok so here is how I would do this

I will write this as 2 functions, from your main code you call the first 
passing it ...

big-list = the whole list of lists

;;in main loop
(per-line big-list)

(define (per-line blist)
  (cond
[(empty? blist) #f]
[else
  (per-item (first blist))
  (newline)
  (per-line (rest blist))]))

(define (per-item slist)
  (cond
[(empty? slist) #f]
[else
  (display (first slist))
  (display " ")
  (per-item (rest slist))]))

That should be about it.  Double check me an ide about matched parens and 
brackets.  I just eyeballed this real quick in the message.  But that is the 
approach I would take for a simple proof.

An alternate approach is per-item accepts a string argument and returns the 
string to per-line to display.  But if the end goal is quick output this is a 
bout as concise + readable as I think I can make it.

Ken


On Saturday, October 29, 2016 at 10:27:09 AM UTC-4, meino.cramer wrote:
> Hi,
> 
> ...still improving my shortwave-broadcaster-dumper... :)
> 
> I have a list with sublists of strings, which I want to concatenate.
> Each sublist shall form one line of output.
> I tried 'string-append', but this gives me something like this
> (excerpt):
> "189RikisutvarpidRas1+2-24001234567Icelandic"
> ...the separating #\space is missing.
> 
> The according code looks like this (excerpt)
> 
> (apply string-append sublist)
> 
> then I found 'string-join' which has extra-parameters
> to define separator of all kinds.
> 
> ...but...how can I express the 'apply'-instruction...with the 
> addional parameters???
> 
> This looks something inbetween funny and weird:
> 
> (apply string-join sublist " ")
> 
> and racket mumbles:
> apply: contract violation
>   expected: list?
>   given: " "
>   argument position: 3rd
>   other arguments...:
>#
> 
> 
> ?
> 
> 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] Re: Print...a newbies problem ;)

2016-10-29 Thread Ken MacKenzie
As a curiosity what happens when you run it as such

racket shwrefmt.rkt > debug.log

Ken

-- 
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: Building regexen in at-exp

2016-10-28 Thread Ken MacKenzie
Sort of.  at a high level pseudo code view

I have a file of things
the user inputs a list of things
for each thing the user inputs it finds all reference in the file of things

To put it plainly if you are familiar with Princeton's word net db/files I
am searching the words in a user inputted sentence against the file
index.senses.  Documentation for that file is online.  Anyway this is part
of an NLP approach I am working on.

Ken

On Fri, Oct 28, 2016 at 3:41 PM, David Storrs <david.sto...@gmail.com>
wrote:

> On Fri, Oct 28, 2016 at 3:24 PM, Ken MacKenzie <deviloc...@gmail.com>
> wrote:
> > In a future version of what I am working on I see regex being an
> excellent solution.  My search is against a file I load into a list at
> program initialization.  However for other parts of this to load a list
> based on a partial file filtered with regex may be a better solution.
>
> So you're doing something like "load the whole file, then search for
> all lines that start with prefix X"?
>
> You might try something like this:
>
> (define prefix #px"^foo")  ;; Construct this however you like
>
> (for ((line (file->lines "/path/to/file)))
>   (when (pregexp-match prefix l)
>   (do-the-thing-with line)))
>
> Code not tested.
> >
> > There is also the case that I eventually switch to a DB backend, but at
> prototype stage I have been skipping that.
> >
> > Sorry not an answer to your query, but I think I could make use of the
> answer so inserting myself into the thread.
> >
> > Ken
> >
> > On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote:
> >> tl;dr :  Why is the following an error?
> >>
> >> #lang at-exp racket
> >> (define a "this")
> >> @pregexp{^@a}  ;; Should produce #px"^this" but errors out
> >> @pregexp{@(~a "^" a)}  ;; This works but is clumsy
> >>
> >> Long version:
> >>
> >> The at-exp language
> >> (http://www.greghendershott.com/2015/08/at-expressions.html and
> >> https://docs.racket-lang.org/scribble/reader-internals.html) allows
> >> for (among other things) more convenient construction of regexen, like
> >> so:
> >>
> >> (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh.
> >> @pregexp{\d\d\.\d\d}  ;; at-exp...ah, much better
> >>
> >> I started to reply to Ken MacKenzie's recent post about string
> >> prefixes with a suggestion that, although string-prefix was what he
> >> wanted in this case, a regex would be a more general solution.  When I
> >> went to test the code I was suggesting, I was surprised to find it
> >> didn't work as expected.  I thought maybe "^@" was a function or
> >> special form in Racket, but a quick search of the docs revealed
> >> nothing.  I tried various forms of quoting inside the at-exp but
> >> nothing worked.
> >>
> >> What am I missing?
> >
> > --
> > 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: Building regexen in at-exp

2016-10-28 Thread Ken MacKenzie
In a future version of what I am working on I see regex being an excellent 
solution.  My search is against a file I load into a list at program 
initialization.  However for other parts of this to load a list based on a 
partial file filtered with regex may be a better solution.

There is also the case that I eventually switch to a DB backend, but at 
prototype stage I have been skipping that.

Sorry not an answer to your query, but I think I could make use of the answer 
so inserting myself into the thread.

Ken

On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote:
> tl;dr :  Why is the following an error?
> 
> #lang at-exp racket
> (define a "this")
> @pregexp{^@a}  ;; Should produce #px"^this" but errors out
> @pregexp{@(~a "^" a)}  ;; This works but is clumsy
> 
> Long version:
> 
> The at-exp language
> (http://www.greghendershott.com/2015/08/at-expressions.html and
> https://docs.racket-lang.org/scribble/reader-internals.html) allows
> for (among other things) more convenient construction of regexen, like
> so:
> 
> (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh.
> @pregexp{\d\d\.\d\d}  ;; at-exp...ah, much better
> 
> I started to reply to Ken MacKenzie's recent post about string
> prefixes with a suggestion that, although string-prefix was what he
> wanted in this case, a regex would be a more general solution.  When I
> went to test the code I was suggesting, I was surprised to find it
> didn't work as expected.  I thought maybe "^@" was a function or
> special form in Racket, but a quick search of the docs revealed
> nothing.  I tried various forms of quoting inside the at-exp but
> nothing worked.
> 
> What am I missing?

-- 
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: Compare parts of string or compare with wildcard.

2016-10-28 Thread Ken MacKenzie
Excellent thank you.  To note I am searching the docs but I see I did not 
scroll far enough.  I went to go find string-prefix in the doc and also found 
string-contains and string-suffix in the same set of examples.

So you gave me an inadvertent trifecta of useful information.

It also means that where the original code was used as part of a filter 
(lambda(x) expression I should be able to ditch the extra function and just 
handle as a filter (string-prefix.

Ken

On Friday, October 28, 2016 at 12:34:29 PM UTC-4, Shu-Hung You wrote:
> Hi Ken,
> string-prefix? does exactly what you want.
> 
> > (define a "this") (define b "that") (define c "thisandthat")
> > (string-prefix? c a)
> #t
> > (string-prefix? c b)
> #f
> 
> https://docs.racket-lang.org/reference/strings.html#%28def._%28%28lib._racket%2Fstring..rkt%29._string-prefix~3f%29%29
> 
> Best,
> Shu-Hung
> 
> > Ken

-- 
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] Compare parts of string or compare with wildcard.

2016-10-28 Thread Ken MacKenzie
I have two things I am trying to compare, both strings.

What I want to know is if string a is the beginning of string b.

Example (pseudo code)

string a = this
string b = that
string c = thisandthat

a... == c #t
b... == c #f

Hope I am making sense here.  I couldn't figure out a way so at present my 
program does this

(define alen (length astr))
(define bpart (substring bstr 0 alen))
(cond
  [(string=? astr bpart) #t]
  [else #f])

That is working, but it seems like there should be a simpler solution to this.

Ken

-- 
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: Racket builds for ARM?

2016-10-27 Thread Ken MacKenzie
Perhaps not the answer you want, but you could always pull the source from the 
github repo and compile it for arm.

Ken

On Thursday, October 27, 2016 at 9:21:57 PM UTC-4, meino.cramer wrote:
> Hi,
> 
> after putting Racket on my desktop Linux box and on my tablet
> (ARCHLinux chroot, x86 CPU) I want to put Racket on my Orange PI
> PC (which is a Raspberry Pi inspired SoC-Computer). This Orange
> Pi PC runs a " ARMBIAN Debian GNU/Linux 8 (jessie) 3.4.112-sun8i"
> The CPU is (according to /proc/cpuingo) a
> ARMv7 Processor rev 5 (v7l).
> 
> ARMBIAN only offers a (according to 'apt search racket')
> racket/stable 6.1-4 armhf.
> 
> Is there any source known, which offers recent builds for this
> platform?
> 
> Thanks a lot for any help!
> 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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
I hope to be a trend setter.  Haven't really introduced myself but I find
racket a great toolset for getting 

Re: [racket-users] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
I agree on the importance of an efficient algorithm.  I do feel knowing
some of the internals of how language or development environment stores and
access values can be part of determining the nature of what is the most
efficient algorithm.  Sometimes flaws in an environment can lead to a
counter intuitive solution being the shortest distance from point A to B.
I could relay a tale of SELECT statements in Unidata for that one.

On Thu, Oct 27, 2016 at 2:57 PM, David Storrs <david.sto...@gmail.com>
wrote:

> You know, it's a very pleasant surprise to me how many messages I've
> recently seen on this list that began "I'm just getting started with
> Racket and"  Great to see that the Racket community is growing.
>
> On Thu, Oct 27, 2016 at 2:42 PM, Jos Koot <jos.k...@gmail.com> wrote:
> > Hi
> >
> > Lisp (and Racket) programmers know the value, Fortran (and assembler)
> programmers the cost.
> > Nowadays the PLTeam is working on effeciency too, I think.
> > But: the most important factor for efficient programming is to select
> efficient algorithms.
> > Two very simple, but notorious examples where you can go wrong in
> efficiency with the algorithm
> > are Fibonacci numbers and binomial coefficients.
> >
> > Nowadays we have lots of primary memory, but long ago, with machines
> with limited primary memory,
> > there was a time that for some computations it was faster to recompute
> than to store to and retrieve from disk.
> > Much depends on the architecture of the computer, which in the old days
> was documented very well,
> > so well that you could predict how data were flowing through the
> processors (even with virtual memory).
> > Nowaday manufactures of computers give less information.
> > For a good estimation of the efficiency of a program
> > you have to know which busses are used, their numbers of bits and their
> frequencies
> > and how well these busses connect to each other.
> > Well, a little bit of nostalgia.
> >
> > MHO, Jos
> >
> > -Original Message-
> > From: racket-users@googlegroups.com [mailto:racket-users@
> googlegroups.com] On Behalf Of Ken MacKenzie
> > Sent: jueves, 27 de octubre de 2016 19:28
> > To: Racket Users
> > Cc: deviloc...@gmail.com
> > Subject: Re: [racket-users] Structs vs Lists
> >
> > Thank you for the information.  Good to know.  Performance isn't the
> first thing I am thinking about, but as I am tinkering and
> > getting running with Racket I like to kind of dig into the underlying
> structure to know the cost of certain operations.
> >
> > Ken
> >
> >> For accessing an arbitrary member, yes. A Racket vector is like, say, a
> C array: it's a contiguous chunk of memory, and you can
> > get at any member of it in constant time.
> >>
> >>
> >> For other purposes? Depends on the purpose. A struct is superior to a
> list for struct-like operations. A list is superior to a
> > struct for list-like operations.
> >>
> >
> > --
> > 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.
>

-- 
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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
Thank you for the information.  Good to know.  Performance isn't the first 
thing I am thinking about, but as I am tinkering and getting running with 
Racket I like to kind of dig into the underlying structure to know the cost of 
certain operations.

Ken

> For accessing an arbitrary member, yes. A Racket vector is like, say, a C 
> array: it's a contiguous chunk of memory, and you can get at any member of it 
> in constant time.
> 
> 
> For other purposes? Depends on the purpose. A struct is superior to a list 
> for struct-like operations. A list is superior to a struct for list-like 
> operations.
>  

-- 
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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
Thank you that makes sense.  Vectors are fixed length so in theory could I also 
say a Vector is possibly more performant than an equivalent list?

Ken

On Thursday, October 27, 2016 at 12:58:06 PM UTC-4, Jon Zeppieri wrote:
> On Thu, Oct 27, 2016 at 12:16 PM, Ken MacKenzie <devil...@gmail.com> wrote:
> This is a question more about the footprint of each.  Deep down is a Struct 
> really just syntactic sugar over a list.  
> 
> 
> Not in Racket (or in most Lisps these days).
> 
> 
>  As in most things in Lisp from my understanding are all just lists, it is 
> the basic building block of all data.  Is a struct also just a list and the 
> element names enumerations of the fields by position.
> 
> 
> 
> In terms of its representation in memory, a Racket struct is more like a 
> vector than a list.
>  
> 
> 
> Basically I am trying to figure out, without writing a benchmark test, if 
> there is any processing overhead in using a struct instead of a list with 
> enumerated field names.
> 
> 
> 
> It should generally be more efficient to access an arbitrary struct field 
> than an arbitrary list member.
>  
> 
> 
> Ken
> 
> 
> 
> --
> 
> 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...@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] Structs vs Lists

2016-10-27 Thread Ken MacKenzie
This is a question more about the footprint of each.  Deep down is a Struct 
really just syntactic sugar over a list.  As in most things in Lisp from my 
understanding are all just lists, it is the basic building block of all data.  
Is a struct also just a list and the element names enumerations of the fields 
by position.

Basically I am trying to figure out, without writing a benchmark test, if there 
is any processing overhead in using a struct instead of a list with enumerated 
field names.

Ken

-- 
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: Ubuntu PPA for v6.7

2016-10-27 Thread Ken MacKenzie
As a confirmation was part of my upgrades this morning in trusty.

On Thursday, October 27, 2016 at 11:01:01 AM UTC-4, asumu wrote:
> Hi folks,
> 
> The Ubuntu PPA should now be updated for v6.7:
> 
>   https://launchpad.net/~plt/+archive/ubuntu/racket
> 
> It should be available for precise, trusty, xenial, yakkety, and zesty though
> I've only tested it on yakkety.
> 
> (sorry if you get this e-mail twice, the mailing list ate my first e-mail
>  and put it in the moderation queue I think)
> 
> Cheers,
> Asumu

-- 
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] Problem displaying a struct returned by a function in a cond statement

2016-10-26 Thread Ken MacKenzie
After you said that I looked at the final return in findsense and it read
as such

(returnsense))

I changed it to

returnsense)

And all is well.

Thank you!

On Wed, Oct 26, 2016 at 1:34 PM, Ben Greenman <benjaminlgreen...@gmail.com>
wrote:

> Can you show us findSense?
>
> The error message is saying there's an extra pair of parentheses
> somewhere, for example:
> > (1)
> > (define-struct foo () #:transparent)
> > ((foo))
>
> On Wed, Oct 26, 2016 at 1:16 PM, Ken MacKenzie <deviloc...@gmail.com>
> wrote:
>
>> New to racket and playing with a little something.  Here is my code:
>>
>> #lang racket/base
>>
>> (require racket/list)
>>
>> (require "Findsense.rkt")
>>
>> (provide handleWords)
>>
>> (define (handleWords wlist)
>>   (cond
>> [(null? wlist) #f]
>> [else (display (findSense (first wlist)))
>>   (handleWords (rest wlist))]))
>>
>> (handleWords (list "art" "bear"))
>>
>> And here is the error I receive running it.
>>
>> application: not a procedure;
>>  expected a procedure that can be applied to arguments
>>   given: (sense '("art" "1:04:00::") '("00935235" "2" "15"))
>>   arguments...: [none]
>>   context...:
>>/home/superfly/dev/racket/SParse/Words.rkt: [running body]
>>
>> Details on the Findwords.rkt file, that is where the Findsense function
>> and sense structure are provided from.  The structure is marked
>> #:transparent
>>
>> I have tried different variations of using write, display, and even print
>> and just can't seem to get past this error on returning a struct from the
>> function.
>>
>> Note, this is called from another piece of code.  I added the last line
>> with art and bear as a means of isolating it for testing.
>>
>> Ken
>>
>> --
>> 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] Problem displaying a struct returned by a function in a cond statement

2016-10-26 Thread Ken MacKenzie
New to racket and playing with a little something.  Here is my code:

#lang racket/base   
 

 
(require racket/list)   
 

 
(require "Findsense.rkt")   
 

 
(provide handleWords)   
 

 
(define (handleWords wlist) 
 
  (cond 
 
[(null? wlist) #f]  
 
[else (display (findSense (first wlist)))   
 
  (handleWords (rest wlist))])) 
 

 
(handleWords (list "art" "bear")) 

And here is the error I receive running it.

application: not a procedure;
 expected a procedure that can be applied to arguments
  given: (sense '("art" "1:04:00::") '("00935235" "2" "15"))
  arguments...: [none]
  context...:
   /home/superfly/dev/racket/SParse/Words.rkt: [running body]

Details on the Findwords.rkt file, that is where the Findsense function and 
sense structure are provided from.  The structure is marked #:transparent

I have tried different variations of using write, display, and even print and 
just can't seem to get past this error on returning a struct from the function.

Note, this is called from another piece of code.  I added the last line with 
art and bear as a means of isolating it for testing.

Ken

-- 
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.