Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #14158
| From | "WJ" <w_a_x_man@yahoo.com> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: I am still kinda depressed about learning forth |
| Date | 2012-07-19 06:23 +0000 |
| Organization | NewsGuy - Unlimited Usenet $19.95 |
| Message-ID | <ju894u02ncs@enews4.newsguy.com> (permalink) |
| References | (1 earlier) <8e42b297-741e-4aab-a1ed-03006629e5e6@wt8g2000pbb.googlegroups.com> <ju3qna02krt@enews6.newsguy.com> <ju7hio02bm2@enews2.newsguy.com> <ju7kmc02d36@enews4.newsguy.com> <970b3b78-6519-454f-a399-e329df72ff65@d6g2000pbt.googlegroups.com> |
Hugh Aguilar wrote: > > (printf "below average: ~a\n" > > (count (curry > (average numbers)) numbers)) > > (printf "above average: ~a\n" > > (count (curry < (average numbers)) numbers)) > > You are well known (notorious) for promoting Ruby on these forums. You > also apparently know Racket though. What are the pros and cons of > those two languages compared to each other? If I was stranded on a > desert island (my brain is actually somewhat similar to a desert > island), which language should I take with me? I can't answer that. There is no accounting for taste. Both languages are excellent. Ruby offers more brevity but lacks macros and high-speed looping. I use Ruby for most work that I need to perform. > > BTW: I'm holding off on a Forth solution until Gavino at least tries a > little bit on his own. > > P.S. I don't know what CURRY means in the above. Let's say we want to count the odd numbers in a list. (count (lambda(n) (odd? n)) '(1 1 2 3 5 8)) 4 We can dispense with the anonymous function (lambda) and use odd? directly since it only needs one argument: (count odd? '(1 1 2 3 5 8)) 4 Now we want to count the numbers larger than 3: (count (lambda(n) (< 3 n)) '(1 1 2 3 5 8)) 2 How do we get rid of the ugly lambda and the parameter n? Using currying or partial application, we convert < to a function that needs only one argument (by supplying up front one of the two arguments it needs). (count (curry < 3) '(1 1 2 3 5 8)) 2 This is much cleaner because there is no named parameter. If we want to pre-supply the rightmost argument instead of the leftmost, we use curryr. (count (curryr > 3) '(1 1 2 3 5 8)) 2
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar
I am still kinda depressed about learning forth quiet_lad <gavcomedy@gmail.com> - 2012-07-10 21:17 -0700
Re: I am still kinda depressed about learning forth quiet_lad <gavcomedy@gmail.com> - 2012-07-10 21:43 -0700
Re: I am still kinda depressed about learning forth marko <marko@marko.marko> - 2012-07-11 14:55 +1000
Re: I am still kinda depressed about learning forth quiet_lad <gavcomedy@gmail.com> - 2012-07-10 21:57 -0700
Re: I am still kinda depressed about learning forth marko <marko@marko.marko> - 2012-07-11 15:12 +1000
Re: I am still kinda depressed about learning forth quiet_lad <gavcomedy@gmail.com> - 2012-07-10 22:04 -0700
Re: I am re energized to learn forth and see how simple computers can be! quiet_lad <gavcomedy@gmail.com> - 2012-07-10 22:05 -0700
Re: I am re energized to learn forth and see how simple computers can be! Mark Wills <markrobertwills@yahoo.co.uk> - 2012-07-11 02:08 -0700
Re: I am re energized to learn forth and see how simple computers can be! Doug Hoffman <glidedog@gmail.com> - 2012-07-11 07:14 -0400
Re: I am re energized to learn forth and see how simple computers can be! Mark Wills <markrobertwills@yahoo.co.uk> - 2012-07-11 04:54 -0700
Re: I am re energized to learn forth and see how simple computers can be! marko <marko@marko.marko> - 2012-07-11 22:30 +1000
Re: I am re energized to learn forth and see how simple computers can be! Doug Hoffman <glidedog@gmail.com> - 2012-07-11 08:35 -0400
Re: I am re energized to learn forth and see how simple computers can be! Hannu Vuolasaho <hannu.vuolasaho@nospam.tut.fi.invalid> - 2012-07-11 14:13 +0000
Re: I am re energized to learn forth and see how simple computers can be! Bernd Paysan <bernd.paysan@gmx.de> - 2012-07-12 22:01 +0200
Re: I am re energized to learn forth and see how simple computers can be! Fanzo <cristianof6@gmail.com> - 2012-07-11 21:27 +0200
Re: I am re energized to learn forth and see how simple computers can be! Doug Hoffman <glidedog@gmail.com> - 2012-07-11 16:41 -0400
Re: I am re energized to learn forth and see how simple computers can be! quiet_lad <gavcomedy@gmail.com> - 2012-07-11 14:49 -0700
Re: I am re energized to learn forth and see how simple computers can be! Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-12 01:06 +0000
Re: I am re energized to learn forth and see how simple computers can be! Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-13 23:01 -0700
Re: I am re energized to learn forth and see how simple computers can be! "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-07-14 03:28 -0400
Re: I am re energized to learn forth and see how simple computers can be! Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-14 03:39 -0700
Re: I am re energized to learn forth and see how simple computers can be! quiet_lad <gavcomedy@gmail.com> - 2012-07-17 15:54 -0700
Re: I am re energized to learn forth and see how simple computers can be! quiet_lad <gavcomedy@gmail.com> - 2012-07-17 14:23 -0700
Re: I am re energized to learn forth and see how simple computers can be! Doug Hoffman <glidedog@gmail.com> - 2012-07-11 16:37 -0400
Re: I am re energized to learn forth and see how simple computers can be! quiet_lad <gavcomedy@gmail.com> - 2012-07-11 13:19 -0700
Re: I am still kinda depressed about learning forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-15 16:57 -0700
Re: I am still kinda depressed about learning forth Clyde Phillips <cwpjr02@gmail.com> - 2012-07-15 22:07 -0700
Re: I am still kinda depressed about learning forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-15 22:36 -0700
Re: I am still kinda depressed about learning forth "WJ" <w_a_x_man@yahoo.com> - 2012-07-17 13:52 +0000
Re: I am still kinda depressed about learning forth quiet_lad <gavcomedy@gmail.com> - 2012-07-17 16:18 -0700
Re: I am still kinda depressed about learning forth "WJ" <w_a_x_man@yahoo.com> - 2012-07-18 23:41 +0000
Re: I am still kinda depressed about learning forth "WJ" <w_a_x_man@yahoo.com> - 2012-07-19 00:34 +0000
Re: I am still kinda depressed about learning forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-18 21:11 -0700
Re: I am still kinda depressed about learning forth "WJ" <w_a_x_man@yahoo.com> - 2012-07-19 06:23 +0000
Re: I am still kinda depressed about learning forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-07-18 23:54 -0700
Re: I am still kinda depressed about learning forth "WJ" <w_a_x_man@yahoo.com> - 2012-07-19 00:13 +0000
Re: I am still kinda depressed about learning forth quiet_lad <gavcomedy@gmail.com> - 2012-07-17 16:06 -0700
csiph-web