Формула E: В Maserati представили свою Tipo Folgore
В дни предсезонных тестов, которые сейчас проходят в Испании, заводская команда Maserati представила свою новую машину, получившую название Tipo Folgore...
В дни предсезонных тестов, которые сейчас проходят в Испании, заводская команда Maserati представила свою новую машину, получившую название Tipo Folgore...
#55 Enlightenment - How to Let Go of Our Suffering & Live
The post #55 Enlightenment – How to Let Go of Our Suffering & Live appeared first on Enlightenment Podcast.
For many years, the fees charged by investment managers of mutual funds grew ever so slightly, gradually approaching 1.5%. Over the last few years, though, the growth in these management fees has stopped. In fact, it reversed. Last year the average management fee charged for actively managed mutual funds was 1.38%, or 138 basis points, where a basis point is one tenth of one percent. But that average is badly misleading. It’s misleading because it treats all funds, regardless of size, as the same. When you adjust the fees for the size of the funds, you find that the dollar-weighted average for actively managed funds is now below 100 basis points. Three things have caused this reversal in management fees: low returns in the stock market, the growth of exchange-traded funds (ETFs) and a price war among the biggest players in the market.
The first two of these factors need little explanation. Over the last ten years, an investment in many bond funds out-performed an investment in diversified equity funds. These low returns have many investors focusing on the costs they incur for the management of their money. These costs include transaction fees for trading securities and management fees for the companies managing mutual funds or exchanged-traded funds. The second factor, the growth of ETFs, is somewhat less obvious, but important. ETFs have garnered a significant share of new money invested in equity funds over the last few years. Companies managing ETFs charge low fees for managing these funds because they have very low costs for shareholder servicing and some other administrative functions associated with investment management. Shrewd mutual fund managers have reduced prices in order to manage the gap in pricing they allow for their managed mutual funds compared to comparable ETFs.
These two causes of the fall in prices for investment management now have a third important factor. This third factor may turn out to be the most important of all. (See the Symptom & Implication, “The industry is seeing its first price wars” on StrategyStreet.com.) As described in other blogs (see blogs HERE and HERE), Vanguard has started, and continued, a price war in the ETF market. For example, iShare’s MSCI Emerging Market’s ETF and Vanguard’s Emerging Market’s ETF compete directly. Vanguard’s fund charges 27 basis points. The iShare’s fund charges 69 basis points. The iShare’s fund entered the market well before the Vanguard fund, and was much larger than the Vanguard fund. However, during 2010, the Vanguard ETF added $18 billion to its fund while iShare’s added about $4 billion. Price matters among peers.
The iShare’s funds are not always market share losers, however. The iShare’s Gold Trust is an ETF that competes with a larger rival, SPDR Gold Trust. Until June of last year, both of these ETFs charged 40 basis points. In June, iShares cut its management fees to 25 basis points. SPDR Gold Trust stayed pat at 40 basis points. Over the next few months, the iShare’s fund gained $875 million in new money, while the SPDR Gold Trust saw a net loss of $1.2 billion of money under management. Price matters among peers.
These management fees can even go to zero. One ETF today has no management fee, zero. It gets its revenues by lending out the securities in its portfolio. (See the Symptom & Implication, “Technology improvements bring falling prices” on StrategyStreet.com.)
Of course, as companies engage in price wars, they advertise their lower prices extensively in order to capture as much market share as possible before their competitors respond. The result: customers are becoming ever more price sensitive about the management fees they pay, simply because the management companies tell them to be more sensitive.
How long will it be until this fee warfare spreads to other smaller types of ETFs? Not very long, as long as price moves share.
Hi Everyone, it's me, Grace. You might remember that a couple of years ago I earned my Canine Good Citizen award with my foster dad. Well, my mom said to me about a month ago, "Hey Grace, I know you already know this stuff, but what do you say you and I take the Canine Good Citizen test again?" So I told her I would do it again, just for her if it would make her feel good.
So we practiced all these things like sitting, staying, coming, not pulling on the leash, and passing by dogs nicely without staring at them. I didn't mind it at all, because she gave me lots of treats for doing it.
This past weekend I went with my family to this place with a ton of dogs. They called it a "dog show", but there was no TV there. Anyway, I had to wait for a long time and finally, I heard them call my me and my mom's names and we went into this fenced area. There was a lady with a blue shirt and she told my mom to have me do all these things. She kept saying "nice" after I did them.
After about 10 minutes of doing what she asked me to do, my mom looked very happy and gave me a delicious beef tendon and told me we had passed the Canine Good Citizen test. It was a great day.
Want to learn witchcraft? Try this!
We've all had it happen. Someone has dribbled candle wax into the ceremonial cakes, or a sleeve has caught on fire because we got too close to a sacred flame. Fortunately, the universe has a sense of humor, so when ritual goes wrong, it's often just a small blip on the cosmic radar. However, every once in a while you encounter a situation in which things just don't go wrong, they go REALLY WRONG. As in, the sort of ritual where all you can focus on is which way you'll run if something explodes. Laura Patsouris over at Pantheon describes this very thing in her essay, When Ritual Goes Wrong, and touches on some really important points.
Of note, she points out that if you're leading the ritual, there is a certain degree of responsibility that comes with that role. If your ritual procedure is sloppy or half-baked, you're going to pass those bad habits on to the other people in attendance. Often, if you have people in the group who are new to Paganism in general, or who typically practice as solitaries, there's a good chance that they're going to think that what you're doing is par for the course. As a leader/HP/HPS you owe it to those in your circle to do your absolute best as the individual in charge of executing ritual.
Does this mean everything has to be perfect? No, of course not. But it does mean that there are certain standards you should try to adhere to. We owe it to the gods of our various traditions to be respectful of them, and of the sacred space, but we also owe it to ourselves.
OK, readers, I know you've got some doozies out there. Share your Worst Ritual Experience Ever in the Comments section!
NEWS – Govee Smart Space Heaters are being recalled due to fire and burn risks. We’ve reviewed many Govee products here including the H7135 and the H7134. Govee says the listed models do not pass the UL safety standard and they are voluntarily recalling these smart space heater models. Recall details are at the Govee […]
REVIEW – There seems to be a number of different form factors popping up with projectors recently. Very slim projectors, portable cubes, and today’s variation which looks more like a spotlight than a projector at first glance. The XGODY Gimbal 3 projector looked like a fun projector to try out and looked very portable. Read […]
Very excited for San Diego Comic-Con!!! Here's my full schedule. Hope to see you there!
Eeeeeeee! Just saw that THE SPELLSHOP is a nominee for the Goodreads Choice Awards 2024!!! Thanks so much! This makes my day! I'm so thrilled and so grateful! Voting is open now!
https://www.goodreads.com/choiceawards/readers-favorite-romantasy-books-2024
In the latest episode of their awesomely helmeted podcast, Ken and Robin talk automatic successes, imperiled Czech mayors, the secrets of Valhalla Cat, and Nicolas Roerich.
Wildfire [UK/Ireland, Cathy Brady, 3.5] After going missing for a year, a bipolar woman (Nika McGuigan) drops in on her sister (Nora-Jane Noone), opening the wounds of shared tragedy. Raw, unsubtle family drama against the backdrop of Northern Irish politics as Brexit threatens a fragile peace.
The film is dedicated to the memory of lead actor McGuigan, who died of cancer last year.
40 Years a Prisoner [US, Tommy Oliver, 4] Documentary recounts the 1978 standoff between members of radical Black back-to-nature organization MOVE and Philadelphia police through the efforts of the son of two of the group members to secure their parole. A strong emotional hook greatly assists in telling a tenaciously complicated story.
I would like to have seen more on the genesis of the group and the first stages of their conflict with the mayor and police. So much needs to be unwound in the 1978 standoff that the even more astonishing story of a 1985 confrontation, which resulted in Philadelphia authorities dropping a satchel bomb from a helicopter, killing 11 and burning down 65 houses, goes unmentioned here. Another doc I haven’t seen, Let the Fire Burn, focuses on that part of the story.
True Mothers [Japan, Naomi Kawase, 4.5] Parents of a kindergartner react with dismay when a woman contacts them claiming to be his birth mother. Luminous, delicate drama of shifting perspectives.
Limbo [UK, Ben Sharrock, 4] Syrian oud player grapples with guilt over family left behind as he cools his heels with other refugee claimants at a center in the bleak and isolated Outer Hebrides. Moments of deadpan humor and stark landscapes layer this exploration of displacement.
Capsule review boilerplate: Ratings are out of 5. I’ll be collecting these reviews in order of preference in a master post the Monday after the fest. Films shown on the festival circuit will appear in theaters, disc and/or streaming over the next year plus.
The final day of TIFF 2020 has come and gone and below are my final capsule reviews. I’ll post a full capsule roundup on Monday.
Fauna [Mexico/Canada, Nicolás Pereda, 3.5] Narratives nest within narratives when an actor visits his girlfriend’s family in a sleepy small town. Comic misunderstandings, naturalistic locations and twisting meta-story may remind seasoned festival-goers of the works of Hong Sang-soo, with Coronas instead of soju.
Preparations to Be Together For an Unknown Period of Time [Hungary, Lili Horvát, 4] Top neurologist questions the accuracy of her recollections when she moves back home from the US to Budapest for a romantic rendezvous, only to find that the object of her affections professes not to remember her. Quietly suspenseful drama of psychological uncertainty.
The Truffle Hunters [Italy, Michael Dweck & Gregory Kershaw, 4] An aging generation of Piedmontese truffle hunters carries on the search for the elusive delicacy, fearing the poison bait left for their beloved dogs by ruthless newcomers to the trade. A documentary balm for lovers of food and canines luxuriates in the presence of sumptuously photographed forest eccentrics and their very, very good dogs.
Bandar Band [Iran/Germany, Manijeh Hekmat, 3] A pregnant singer, her husband and their guitarist try to get their van through a floodstruck region to attend a contest gig in Tehran. Neorealist drama where the obstacles in the characters’ path are literal.
The Water Man [US, David Oyelowo, 3.5] Imaginative kid (Lonnie Chavis) heads into the Northwestern forest in search of a legendary immortal, thinking he holds the secret to curing his mom (Rosario Dawson) of leukemia. One of the more successful of a recent wave of films that put a somber sin on 80s kids adventure, thanks to a well-constructed script and Oyelowo’s sure control of tone.
Among the differences of this digital-only fest was that it removed the flexibility to choose between multiple screening dates. In a regular year I program the last days and work backward to end on some combination of stronger and/or lighter selections. Here programmers assigned a 24 hour window for each film. These last movies weren’t what I would have picked as closers in ordinary times. To compensate for this Valerie and I are running a day of fake TIFF programming to simulate the funner final Sunday we usually shoot for. They consist of one film that played at TIFF 2019 and three others from previously-appearing directors. Play along at home by streaming The Vast of Night, The Forest of Love*, Mr. & Mrs. Adelman, and Ace Attorney.
*Update: Turns out this one is ultra-disturbing and in no way fun or light. Going into something with mistaken tonal expectations—just like the real TIFF!
Capsule review boilerplate: Ratings are out of 5. I’ll be collecting these reviews in order of preference in a master post the Monday after the fest. Films shown on the festival circuit will appear in theaters, disc and/or streaming over the next year plus.
Five new National Geographic maps complete coverage of Washington Cascades
Published: Tuesday, September 07, 2010, 3:15 AM
Terry Richard, The Oregonian
Washington's Cacades are covered.
With the release of five new maps this summer by National Geographic, the rugged mountains of Washington are covered from the British Columbia border to Oregon.
The maps are sold under the Trails Illustrated brand.
New titles this year area Mount St. Helens/Mount Adams, Goat Rocks/Norse Peak/William O. Douglas Wilderness Areas, Alpine Lakes Wilderness, Glacier Peak Wilderness and Mount Baker/Boulder River Wilderness Areas.
They go along with several other titles already in print to complete the coverage: North Cascades National Park, Mount Rainier National Park and Columbia River Gorge National Scenic Area.
The full-color maps are printed on hefty water-proof, tear resistant paper. National Geographic is one of the best mapmakers in the business, so the maps meet the highest standards.
The maps are topographical, but they cover such a large area that the contour interval is 50 feet. This is a little too big for serious off-trail mountain navigation, but National Geographic also sells state map series on CD Roms under the Topo brand with 20-foot contour intervals.
The new printed maps maps are excellent for hiking and driving. They show most of the trails and most of the roadside amenities, in easy-to-read formats.
Your map files may already contain U.S. Forest Service maps of the areas, but these maps often go 15 years or more between updates. The new Nat Geo maps are the best new maps at this time for the areas they cover.
Look for them at stores that sell maps, though getting this many new titles in any particular store may be difficult.
One place that does have them all is the Nature of the Northwest in Portland, at 800 N.E. Oregon St., Suite 965. Phone number is 971-673-2331.
You can also order them from National Geographic. Cover price is $11.95. For more information visit Trails Illustrated Washington maps.
-- Terry Richard
Japanese encephalitis virus activity in the Kimberley Government of Western Australia Department of Health
Fund raisers working in outsourced call centers, or directly for just one non-profit, face many of the same problems. While non-profit fund raising can be a very rewarding career choice, it can also be very stressful at times.
Donors who support a given charity don't always feel that being contacted by their non profit whether by phone or by means of a direct mail campaign, is something that they want to have any part of.
Often times, a fundraiser will feel that the campaign they're currently raising contributions for is a perfect and fool proof campaign. Donors have other ideas. At times it seems that donors who give to groups like The Humane Society Of The United States or PETA are far more receptive to a general appeal for animal welfare than those donors who support Oxfam International, or Habitat or Habitat For Humanity, when considering helping out on an emergency appeal.
Why should this be so? A quick answer to this question is that those fund raisers who are less emotionally invested in a campaign are better able to communicate the wishes and needs of an organization. Quite frankly, believing that one particular type of campaign is less important than another, will limit your ability to do well on either type of campaign in the long run.
After a year or so of professional, fundraising I had an epiphany; it doesn't really matter so much what you say on the phone to a donor. What matters is how you say it. My attitude changed at that point. I became less concerned with asking and more concerned with communicating. My performance improved, I felt far less burned out at the end of the day, and I began to raise more money.
There are certain truths that are universal to all campaigns. Mastery of these axioms of fund raising can only bring about better performance from fund raisers, and better results for the non profits we work for. Scientists who look deeply into the universe become mystics, fund raisers who strive to perfect their craft do as well. This is the first in a more abstract series of posts known as Fund Raising:102
The first is: Always regulate your mood.
No matter how enthusiastic a fund raiser is about a charity, or a campaign, being in control of ones emotions at all times will provide the best results. Donors can hear our emotions on the phone. Most people would rather hear a calm and compelling fund raiser map out the key strategies of a fund raising campaign than unbridled enthusiasm that borders on mania.
There is perhaps no better skill a fund fund raiser can have than the ability to match their tone, their emotional state, with that of the donor's.
Be enthusiastic, but remember that you are a complete stranger to your donor. You've interrupted their life and what always seems to be a critical time, and you want them to give you money!
So build your enthusiasm during the course of the call. Allow the donor to catch up to you rather than bowling them over. A single moment in a good fund raising call is like an eternity. Donors are compelled to listen the the truth of a good pitch.
Fund raisers who speak slowly and clearly, with a mastery of their fund raising campaign, are far less likely to be hung up on at all. Knowledge of the subject matter of a campaign, confidence in the virtue of the cause you are fund raising for, and empathy with the donor with whom you speak, create instant gravitas.
Instead of a rambling mendicant, a skilled fund raiser personifies the true meaning of the word solicitor; An authoritative figure who by virtue of the truth of their cause, and the strength of their argument, compels those who hear to listen, and those who listen to act.
This brings us to the second rule; focus on listening at all times, even while speaking.
If a donor shows a high level of enthusiasm for your campaign then by all means match that enthusiasm. Always strive to be listening to the donor listening to your voice. This concept surpasses what can be taught about fund raising, it must be experienced first hand; an experienced professional fund raiser can measure the attitude and attentiveness of a donor.
Listening to a donor while speaking at the same time is done by knowing, and believing in your campaign enough to stop listening to yourself say the words, and focus solely on the fact that you are speaking with another human being. Not a name, or a telephone number on a screen, not a statistic in a database, a person. The donors can hear this in your voice.
This strategy can change the outcome of virtually any fundraising call in a positive way. If a random donor plucked out of a database somewhere in an autodialer in the belly of your call center can tell what kind of mood you're in, how much better at doing the same thing should a fundraiser who makes 500 to 1000 calls each week?
Anyone who's had even limited success at fund raising through telephone campaigns has had life changing and inspiring conversations with people from all walks of life. Great fund raisers enjoy these moment several times per day.
That's all I've got, so far, for linguistic commentary on the U.S. election results. According to the OED, the etymology of ballot is < (i) Middle French ballotte (French †ballotte) small ball (beginning of the 15th cent. as †balote), small coloured ball placed in a container to register a secret vote (1498) or its etymon […]
Hello team!
I turned 45! It happens every year (not the same age, but the same feeling, of time marching forward, with me along with it) so no big surprise. This weekend was the Great Race, also every year, but I unsubscribed from their e-mail list at some point months ago because they seem to operate this list under the misconception that subscribers want to think about Great Race 24/7 all year round. I thought: It should be easy to just remember when the Great Race is, as it always falls on the weekend near my birthday, and I do not need a list constantly mailing me reminders. Easy. But then I forgot about the Great Race, so I didn't run it.
I did take the day off for my birthday despite this being the busy time of year at work, which was worth it: I made some good progress on some projects that had been backed up in my anxiety-brain for some time. Of course they are confidential, but here is a graphic of some significant progress:
A colleague, who has sometimes posted here as Bystander N, has sent me the following, asking me to put it on the blog. It is gratifying, and I hope that it is true.
Tomorrow is a particularly sad day for my bench. I know Bystander and he had no idea I was going towrite this short piece. Tomorrow he will be officially “past it”, though of course in reality nothing likepast it and he is as sharp as they come.Both here on this blog and in our retiring rooms we will miss his kindness, warmth, immenseknowledge, sense of fair play, sense of humour and seemingly endless stream of amusing courtanecdotes.I have not always agreed with him on bail and sentence decisions but that’s the way the systemworks. I have learned a great deal from him and I am really sorry he will not be amongst us anylonger. I have heard him say that he thinks he saw the best of the bench many years ago. He maybe right but I’m still sure, even if he will not miss all of it, he will miss most of it.
The MoJ's planning for recruitment to the bench is no better than their usual planning, unfortunately. When I was sworn in in 1985 I became one of about 29,000 JPs in England and Wales; today the Bench is more like 19,000 strong, the drop being largely due to the increase in out-of-court disposals such as fixed penalties and cautions. In the meantime numbers have gone up and down, and during the years of amalgamating benches just over five years ago there was a virtual freeze on recruitment for some time. Now the system is struggling to recruit enough JPs to do the job. Nowadays, the biggest obstacle is the reluctance of many employers to allow JP employees time off. This even applies to public services such as the fire brigade, who used to be known for being relatively generous with time off for public service, but are now more niggardly.
I shall not fill the blog with the minutiae of how to apply, because the website (www.gov.uk) is very good, but I can say that if you are even slightly interested in the justice system you should consider applying. I wouldn't have missed it for the world, and your chances are probably better than you would expect
Today I went back to the Cook's Illustrated Cookbook for their Chicago-style pizza recipe (No, they're not from Chicago, but their recipe is actually pretty close to others I've used in the past.).
They've got a technique where you "laminate" the crust with butter to make it crispier. It worked well with the sides, but I'm not sure that it quite worked with the bottom, but the crust did turn out pretty firm and full-bodied. And rich. Next time I might let it cook a little longer to see what happens.
The recipe for the sauce and the cheese were a bit different than what I've done before: using shredded mozzarella and diced tomatoes instead of mozzarella slices (or a fresh ball) and crushed tomatoes, but it turned out pretty well. Next time, though, I think I'll go back to crushed with slices.
And the Star Trek pizza cutter is actually big enough to use on deep dish...
I had Brian Yansky and Frances Yansky over to share the results, so I didn't end up taking too many pictures, but here are a couple:
Pizza! And the Star Trek pizza cutter! |
Frances poses with a slice. |
The cat inspects the table. |
It's no secret that I'm an aficionado of Lisp. It's my go to language, especially when I don't know what I'm doing. I call it research and prototyping, but it's really just playing around until something works.
We had a need for some auditing of some of our databases at work. They ought to agree with each other and with what GitHub and CircleCI think. It took a couple of weeks part time to prototype a solution in Common Lisp. It showed that the databases were in 99% agreement and found the few points of disagreement and anomalies that we ought to fix or look out for.
I want to integrate this information into a dashboard on one of our tools. I prototyped this by spinning up a Common Lisp microservice that returns the information in JSON format.
But management prefers that new services are written in golang. It would be easier for me to rewrite the service in golang than to try to persuade others to use Common Lisp. It also gives me the opportunity to compare the two languages head to head on a real world problem.
No, this is not a fair comparison. When I wrote the Lisp code I was exploring the problem space and prototyping. I'm much more experienced with Lisp than with golang. The golang version has the advantage that I know what I want to do and how to do it. In theory, I can just translate the Common Lisp code into golang. But then again, this is a “second system” which is not a prototype and has slightly larger scope and fuller requirements. So this cannot be a true head to head comparison.
The first point of comparison is macros (or lack thereof). I
generally don't use a lot of macros in Common Lisp, but they come in
handy when I do use them. One macro I wrote is
called audit-step
, which you can wrap around any
expresion and it prints out a message before and after the
expression is evaluated. The steps are numbered in sequence, and
nested steps get nested numbers (like step 2.3.1). If you wrap the
major function bodies with this macro, you get a nice trace of the
call sequence in the log.
Golang doesn't have macros, but it has first class functions. It's easy enough to write a function that takes a function as an argument and wraps it to output the trace messages. In fact, the macro version in Common Lisp just rewrites the form into such a function call. But the macro version hides a level of indentation and a lambda. In golang, my major functions all start with
func MajorFunction (args) int { return AuditStep("MajorFunction", "aux message", func() int { // body of MajorFunction // Actual code goes here. }) }
The bodies of all my major functions are indented by 16 spaces, which is a little much.
I like higher order functions. I can write one higher order
function and parameterize it with functions that handle the specific
cases. In my auditing code, one such workhorse function is
called collate
. It takes a list of objects and creates
a table that maps values to all objects in the list that contain
that value. To give an example, imaging you have a list of objects
that all have a field called foo
. The foo
field is a string. The collate
function can return a
table that maps strings to all objects that have that string in the
foo field.
collate
is very general. It takes a list of objects
and four keyword arguments. The :key
argument is a
function that extracts the value to collate on.
The :test
argument is a function that compares two keys
(it defaults to eql
if not specified).
The :merger
argument is a function to add the mapped object to its appropriate
collection in the table (it defaults to adjoin). The :default
argument
specifies the initial value of a collection in the table (it
defaults to nil).
The :merger function is the most interesting. It takes the key and
the object and the current value of the table at that key. It
returns the new value of the table at that key. The default merger
function is adjoin
, which adds the object to the
collection at the key if it is not already there. But you can
specify a different merger function. For example, if you want to
count the number of objects at each key, you can specify a merger
function that increments a counter.
The functional arguments to the collate function are often the
results of other higher order functions. For example,
the :key
argument is often the result of composing
selector functions. The :merger
argument is often the
result of composing a binary merge function with a unary transformer
function. The transformer function is often the result of composing
a number of primitive selectors and transformers.
In Common Lisp, it is quite easy to write these higher order
functions. We can compose two unary functions with
the compose2
function:
(defun compose2 (f g) (lambda (x) (funcall f (funcall g x)))
and then compose as many functions as we like
by fold-left
of compose2
starting with
the identity
function:
(defun compose (&rest fs) (fold-left #'compose2 #'identity fs))
We can compose a binary function with a unary function in three ways: we can pipe the output of the binary function into the unary function, or we can pipe the output of the unary function into one or the other of the inputs of the binary function.
(defun binary-compose-output (f g) (lambda (x y) (funcall f (funcall g x y)))) (defun binary-compose-left (f g) (lambda (x y) (funcall f (funcall g x) y))) (defun binary-compose-right (f g) (lambda (x y) (funcall f x (funcall g y))))
The collate
function can now assume that a lot of the
work is done by the :key
and :merger
functions that are passed in. It simply builds a hash table and
fills it:
(defun collate (item &key (key #'identity) (test #'eql) (merger (merge-adjoin #'eql)) (default nil)) (let ((table (make-hash-table :test test))) (dolist (item items table) (let ((k (funcall key item))) (setf (gethash k table) (funcall merger (gethash k table default) item)))))) (defun merge-adjoin (test) (lambda (collection item) (adjoin item collection :test test)))
So suppose, for example, that we have a list of records. Each
record is a three element list. The third element is a struct that
contains a string. We want a table mapping strings to the two
element lists you get when you strip out the struct. This is easily
done with collate
:
(collate records :key (compose #'get-string #'third) :test #'equal ; or #'string= if you prefer :merger (binary-compose-right (merge-adjoin #'equal) #'butlast))
The audit code reads lists of records from the database and from GitHub
and from CircleCI and uses collate
to build hash tables
we can use to quickly walk and validate the data.
Translating this into golang isn't quite so easy. Golang has first
class function, true, but golang is a statically typed language.
This causes two problems. First, the signature of the higher order
functions includes the types of the arguments and the return value.
This means you cannot just slap on the lambda
symbol,
you have to annotate each argument and the return value. This is
far more verbose. Second, higher order functions map onto
parameterized (generic) types. Generic type systems come with their
own little constraint language so that the computer can figure out
what concrete types can correctly match the generic types. This
makes higher order functions fairly unweildy.
Consider compose2
. The functions f
and g
each have an input and output type, but the
output type of g
is the input type of f
so only three types are involved
func Compose2[T any, U any, V any](f func(U) V, g func(T) U) func(T) V { return func(x T) V { return f(g(x)) } }
If want to compose three functions, we can write this:
func Compose3[T any, U any, V any, W any](f func(V) W, g func(U) V, h func(T) U) func(T) W { return func(x T) W { return f(g(h(x))) } }The generic type specifiers take up as much space as the code itself.
I don't see a way to write an n-ary compose function. It would have to be dynamically parameterized by the intermediate types of all the functions it was composing.
For the collate
function, we can write this:
func Collate[R any, K comparable, V any]( list *Cons[R], keyfunc func(R) K, merger func(V, R) V, defaultValue V) map[K]V { answer := make(map[K]V) for list != nil { key := keyfunc(list.Car) probe, ok := answer[key] if !ok { probe = defaultValue } answer[key] = merger(probe, list.Car) list = list.Cdr } return answer }
We have three types to parameterize over: the type of the
list elements (i.e. the record type) R
, the type of
the key K
, and the type of the value V
.
The key type is needs to be constrained to be a valid key in a map,
so we use the comparable
constraint. Now that we have
the types, we can annotate the arguments and return value. The list
we are collating is a list of R
elements. The key
function takes an R
and returns a K
. The
merger takes an existing value of type V
and the record
of type R
and returns a new value of
type V
.
The magic of type inference means that I do not have to annotate all the variables in the body of the function, but the compiler cannot read my mind and infer the types of the arguments and return value. Golang forces you to think about the types of arguments and return values at every step of the way. Yes, one should be aware of what types are being passed around, but it is a burden to have to formally specify them at every step. I could write the Common Lisp code without worrying too much about types. Of couse the types would have to be consistent at runtime, but I could write the code just by considering what was connected to what. In golang, the types are in your face at every function definition. You not only have to think about what is connected to what, you have to think about what sort of thing is passed through the connection.
I'm sure that many would argue that type safety is worth the trouble of annotation. I don't want to argue that it isn't. But the type system is cumbersome, awkward, and unweildy, especially when you are trying to write higher order functions.
It is taking me longer to write the golang version of the audit service than it did to write the Common Lisp version. There are several reasons. First, I am more experienced with Common Lisp than golang, so the right Common Lisp idioms just come to mind. I have to look up many of the golang idioms. Second, the golang code is trying to do more than the Common Lisp code. But third, golang itself introduces more friction than Common Lisp. Programs have to do more than express the algorithm, they have to satisfy the type system.
There are more points of comparison between the two languages. When I get frustrated enough, I'll probably write another post.
.
The kind people at Reactor Magazine have posted my two latest Mongolian Wizard stories, one yesterday and the other today. Thursday's "Halcyon Afternoon" took place during a rare moment of peace for Franz-Karl Ritter. But in today's "Dragons of Paris," it's warfare as usual.*